>> There is nothing wrong. Certain programming languages try to
>> handle certain things differently.There is a new wave of languages
>> that take immutability and referential transparency very seriously.
>> (please use your favourite search engine to figure out what they
>> are)
>> 
>> The gist of immutability is that any operations on a data
>> structure should not change its data structure. (for e.g. java's
>> String class is immutable) In python the "reverse()" method is
>> mutating the list instead of returning a new output.

IMHO, a language should not enforce any one thing. It should have
constructs to do both.

For example, while, an immutable 'string' is definitely nice, creating
new strings based on existing strings (like concatenation) becomes
painfully expensive.

  new_S = S1 + S2 + S3 + S4

i.e. To combine N strings together, you'll generate N-1 intermediate
temporary objects. Imagine something as trivial as 'SQL query
construction'. Try doing a dozen queries in an incoming request. Try
handing 100 such requests per second. You'll feel the pinch.

In python strings are immutable. But for a case like above, we have
string formatting and few other ways to make things faster. Like,

  new_S = "%s%s%s%s" % (S1, S2, S3, S4)
  new_S = ''.join((S1, S2, S3, S4))

Now, imagine enforcing 'immutability' into every data-type. You'll have
an explosion of these "non regular language constructs/tools". And these
exceptions are the ones that make 'programming languages' not so beautiful.

-- 
.o. I'm a Free man. I use Free Software.
..o
ooo http://www.joesteeve.org/

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to