realbasic-nug
[Top] [All Lists]

Re: What are expressions? (ByRef)

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: What are expressions? (ByRef)
From: Norman Palardy <npalardy at great-white-software dot com>
Date: Thu, 30 Jun 2005 13:24:24 -0600
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <74E7BAE3-09DD-46EC-A8CF-0FA300ABA748 at kellerfarm dot com> <AD07E2C3-D1A7-4021-8A20-D3F5B446A3A4 at mac dot com> <2BDABF28-C41C-43E3-B5F8-CCF65D3EC8B4 at haranbanjo dot com> <EEE66340-86F2-4B35-BD23-A01BA34D13F4 at GreenRiverComputing dot com> <44E68F94-5463-4092-A68D-DAB511DD6859 at mac dot com> <F6361DE1-E6DD-4A40-9BCD-D50A51D19876 at mac dot com> <272A5BB6-9136-41FD-8D04-E95C8F323AE8 at realsoftware dot com> <4c2b930a8a65d2a9639b5a7262c01fdd at great-white-software dot com> <9322004A-7EC8-482C-91C3-E6D434B7E371 at realsoftware dot com> <558f7c3d678a869e283f0ddc379b3bf0 at great-white-software dot com> <BFB2C14D-3FAE-4B25-A1FD-C1A4F91D893E at realsoftware dot com> <99FCA9C5-7CAC-4969-914B-18C851628D2B at mac dot com> <3424EA5D-F6B0-434C-BBDA-C5C58776145E at haranbanjo dot com> <609CCB22-ECB5-4A73-9017-9E39E5DA0A36 at mac dot com>

On Jun 30, 2005, at 1:06 PM, Stefan Pantke wrote:


Have a look at this

    foo 1+ goo 2

Is the meaning of this obvious? Is it

    foo( 1 + goo( 2 ) )
or
    foo( 1 ) + goo( 2 )

Do you really think, that the first line is more readable
than the 2 lines below? Is the first line syntactically correct
with respect to RB anyway?
This is invalid and won't compile
Meaning is the semantics of a language, and that is best defined by the code that is written and usually parentheses help make it clear what the meaning is by establishing evaluation order.


Another example:

    dummyI = max( 2, max( 3,4 ))
    dummyI = max 2, max( 3,4 )
    dummyI = max( 2, max 3,4 )
    dummyI = max 2, max 3,4

The first line compiles, while all other lines report error messages.
Can you explain why?
Because Max is a function call and without the opening paren to identify the argument list it's not clear what is arguments to the function call

Moreover, the fact, that you can't use parens at certain position due to this bad language design issue, is absolute contra-intuitive.

I agree that parens should be usable just about anywhere we want just to force evaluation order and I still dont understand why the example you posted with

                "the beginning" + (New Date()).SQLDate() + "and the end"

did not work as it use parens to try and force the order but results in a syntax error ....

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>