compare , zero indexing (Re: mainly syntax)

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

David Cuny wrote:

> compare() vs. "=" is just trouble waiting to happen. I assume that the
> reason that Euphoria uses compare is so that the "=" operator can be
> optimized to handle numeric values.

No, I don't think so. Compare() returns three values: less than,
equal, greater than. = only two: equal, unequal.

What threw me off is that  "if x=y"  reports an error
when x and y are strings, and that compare() returns
-1, 0, or 1.  Me, simple-minded linguist that I am,
I have written myself compare functions in Pascal before,
but I had them return '<', '=', and '>'!


> [Zero Indexing]

> The rest of the programming world starts counting with zero

Except Pascal, ALGOL, Simula, Ada, Modula, and, I imagine, others
I do not know about, which start counting from whatever you tell
them. I am quite happy with counting from 1 in Euphoria, I am
not a Mayan, you know (they counted the days of the month
from zero).


> At a minimum, we need a mechanism that can be called to save the user's
> precious data before the program shuts down. Preferably, I should be able
> to place a routine id in a variable:

>    onError = routine_id( "save_user_data" )

I agree there. I had been looking for something like that in the
reference library and the manual, and was surprised not to find
anything. I thought it was myopic me.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu