1. Reference manual
- Posted by rforno at tutopia.com
Dec 22, 2001
Rob:
While browsing the reference manual, I found that the example following the
rule about applying binary operators to sequences
1. has a typo
2. does not exemplify the rule but the following one
I also found some items that may confuse the beginner, for example
3. strings are exemplified before they are defined
4. constants are used before they are defined
2. Re: Reference manual
rforno writes:
> Rob:
> While browsing the reference manual, I found that the example following the
> rule about applying binary operators to sequences
> 1. has a typo
> 2. does not exemplify the rule but the following one
OK, I've fixed it. Thanks.
> I also found some items that may confuse the beginner, for example
> 3. strings are exemplified before they are defined
> 4. constants are used before they are defined
I guess I appeal to the reader's intuition in a few places.
"define-it before you use it" is not always easy.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com
3. Re: Reference manual
----- Original Message -----
From: "Robert Craig" <rds at RapidEuphoria.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Reference manual
> > 4. constants are used before they are defined
>
> I guess I appeal to the reader's intuition in a few places.
>
> "define-it before you use it" is not always easy.
>
Or always useful.
-----
Derek.
4. Re: Reference manual
On 23 Dec 2001, at 15:42, Derek Parnell wrote:
>
>
> ----- Original Message -----
> From: "Robert Craig" <rds at RapidEuphoria.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Sunday, December 23, 2001 2:37 PM
> Subject: Re: Reference manual
>
>
> > > 4. constants are used before they are defined
> >
> > I guess I appeal to the reader's intuition in a few places.
> >
> > "define-it before you use it" is not always easy.
> >
>
> Or always useful.
I agree, Derek. This may break the ability to make an eval() function.
Kat
5. Reference manual
- Posted by rforno at tutopia.com
Aug 14, 2001
Rob:
While re-reading the Reference Manual, I found:
"Declarations at the top level, outside of any subroutine, must really be at
the very top. They can't be nested inside a loop or if-statement."
I think this sentence is confusing. It may be interpreted as saying that
declarations should be at the very top *of the source file*, which is not
true. Moreover, I think more examples of placing declarations, includes and
so on at the top level should ease the comprehension of Euphoria techniques.
Another issue:
I found:
"Type checking can be turned off or on between subroutines using the "with
type_check" or "without type_check" special statements. It is initially on
by
default."
Does turning off type check apply also to predefined types? In such a case,
does it increase execution speed?
And another one:
Library.doc says:
" 2.1 Predefined Types
====================
As well as declaring variables with these types, you can also call them
just
like ordinary functions, in order to test if a value is a certain type.
integer - test if an object is an integer
atom - test if an object is an atom
sequence - test if an object is a sequence
object - test if an object is an object (always true)"
Although the word "value" is included, this does not make clear enough that
the result depends not on the original definition of the variable (for
example being atom or integer) or expression but on the value it contains.
In the case of atom versus integer, it does not clarify that an integer >
2^31 is not considered as such.
A question:
Assume the following code:
sequence x
atom a
x = {1, 2, 3}
a = 5
x[2] = a
How much space occupies x[2]?
And what if a = 5.0 instead?
Thank you for your attention.
6. Re: Reference manual
rforno writes:
<comments on wording of refman.doc>
Thanks. I'll see if I can improve the wording.
> Does turning off type check apply also
> to predefined types? In such a case,
> does it increase execution speed?
Checks for "sequence" and "integer" are always maintained.
Checks for "atom" won't be performed. This might save
you a bit of time.
User-defined type checks are turned off, but
consider the following:
type color(integer x)
return x = RED or x = BLUE or x = GREEN
end type
there will still be a simple integer-check
performed on variables of type color, but
the code inside the type won't be performed.
The same goes for sequence type.
>Assume the following code:
>
> sequence x
> atom a
> x = {1, 2, 3}
> a = 5
> x[2] = a
>
> How much space occupies x[2]?
4 bytes, enough for the integer 5.
> And what if a = 5.0 instead?
a pointer to a single copy of the 8-byte double, 5.0,
will be stored in x[2]. i.e. x[2] and a will both point to 5.0
(plus a 4-byte reference count).
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com