Re: Eu vs perl
- Posted by David Cuny <dcuny at LANSET.COM> Dec 07, 1999
- 356 views
Everett Williams wrote: > If an integer or atom misbehaved in a similar manner by > failing to control for type characteristics, all would be up > in arms. Inertia justifies all. Why stop at strings? What about if I wanted an array of integers? By the same logic, I shouldn't use a sequence to store an array of integers, because Euphoria doesn't ensure that a non-integer won't intrude into the sequence. I'm not sure where all the rogue data values are coming from, but if you are really concerned about keeping the data values in range, you can always write: s = and_bits( s, #FF ) and all your values are coerced into submission. > Efficient detection of the intrusion of those non-char values > into a "string" sequence is one thing that I would like to have > accomplished. The most efficient place to detect an 'intrusion' would be at the point before the element was added to the "string". Imagine that Euphoria actually did detect non-char elements in strings. Something along the lines of: global type string( object o ) atom a if not sequence( o ) then return False else for i = 1 to length( o ) do a = o[i] if and_bits( a, #FF ) != a then return False end if end for end if return True end type What happens when a non-char is detected? Euphoria generates an error and shuts down. Not especially helpful. > Language translation for Euphoria where alphabets > differ drastically. Actually, since Euphoria allows up to 32 bit values in sequences, it's even more suited to handling wide character data than most languages with 'string' operators. Have you encountered any real cases where Euphoria's handling of 'strings' is problematic? So far, this 'flaw' still remains theoretical. -- David Cuny