1. Re; Features

Einar Mogen suggested:

>Now, when we are allready into things to add to Euphoria, I would like to
>repeat two suggestions that I particulary like:
>
>1. Variable assignment on declarations:
>
>integer c = 0, x, y, b = 1

Yes!

>2. Function return values to multiple variables:
>
>{x, y, z} = GetPos()


Yes!

[Dot Notation]

Ralf suggested an alternate character for dot notation, such as '~' or ','.
I'm flattered that he likes the idea, but I feel his suggestions come with
too much semantic overhead.

The '~' (tilde) has a couple of disadvantages - it represents a logical not
in some languages, and a destructor in C++. Even worse, it requires a
*shift* key on American keyboards. The trauma to my fingers at having to
stretch that distance would be immeasurable. blink

The ',' (comma) is already used as a delimiter in Euphoria. To make a symbol
to double duty is just askig for trouble.

The dot, on the other hand, is used in other languages for the very purpose
I suggest (VisualBasic, not C++, served as the inspiration). It requires no
shift key, and is conveniently placed. The emotional baggage it carries from
those "other" languages means more less of a learning curve for coders.

The biggest disadvantages to using the dot is (1) is it small, and sometimes
difficult to see, and (2) it is a strong contender for the oft-requested
type-checking element feature, such as:

    deck[1].suit = HEARTS

for what is currently:

    deck[1][SUIT] = HEARTS

But Robert has already voiced the unliklihood of adding such a feature to
Euphoria.

In any event, you can use the dot notation to implement type-save assignment
of elements::

    deck[1].setSuit(HEARTS)

I should point out that my proposed syntax *can* be a bit confusing. If
there is no assignment to a function, it is assumed that assignment is to
the data. For example:

    b.append("x" )

is read as an implicit assignment:

    b = append( b, "x" )

because the value is not used, while

    a = b.append("x")
    if b.append("x") then

convert to:

    a = append( b, "x" )
    if append( b, "x" ) then

because their values are explicitly assigned. I had considered alternative
notations to make the assignment explicit, such as:

    self = append( b, "x" )
    @ = append( b, "x" )
    = append( b, "x" )
    == append( b, "x" )
    => append( b, "x" )
    >> append( b, "x" )

but they all seemed awkward, while the more "magical" implicit syntax seemed
very natural.

Again, I suggest that people actually try syntax out - the DOT pre-processor
actually does work. I don't think I've gotten any feedback from anyone who's
actually tried to code using it (strongly hinting there is little interest).
sad

-- David Cuny

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu