1. error in doc
- Posted by jacques_desch Aug 15, 2009
- 955 views
- Last edited Aug 16, 2009
section 4.2.1 it is said that Identifiers must start with a letter
with version 4 underscores are accepted too, should be corrected.
section 4.2.1.1
procedure bar(sequence s="abc", integer n, integer p=1) ? length(s)+n+p end procedure
s paramater should be after n as n is mandaroty
section 4.2.3.3
-- lib.e namespace lib.e
this should be namespace lib
There is a contradiction between 4.4.3 first sentence The ifdef statement is unlike all of the other statements in that it is executed at parse time not runtime.
and section 4.4.3.3
Is ifdef parse time or run time?
Jacques
2. Re: error in doc
- Posted by DerekParnell (admin) Aug 16, 2009
- 915 views
section 4.2.1 it is said that Identifiers must start with a letter
with version 4 underscores are accepted too, should be corrected.
Thanks ... this has now been fixed in the docs.
section 4.2.1.1
procedure bar(sequence s="abc", integer n, integer p=1) ? length(s)+n+p end procedure
s paramater should be after n as n is mandaroty
No it doesn't have to be. There is no requirement in Euphoria for mandatory parameters to come before optional parameters. You can mix them in any way that is appropriate for your routine's usage. The above example is saying that as the second parmeter is mandatory, you must always supply a second parameter. The first and third are optional and can be omitted from the calling code. To omit the first parameter you would code ...
bar(, 4)
section 4.2.3.3
-- lib.e namespace lib.e
this should be namespace lib
Thanks, this is now fixed in the docs.
There is a contradiction between 4.4.3 first sentence The ifdef statement is unlike all of the other statements in that it is executed at parse time not runtime.
and section 4.4.3.3
Is ifdef parse time or run time?
I don't see what the contradiction is. Can you show me both sentences to show me what is being contradicted.
The ifdef is executed during the parsing phase. That means that there is NO intermediate language code (IL) generated for the ifdef itself. Remember that the runtime phase only executes IL code.
To recap, the interpreter has two phases - parse-time and run-time. During the parse time, the source code is examined for validity and is converted to IL code. During run time, the IL code is executed, thus bringing your application to life. The ifdef statements are executed by the parser to select optional parts of your source code to convert to IL code.
for X = 1 to 10 do ifdef DEBUG then display("DEBUG: Value of X is []", X) end ifdef foo(X) end for
The generated IL code for this source depends on if DEBUG has been defined or not. If it is not defined the generated IL code will be for ...
for X = 1 to 10 do foo(X) end for
But if it was defined, the generated IL code would be for ...
for X = 1 to 10 do display("DEBUG: Value of X is []", X) foo(X) end for
3. Re: error in doc
- Posted by mattlewis (admin) Aug 16, 2009
- 924 views
There is a contradiction between 4.4.3 first sentence The ifdef statement is unlike all of the other statements in that it is executed at parse time not runtime.
and section 4.4.3.3
Is ifdef parse time or run time?
I don't see what the contradiction is. Can you show me both sentences to show me what is being contradicted.
The ifdef is executed during the parsing phase. That means that there is NO intermediate language code (IL) generated for the ifdef itself. Remember that the runtime phase only executes IL code.
Yes, although isn't the warning() statement executed at parse time as well?
Matt
4. Re: error in doc
- Posted by jacques_desch Aug 16, 2009
- 917 views
section 4.2.1 it is said that Identifiers must start with a letter
with version 4 underscores are accepted too, should be corrected.
Thanks ... this has now been fixed in the docs.
section 4.2.1.1
procedure bar(sequence s="abc", integer n, integer p=1) ? length(s)+n+p end procedure
s paramater should be after n as n is mandaroty
No it doesn't have to be. There is no requirement in Euphoria for mandatory parameters to come before optional parameters. You can mix them in any way that is appropriate for your routine's usage. The above example is saying that as the second parmeter is mandatory, you must always supply a second parameter. The first and third are optional and can be omitted from the calling code. To omit the first parameter you would code ...
bar(, 4)
section 4.2.3.3
-- lib.e namespace lib.e
this should be namespace lib
Thanks, this is now fixed in the docs.
There is a contradiction between 4.4.3 first sentence The ifdef statement is unlike all of the other statements in that it is executed at parse time not runtime.
and section 4.4.3.3
Is ifdef parse time or run time?
I don't see what the contradiction is. Can you show me both sentences to show me what is being contradicted.
The ifdef is executed during the parsing phase. That means that there is NO intermediate language code (IL) generated for the ifdef itself. Remember that the runtime phase only executes IL code.
To recap, the interpreter has two phases - parse-time and run-time. During the parse time, the source code is examined for validity and is converted to IL code. During run time, the IL code is executed, thus bringing your application to life. The ifdef statements are executed by the parser to select optional parts of your source code to convert to IL code.
for X = 1 to 10 do ifdef DEBUG then display("DEBUG: Value of X is []", X) end ifdef foo(X) end for
The generated IL code for this source depends on if DEBUG has been defined or not. If it is not defined the generated IL code will be for ...
for X = 1 to 10 do foo(X) end for
But if it was defined, the generated IL code would be for ...
for X = 1 to 10 do display("DEBUG: Value of X is []", X) foo(X) end for
All this is clear Derek, what is not clear is the title of section 4.4.3.3 runtime Definitions
As those definitions are to be used at parse-time they don't exist at run-time. Secondly as ifdef is used at parse-time, in the case of translated application there is no ifdef EUC to be executed to check if it is translated or not.
This is what is unclear to me.
Jacques
5. Re: error in doc
- Posted by jeremy (admin) Aug 16, 2009
- 852 views
Secondly as ifdef is used at parse-time, in the case of translated application there is no ifdef EUC to be executed to check if it is translated or not.
This is what is unclear to me.
euc has to parse the code initially to make the translation. So, ifdef EUC is done at parse time. Here's an example:
puts(1, "Hello\n") ifdef EUC then puts(1, "I am a translated program\n") end ifdef ifdef EUI then puts(1, "I am an interpreted program\n") end ifdef
C:\myproj> eui myproj.ex Hello I am an interpreted program C:\myproj> euc -keep myprog.ex rem -keep used to look at the source later ... translating ... ... compiling ... C:\myproj> myprog.exe Hello I am a translated program C:\myproj> type myprog.c ... EPuts(1, "Hello\n"); EPuts(1, "I am a translated program\n"); ...
So, the ifdef EUC was executed at parse time which took place during euc myprog.ex. Now, you are right in that the translated program does not execute the "ifdef EUC" check each execution. A translated program is only ever parsed once in it's entire lifetime and that is during translation, not during each execution. That's one of the benefits of a translated program, no parsing stage during execution. Ever.
Jeremy