1. Procedure Syntax Suggestion

Hello group, BASIC to Euphoria convert here.  My main reason for learning to
program is that I'm going into EE (that's elec. eng.) at Auburn this fall, so
I've taught myself BASIC and now I'm moving on to Euphoria.
  The only thing that bothers me about Euphoria is when you call procedures,
you have to use parentheses.  I know this is traditional with programming
languages... but it could be just as interpretable and just as readable
without them, right?  Of course you still could use parentheses, otherwise all
previous code would have to be modified.  Just like spaces and blank lines,
programmers have their own style, so choice of parentheses around parameters
could be another choice.  Consider this:

puts(1,"Ye olde way\n")
puts 1, "The new way\n"
--or--
key = gets (0)
key = gets 0  --New way

  Like I said before, this is radical and goes against traditional style, but
after all, isn't that what makes Euphoria so useful?

Derek Brown

new topic     » topic index » view message » categorize

2. Re: Procedure Syntax Suggestion

At 09:50 PM 07-03-1999 , you wrote:
>  Hello group, BASIC to Euphoria convert here.  My main reason for
learning to
>program is that I'm going into EE (that's elec. eng.) at Auburn this fall, so
>I've taught myself BASIC and now I'm moving on to Euphoria.
>  The only thing that bothers me about Euphoria is when you call procedures,
>you have to use parentheses.  I know this is traditional with programming
>languages... but it could be just as interpretable and just as readable
>without them, right?  Of course you still could use parentheses, otherwise
all
>previous code would have to be modified.  Just like spaces and blank lines,
>programmers have their own style, so choice of parentheses around parameters
>could be another choice.  Consider this:
>
>puts(1,"Ye olde way\n")
>puts 1, "The new way\n"
>--or--
>key = gets (0)
>key = gets 0  --New way
>
>  Like I said before, this is radical and goes against traditional style, but
>after all, isn't that what makes Euphoria so useful?

Completely unuseful Derek. Because Euphoria doesn't have an
end_of_statement delimiter (like C and Pascal ';'), the parenthesis are
required so the interpreter doesn't confuse missing parameters from other
statements. Example:

procedure myproc(integer i, integer ii)
...
end procedure

myproc 10 i = gets 0

Should mean:
myproc(10, i = gets(0))

But also might mean that you forgot a parameter and wanted to code:
myproc(10, ?)
i = gets(0)

Very different!

That would be a hard to catch bug with your proposed syntax; a very error
prone syntax indeed.


Regards,
         Daniel  Berstein
         [daber at pair.com]

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu