Re: Discuss changing the behaviour of append()

new topic     » goto parent     » topic index » view thread      » older message » newer message

Lets change the behavior of operator[]:

atom a1 = 5 
for i = 1 to length(a1) do 
   ? a1[i] -- prints 5 
end for 

JUST KIDDING!

Seriously, this continued treatment of atoms as one-member sequences in more and more instances will only add to confusion. Changing behavior of things is low lying fruit. In some cases this will break new users. In EUPHORIA 5 != {5} but the standard library and builtins more and more treat them as if they are the same.

For example: If you do a match_replace with 'a' you will replace 'a' in a word without complaints but if you are purposely replacing one character in a string you ought to use find_replace and this kind of distinction should be taught everywhere for consistency.

When you try to replace a word in a list of words using match_replace, you would get burned. The lazy conversion here causes people to use a function wrong and learn it wrong. The word wont be replaced in the word because it is comparing the word with lists of words. One might argue good programmers would never make this mistake, however.

If you are using a data structure which contains a list of numbers, you are not going initialize the list to one number. If you know what you are doing, you might initialize it to 0 to signal it is not yet setup and later initialize it with a sequence of numbers. Setting this list to a single atom is an accident and changing append such that it hides this kind of problem is a mistake.

Shawn Pringle

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu