Re: Reverse() was: Win32Lib Update
>This raises a couple of issues:
> 1. I should probably not make it an error (just a warning) to override
> a global symbol with a local symbol. The local should
> take precedence within the file it is declared in.
> I'm not sure if I'll do it for this release. It involves changes
> to compile-time symbol lookup, run-time symbol lookup
> (trace and routine_id) as well as the bind.ex program.
> It would alleviate some of the namespace conflicts.
Ive mentioned this before, a warning might be in place, but you should
always be able to overwrite a global identifer with a local identifer. I
only think you should see a warning when you overwrite a global identifer.
> 2. Which reverse() is the fastest? I was planning to add a
> Euphoria-coded reverse() to misc.e. A few weeks ago
> I coded reverse5() below, but it looks like reverse2() (Hawke)
> is the fastest, so I'll use his unless someone comes up
> with something even faster.
Good, it sounds like we're going to see some general purpose routines, and
maybe containing a boolean type. Ive had many conflicts with them that I
decided to add them to the beginning of every file *locally* .. if they
would in an standard Euphoria file, one could trust the convention.
Its just:
global constant
TRUE = 1,
FALSE = 0,
NONE = -1
global type boolean (object x)
if integer (x) then
return x > -2 and x < 2
else
return FALSE
end if
end type
The none is just a flag value. And could be used with result of find () or
any of the input routines.
Ralf
|
Not Categorized, Please Help
|
|