1. Euphoria 2.3: First impressions (Long rambling post)

Over the weekend, I got to have my first look at Euphoria 2.3. Not for very
long, but I got to unleash my former software tester mindset upon it...

So. I've been playing with the NameSpaces, specifically trying to see what I
could break. Some of the error messages I turned up were a little weird.
e.g.:

include misc.e as M

? M:
    ^
 has not been declared [There's a space at the beginning of this line]

Also:

include misc.e as M

? M:PI    -- prints pi
? M : PI  -- spacing is apparently unimportant - prints pi
? M : -PI -- A bad attempt to print negative pi
         ^
-PI has not been declared ['-' isn't even valid in an identifier]

And just for fun [ :) ]:

? M:War
       ^
War has not been declared

-----
Something else I noticed was this:

1. Create an include (say 'gx.e') file that contains the following:

include graphics.e as G

-- code for gx.e

2. Include our new file in some other code

include gx.e as F

Should we not now be able to access things in graphics.e via the mechanism
F:G:something ? Or perhaps simply G:something?

Both of those return 'G has not been declared'.

However, if we had chosen to 'include gx.e as G', Euphoria complains that G
has been declared somewhere else. So is it defined or not?

I also got an interesting error message when trying to perform an arithmetic
operation on a namespace identifier, but I can't recall what that is...

-----
This brings me to (uncomfortably) request additions that others (IIRC) have
mentioned previously:

1. Allow inclusion of more than one include into a namespace. e.g.:

include get.e      as G
include graphics.e as G

* Note that all includes that don't have an 'as' put all of their global
declarations into a nameless communal namespace. It's not like we'd be doing
anything different here.

2. Make 'fred' and 'wilma' separate namespaces in:

include get.e as fred
include get.e as wilma

3. I realise that combining the above two may result in people wanting to
copy multi-include namespaces rather than have to retype them. e.g.:

include get.e      as G
include graphics.e as G

include G as A, B, C
-- A, B, C and G are now identical copies of the same namespace, but are
-- not the same namespace.

4. Create an in-built namespace called Euphoria (or similar), so that we can
do things like:

integer length_id
length_id = routine_id("Euphoria:length") -- now works
length_id = routine_id("length") -- still an 'undeclared' error

* Adding to or copying the 'Euphoria' namespace should not be allowed.

* Maybe we could give our nameless global namespace a name too?

6. Fix 'F:G:something' and 'M:' one way or another. ;)

-----
While I'm ranting, here's a gripe of mine:

Could we *please* have short-circuiting on returns in types?

type wunga(object x)
   return sequence(x)
      and length(x) = 2
      and integer(x[1])
      and integer(x[2])
end type

Currently has to be written (similarly to):

type wunga(object x)
   if  sequence(x)
   and length(x) = 2
   and integer(x[1])
   and integer(x[2])
   then return 1
   else return 0
   end if
end type

For short types like 'wunga' here, I think you can see that it benefits from
the tidier syntax.

-----
Finally, I see no mention of 'as' as a valid keyword in section 2.4.1 of the
documentation. Is this an oversight, or is it not considered a keyword by
the interpreter?

Carl

PS Maybe I should have made myself available during alpha/beta testing... :(

PPS Today has not been entirely pleasant for me in matters unrelated to
Euphoria. Please take antacid after reading this post :)

new topic     » topic index » view message » categorize

2. Re: Euphoria 2.3: First impressions (Long rambling post)

Carl White writes:
<lots of tests on the new namespace feature>

Thanks for testing the namespace feature.
Things worked as intended in each case,
although some of the error messages could be improved.
Thanks also for the namespace and short-circuit suggestions. 
I'll consider them for the next release.

> Finally, I see no mention of 'as' as a valid keyword in 
> section 2.4.1 of the documentation. Is this an oversight, 
> or is it not considered a keyword by the interpreter?

It's not considered a keyword. You can use it as an identifier
(variable name, routine  name etc.)

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu