Original date:2014-06-20 15:44:20 Edited by: mindwalker Subject: Re: Discuss changing the behaviour of append()

jimcbrown said...
_tom said...

Explaining CASE I to newcomers to O[ is simple.

Explaining how it works is simple. Justifying the reasons behind it is not so easy.

If someone things that explaining away the reason for this behavior is easy, then please explain why, in original instance (i.e. before we have code and have to deal with backwards incompatibilities), should append() only allow the haystack to be a sequence?

The original append functionality made sense, an atom by definition is autonomous and can't have something appended to it. An analogy, think of an atom as a point. You can't append another point to it because as soon as you do it is no longer a point. It becomes something else entirely, a line perhaps.

That said it was a little short sighted. One big strength of Euphoria is not having to remember to use the sequence append when appending to a sequence and the atom append when appending to an atom, and the object append when you are working with objects, etc.

So many other languages have this data type differentiation in their functions; either by function overloading or by multiple functions with different names that do the same basic thing but that take different parameter types. This is one reason other languages can be so hard to learn.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu