Re: unfolded expressions

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

Hello,

Ralf Nieuwenhuijsen wrote:

>Its seems I don't have too convice many of the advantages of these use:
>
>    { x, y }    = location ()

agreed 100%

>However, its seems, such expressions are more of a problem:
>
>    x + 1 = 34

As someone else pointed out that is a very simple example
of that kind of syntax.  It could get a lot worse.

>First of all, one must agree when used like above, for example, it can be
>more readable.
>I simply suggest that any use that might be confusing should be made
>illegal, why not ?

Okay, how about NOT allowing opperators or functions
on the left side? Only values:

x = 123                           -- Okay
{x, y} = location ()              -- Okay
{event, pos[1..2]} = mouse        -- Okay
x - 1 = 9                         -- Error, rewrite
power (x, 2) = 16                 -- Error, 2 possible answers
x + 1 = 11                        -- Error, rewrite

>However, about multiple variables on the left-side, why not consistently
>assign to the first variable mentioned or dissallow multiple variables
>alltogether.

Hey, I like multiple variables.
Multiple variables would be good because its
an assignment statement. You assign to variables, right?
You don't assign to expressions, at least I don't think
you should in Euphoria (IMHO).

>Actually, I feel sorry, that a new idea such as this, is approached upon
>implementation issues rather the theory and use behind it.

Wouldn't it be wonderful if we could just make up ideas
and let someone else work out all the problems they caused?

>I never specified on the exact rules, and it really shouldn't matter, the
>choice of wether or not allowing confusing code is one totally apart from
>the decision and discussion of such a language extension.

Okay, it shouldn't matter to you that the rules I
suggested above would severely restrict the syntax
you suggested.

>Speaking about confusing statements, its really in the hand of the
>programmer.
>This is legal, already:
>
>     function pos (object x)
>         return x + ( x < 0 ) * -2x)
>     end function

What?! I didn't know that was legal! Can you really
eliminate the "*" operateor like that? (-2x)

looking forward to responses,
Lewis Townsend


_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu