Tuesday, December 25, 2007

weakness of scripting languages

I think the biggest weakness of scripting languages - is a lack of strict rules for syntax, interpretation and so on. It's easy to break rules if they were not defined by some committee and were certified by ISO for example. Even every scripting language I used has such issue: perl, python, php, javascript etc. Quick issues:

  • perl: various ways to define the same thing. The screaming example is sub definition.
  • python: code indentation. It's a requirement to indent the code, but there is no strict rules how to do that.
  • php: variable definition. You may use undefined variable. It's only an interpreter's notice that you are using it.

3 comments:

Cheba said...

Any word about JavaScript (which is ECMA standard)?

Anyway statements you did are all about syntax strictness but not certainty. Say C and C++ are compiled languages but neither of their standards defines the formatting rules or the ways you have to write the code. Where you have to use pointers and where something else. It's all up to you and I believe C/C++ allows you to do same things in different ways too.

Ni@m said...

Yep, I agree that I've missed with ECMA.
ECMA is a well defined standart. It evolves as it must. But what about object definition o_O? It's definition is well defined but not well thought-out as for me.

But as for most of the other scripting languages - new features might be added and some old might be removed/deprecated rapidly.
It's hard to support old code and write new. For example if you used to call 'print "smth\n"' in perl<=5.9 now in 5.10 you can call 'say "smth"' which will add "\n" by itself. Yes, it's useful but do you need this built-in feature? In python you can use built-in lists '[]' and sets 'set'. The main difference is in the methods of these objects. [] is built-in, set is python class. Why do I need to make a choice? =)

Cheba said...

The biggest problem with language constructions/features deprecation is that you instantly break all the applications using those things. Would you use language that will break your application next year? I guess not. So what's the purpose of language nobody use?

In case with [] and set the decision is made on their interfaces. Maybe if Python could allow to extend []' interface there wouldn't be any set at all. Like in Ruby. ;)