1. 3.0.3

If no one has any objections, in a few days I'll 
take a snapshot of the source and start preparing a 3.0.3 release.
There have been a number of small improvements and bug fixes
since 3.02 (February):

  - find_from() / match_from()  (Matt Lewis)

  - change to include path search (C.K. / Matt Lewis)

  - ex int.ex now works, for anyone who wants to easily experiment
    with changes to the front end, while executing programs at full speed
 
  - bugs reported by Deschenes and Kluss have been fixed 

  - I've added some new documentation

  - various other things by Matt Lewis and myself


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

new topic     » topic index » view message » categorize

2. Re: 3.0.3

Robert Craig wrote:
> 
> If no one has any objections, in a few days I'll 
> take a snapshot of the source and start preparing a 3.0.3 release.
> There have been a number of small improvements and bug fixes
> since 3.02 (February):
> 
>   - find_from() / match_from()  (Matt Lewis)
> 
>   - change to include path search (C.K. / Matt Lewis)
> 
>   - ex int.ex now works, for anyone who wants to easily experiment
>     with changes to the front end, while executing programs at full speed
>  
>   - bugs reported by Deschenes and Kluss have been fixed 
> 
>   - I've added some new documentation
> 
>   - various other things by Matt Lewis and myself
> 
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

Are you going to fix the bug where environment variables (like EUDIR) that have
accented characters inside their value are improperly reported by getenv()
under Windows (at least XP)?

For instance, if a path was entered with a e acute,, getenv() returns it
with a U acute, and include files are not found if the variable happened to
be EUINC.

Suggested fix: under Windows, if a path gives a file open failure in 
path_open(), and has chars in the 128-255 range, then convert it using 
CharToOEM() API and try again.

CChris

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

3. Re: 3.0.3

CChris wrote:
> Are you going to fix the bug where environment variables (like EUDIR) that
> have
> accented characters inside their value are improperly reported by getenv()
> under Windows (at least XP)?
> 
> For instance, if a path was entered with a e acute,, getenv() returns it
> with a U acute, and include files are not found if the variable happened to
> be EUINC.
> 
> Suggested fix: under Windows, if a path gives a file open failure in 
> path_open(), and has chars in the 128-255 range, then convert it using 
> CharToOEM() API and try again.

I don't plan to do anything about this in 3.0.3.
Maybe you or someone else can deal with it in 3.0.4 
or later if no one objects.

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

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

4. Re: 3.0.3

Please include the file bit.e. I use this and it is a logical extension of the
Euphoria language.

B.S. Computer Science, 1978
Rensselaer Polytechnic Institute (RPI)

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

5. Re: 3.0.3

Andrew Katz wrote:
> Please include the file bit.e. I use this and it is a logical extension of the
> Euphoria language.

I won't do it now, but maybe in 3.0.4 or later we need to 
decide on whether we want to start pulling in more 
include files into euphoria\include or some standard place. 
Maybe ones where:
  1. The author says it's ok (In this case that is true)

  2. The file has been used and recommended by multiple people
     (besides the author)

  3. Someone is willing to clearly document the file.
     (in this case things are documented in an informal way)
     I don't know if we need to have docs in some
     official library format, but things should be 
     documented in some clear and maybe semi-formal way.

People have put forth grand plans for creating carefully 
thought out standard libraries. Maybe we just need to pull in
some of the most useful include files that we already have.
Trying to do things perfectly can lead to rigor mortis.
Maybe we can have a subdirectory containing a bunch of useful
files that are somewhat informally thrown together, and not
forced to follow any rigid standards. An overview document
could summarize what they all are.

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

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

6. Re: 3.0.3

Helo Rob,

maybe you can add something like the following to 'misc.e':
global constant
   FALSE = 0,
   TRUE  = not FALSE

global type boolean (object x)
   if integer(x) then
      return x = FALSE or x = TRUE
   else
      return FALSE
   end if
end type


I think it would be pretty useful.

Regards,
   Juergen

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

7. Re: 3.0.3

Another very easy and useful thing to do would be the following:
In get.e, make value() return a three-elkement sequence and not just a 
pair. The third element would be the number of characters converted to 
the returned value, when the function succeeds, and the position at
which it failed otherwise. Trailing whitespace should not count in case of 
success.
The variable containing the requested information does exist, but it is not
global. Having to distribute a nonstandard get.e because of this feature 
is an annoyance, and there is hardly any code the addition would break,
I think. Just append the variable to the currently returned value.

Can you make the change in the 3.0.3 release, Rob?

CChris

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

8. Re: 3.0.3

Juergen Luethje wrote:
> maybe you can add something like the following to 'misc.e':
> }}}
<eucode>
> global constant
>    FALSE = 0,
>    TRUE  = not FALSE
> 
> global type boolean (object x)
>    if integer(x) then
>       return x = FALSE or x = TRUE
>    else
>       return FALSE
>    end if
> end type
> </eucode>
{{{

> 
> I think it would be pretty useful.

It would be useful, but if we add it now,
it will trigger error messages in a lot of existing code,
since boolean, TRUE and FALSE are already declared
as globals, and used, by many programs that currently include misc.e.
Maybe we should instead create a new "standard types" include file.

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

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

9. Re: 3.0.3

CChris wrote:
> Another very easy and useful thing to do would be the following:
> In get.e, make value() return a three-elkement sequence and not just a 
> pair. The third element would be the number of characters converted to 
> the returned value, when the function succeeds, and the position at
> which it failed otherwise. Trailing whitespace should not count in case of 
> success.
> The variable containing the requested information does exist, but it is not
> global. Having to distribute a nonstandard get.e because of this feature 
> is an annoyance, and there is hardly any code the addition would break,
> I think. Just append the variable to the currently returned value.
> 
> Can you make the change in the 3.0.3 release, Rob?

That might be useful, and probably wouldn't break much, if any, code,
but I don't want to get into it for 3.0.3.

I haven't started working on 3.0.3 yet, but I plan to very soon.

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

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

10. Re: 3.0.3

Robert Craig wrote:

> Juergen Luethje wrote:
> > maybe you can add something like the following to 'misc.e':
> > }}}
<eucode>
> > global constant
> >    FALSE = 0,
> >    TRUE  = not FALSE
> > 
> > global type boolean (object x)
> >    if integer(x) then
> >       return x = FALSE or x = TRUE
> >    else
> >       return FALSE
> >    end if
> > end type
> > </eucode>
{{{

> > 
> > I think it would be pretty useful.
> 
> It would be useful, but if we add it now,
> it will trigger error messages in a lot of existing code,
> since boolean, TRUE and FALSE are already declared
> as globals, and used, by many programs that currently include misc.e.

I see.

> Maybe we should instead create a new "standard types" include file.

Oh yes, I think that is a good idea.

Regards,
   Juergen

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

11. Re: 3.0.3

Juergen Luethje wrote:
> 
> Helo Rob,
> 
> maybe you can add something like the following to 'misc.e':
> }}}
<eucode>
> global constant
>    FALSE = 0,
>    TRUE  = not FALSE
> 
> global type boolean (object x)
>    if integer(x) then
>       return x = FALSE or x = TRUE
>    else
>       return FALSE
>    end if
> end type
> </eucode>
{{{

> 
> I think it would be pretty useful.
> 
> Regards,
>    Juergen

Why not just

TRUE = 1 

???

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

12. Re: 3.0.3

Jeremy Peterson wrote:
> 
> Juergen Luethje wrote:
> > 
> > Helo Rob,
> > 
> > maybe you can add something like the following to 'misc.e':
> > }}}
<eucode>
> > global constant
> >    FALSE = 0,
> >    TRUE  = not FALSE
> > 
> > global type boolean (object x)
> >    if integer(x) then
> >       return x = FALSE or x = TRUE
> >    else
> >       return FALSE
> >    end if
> > end type
> > </eucode>
{{{

> > 
> > I think it would be pretty useful.
> > 
> > Regards,
> >    Juergen
> 
> Why not just
> 
> TRUE = 1 

Because it removes implementation dependancies.

It is generally accepted that when the concept 'FALSE' is implemented as an
integer, the value zero is used. However, there are quite a few different
implementations of 'TRUE', some use 1, some -1, and some use every non-zero
value. By defining 'TRUE' as 'not FALSE' it will work with any implementation.


Alsoh due to a quirk in the way that short-circuit IF evaluations work, it can
be made to execute faster when the conditions are separated out ...

global constant
   FALSE = 0,
   TRUE  = not FALSE

global type boolean (object x)
   if not integer(x) then return FALSE end if
   if x = FALSE return TRUE end if
   if x = TRUE  return TRUE end if
   return FALSE
end type


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

13. Re: 3.0.3

Derek Parnell wrote:
> 
> Jeremy Peterson wrote:
> > 
> > Juergen Luethje wrote:
> > > 
> > > global constant
> > >    FALSE = 0,
> > >    TRUE  = not FALSE
> > Why not just
> > 
> > TRUE = 1 
> 
> Because it removes implementation dependancies.
> It is generally accepted <snip> 'FALSE' is implemented as zero; some
> implementations of 'TRUE', use 1, some -1, and some every non-zero value. 
> By defining 'TRUE' as 'not FALSE' it will work with any implementation.

FWIW I prefer this, which I got from someone on this forum:
constant TRUE=(1=1),  -- for Eu, 1 (aka <>0)
         FALSE=(1=0)  -- for Eu, 0

It is succinct and programming-language-independent.

> Also due to a quirk in the way that short-circuit IF evaluations work, it 
> can be made to execute faster when the conditions are separated out ...
> 
> }}}
<eucode>
> global constant
>    FALSE = 0,
>    TRUE  = not FALSE
> 
> global type boolean (object x)
>    if not integer(x) then return FALSE end if
>    if x = FALSE return TRUE end if
>    if x = TRUE  return TRUE end if
>    return FALSE
> end type
> </eucode>
{{{

Crikey! I really (really!) thought that
if integer(x) and (x=FALSE or x=TRUE) then return TRUE end if
    return FALSE

would be faster, but you are right and in my first test some 35% faster.
I thought I understood this, what is this "quirk" am I missing?

Regards,
Pete

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

14. Re: 3.0.3

Pete Lomax wrote:
 
> FWIW I prefer this, which I got from someone on this forum:
> }}}
<eucode>
> constant TRUE=(1=1),  -- for Eu, 1 (aka <>0)
>          FALSE=(1=0)  -- for Eu, 0
> </eucode>
{{{

> It is succinct and programming-language-independent.

LOL ...  thank you. Yes, this is the way I code in win32lib.
 
> > Also due to a quirk in the way that short-circuit IF evaluations work

> Crikey! I really (really!) thought that
if integer(x) and (x=FALSE or x=TRUE) then return TRUE end if
     return FALSE

> would be faster, but you are right and in my first test some 35% faster.
> I thought I understood this, what is this "quirk" am I missing?

It was brought to my attention some time ago during that programming contest I
ran for you guys. I haven't looked into the generated code for it but I guess
that it's not as efficient as it could be. In fact, I'm not sure that there are
any optmizations done to the code after it has been generated. Maybe this is an
openning for a future enhancement?

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

15. Re: 3.0.3

Pete Lomax wrote:

> Derek Parnell wrote:
> > 
> > Jeremy Peterson wrote:
> > > 
> > > Juergen Luethje wrote:
> > > > 
> > > > global constant
> > > >    FALSE = 0,
> > > >    TRUE  = not FALSE
> > > Why not just
> > > 
> > > TRUE = 1 
> > 
> > Because it removes implementation dependancies.
> > It is generally accepted <snip> 'FALSE' is implemented as zero; some
> > implementations of 'TRUE', use 1, some -1, and some every non-zero value. 
> > By defining 'TRUE' as 'not FALSE' it will work with any implementation.
> 
> FWIW I prefer this, which I got from someone on this forum:
> }}}
<eucode>
> constant TRUE=(1=1),  -- for Eu, 1 (aka <>0)
>          FALSE=(1=0)  -- for Eu, 0
> </eucode>
{{{

> It is succinct and programming-language-independent.

<snip>

Cool. smile
In my code, TRUE also was language-independent, but FALSE wasn't.
The following combination of both ideas also is language-independent:
constant
   FALSE = (1=0),
   TRUE  = not FALSE


Regards,
   Juergen

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

16. Re: 3.0.3

Derek Parnell wrote:
> 
> Jeremy Peterson wrote:
> > 
> > Juergen Luethje wrote:
> > > 
> > > Helo Rob,
> > > 
> > > maybe you can add something like the following to 'misc.e':
> > > }}}
<eucode>
> > > global constant
> > >    FALSE = 0,
> > >    TRUE  = not FALSE
> > > 
> > > global type boolean (object x)
> > >    if integer(x) then
> > >       return x = FALSE or x = TRUE
> > >    else
> > >       return FALSE
> > >    end if
> > > end type
> > > </eucode>
{{{

> > > 
> > > I think it would be pretty useful.
> > > 
> > > Regards,
> > >    Juergen
> > 
> > Why not just
> > 
> > TRUE = 1 
> 
> Because it removes implementation dependancies.
> 
> It is generally accepted that when the concept 'FALSE' is implemented as an
> integer, the value zero is used. However, there are quite a few different
> implementations
> of 'TRUE', some use 1, some -1, and some use every non-zero value. By defining
> 'TRUE' as 'not FALSE' it will work with any implementation.
> 
> 
> Alsoh due to a quirk in the way that short-circuit IF evaluations work, it can
> be made to execute faster when the conditions are separated out ...
> 
> }}}
<eucode>
> global constant
>    FALSE = 0,
>    TRUE  = not FALSE
> 
> global type boolean (object x)
>    if not integer(x) then return FALSE end if
>    if x = FALSE return TRUE end if
>    if x = TRUE  return TRUE end if
>    return FALSE
> end type
> </eucode>
{{{

> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

Isn't
global constant
FALSE = 0,
TRUE = not FALSE

global type boolean(integer x)
return x = x = TRUE
end type

even faster?

CChris

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

17. Re: 3.0.3

CChris wrote:
 
> Isn't
global constant
 FALSE = 0,
 TRUE = not FALSE
 
 global type boolean(integer x)
 return x = x = TRUE
 end type
 

> even faster?
> 

Probably, but is not exactly clear at first reading. You have to think it
through to see that it works. The primary purpose of any programming language
ought to be to help communicate your intentions to humans who read the code, so I
recommend that coders, as a first priority, try to make code clear before trying
to make it as fast as possible.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

18. Re: 3.0.3

Derek Parnell wrote:
> I haven't looked into the generated code for it but I guess
> that it's not as efficient as it could be. In fact, I'm not sure that there
> are any optmizations done to the code after it has been generated. Maybe 
> this is an openning for a future enhancement?
I see, I dumped the il to have a look see. These listings are based on 
my hacked 2.5 frontend, but I've checked 3.0.0 and the results seem to
be the same. Derek's routine:
global type boolean (object x)
     if not integer(x) then return FALSE end if
     if x = FALSE then return TRUE end if
     if x = TRUE  then return TRUE end if
     return FALSE
 end type
--il code:
{NOVALUE,99,M_NORMAL,SC_GLOBAL,U_UNUSED,1,"boolean",0,TYPE,52,0,0,-1,0, -- rtn
98
    {IS_AN_INTEGER,99,100 --1: tmp 100 := IS_AN_INTEGER(x)
    ,NOT_IFW,100,10 --4: NOT_IFW tmp 100 (10)
    ,RETURNF,98,94 --7: RETURNF boolean, FALSE
    ,EQUALS_IFW,99,94,17 --10: x EQUALS_IFW FALSE (17)
    ,RETURNF,98,96 --14: RETURNF boolean, TRUE
    ,EQUALS_IFW,99,96,24 --17: x EQUALS_IFW TRUE (24)
    ,RETURNF,98,96 --21: RETURNF boolean, TRUE
    ,RETURNF,98,94 --24: RETURNF boolean, FALSE
    ,BADRETURNF --27: BADRETURNF
    }}

--My routine:
type boo2(object x)
    if integer(x) and (x=FALSE or x=TRUE) then return TRUE end if
    return FALSE
end type
--ilcode:
{NOVALUE,107,M_NORMAL,SC_LOCAL,U_UNUSED,1,"boo2",0,TYPE,1455,0,0,-1,0, -- rtn
106
    {IS_AN_INTEGER,107,108 --1: tmp 108 := IS_AN_INTEGER(x)
    ,SC1_AND_IF,108,108,29 --4: SC1_AND_IF(tmp 108,tmp 108) --> 29
    ,EQUALS,107,94,109 --8: tmp 109 := EQUALS(x,FALSE)
    ,SC1_OR,109,109,23 --12: SC1_OR(tmp 109,tmp 109) --> 23
    ,EQUALS,107,96,110 --16: tmp 110 := EQUALS(x,TRUE)
    ,SC2_OR,110,109 --20: SC2_OR tmp 110,tmp 109
    ,IF,109,29 --23: IF tmp 109 (29)
    ,RETURNF,106,96 --26: RETURNF boo2, TRUE
    ,RETURNF,106,94 --29: RETURNF boo2, FALSE
    ,BADRETURNF --32: BADRETURNF
    }}

Theoretically, the SC1_AND_IF could (in this case) be a plain IF, the 
EQUALS/SC1_OR pair a NOTEQ_IFW to the return TRUE statement, and the 
EQUALS/SC2_OR/IF triple an EQUALS_IFW to the return FALSE statement, 
I think:
{IS_AN_INTEGER,107,108 --1: tmp 108 := IS_AN_INTEGER(x)
    ,IF,108,18 --4: IF tmp 108 (18)
    ,NOTEQ_IFW,107,94,15 --7: x NOTEQ_IFW FALSE (15)
    ,EQUALS_IFW,107,96,18 --11: x EQUALS_IFW TRUE (18)
    ,RETURNF,106,96 --15: RETURNF boo2, TRUE
    ,RETURNF,106,94 --18: RETURNF boo2, FALSE
    ,BADRETURNF --21: BADRETURNF
    }

Easier said than done, no doubt.

Regards,
Pete
PS I should perhaps point out that the latter il obviously ought to beat the
current il for the same source, though I doubt it will improve any on the il
emitted for Derek's code, which looks spot on to me. Both first and last ils
execute the same number of il instructions in all cases. The only reason the
latter is smaller is it encodes only two return statements instead of four.

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

19. Re: 3.0.3

CChris wrote:
> Isn't
> }}}
<eucode>
> global constant
> FALSE = 0,
> TRUE = not FALSE
> 
> global type boolean(integer x)
> return x = x = TRUE
> end type
> </eucode>
{{{

> even faster?

However, you cannot use it as a function:
if boolean("fred") then

fails with a type check error on x

Pete

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

20. Re: 3.0.3

Derek Parnell wrote:
> 
> CChris wrote:
>  
> > Isn't
> }}}
<eucode>
>  global constant
>  FALSE = 0,
>  TRUE = not FALSE
>  
>  global type boolean(integer x)
>  return x = x = TRUE
>  end type
>  </eucode>
{{{

> > even faster?
> > 
> 
> Probably, but is not exactly clear at first reading. You have to think it
> through
> to see that it works. The primary purpose of any programming language ought
> to be to help communicate your intentions to humans who read the code, so I
> recommend that coders, as a first priority, try to make code clear before
> trying
> to make it as fast as possible.
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

I agree with this statement in 90% of cases. The main exception, which covers
the case at hand, is for low level stuff which is executed implicitly tens or
hundreds of times in about any reasonably complex programs - put
"Hello, world!" aside.

Why? Because these things are usually invisible, and hardly anyone bothers
to read them. Hence the readibility issue, for this class of utility code,
is probably less important han reliability and speed.

Nothing prevents anyone to code the human friendly way in a block comment,
and then put in actual code which works, but is a little less clear.

CChris
PS for Pete: anyway, I'd expect boolean() to crash if fed a sequence, so my
routine can indeed be used as a function. If you want a return of 0 for
sequences, then indeed it is not suitable.

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

21. Re: 3.0.3

CChris wrote:

<snip>

> PS for Pete: anyway, I'd expect boolean() to crash if fed a sequence, so my
> routine can indeed be used as a function. If you want a return of 0 for
> sequences, then indeed it is not suitable.

So you can use it yourself as a function, because it works like you expect.
However, I think about 99% of the Euphoria programmers expect a type when
used as function _not_ to crash, but to return either TRUE or FALSE.

Regards,
   Juergen

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

22. Re: 3.0.3

Juergen Luethje wrote:
> 
> CChris wrote:
> 
> <snip>
> 
> > PS for Pete: anyway, I'd expect boolean() to crash if fed a sequence, so my
> > routine can indeed be used as a function. If you want a return of 0 for
> > sequences, then indeed it is not suitable.
> 
> So you can use it yourself as a function, because it works like you expect.
> However, I think about 99% of the Euphoria programmers expect a type when
> used as function _not_ to crash, but to return either TRUE or FALSE.
> 
> Regards,
>    Juergen

Are you sure? It depends on the context, in my view, as an atom may be a
boolean and a sequence never can. This is why the argument type for a type
is not "object" by default, which your comment would imply.

At any rate it is easy to conform to that no crash policy:
global constant FALSE = 1=0
               ,TRUE = not FALSE

global type boolean(object x)
integer y
y=not compare(x, TRUE) -- y is TRUE iff x is, otherwise it is FALSE
return not compare(x, y)
end type

I'm afraid it would slow things down a little. Any benchmarks?

CChris

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

23. Re: 3.0.3

CChris wrote:

> Juergen Luethje wrote:
> > 
> > CChris wrote:
> > 
> > <snip>
> > 
> > > PS for Pete: anyway, I'd expect boolean() to crash if fed a sequence, so
> > > my
> > > routine can indeed be used as a function. If you want a return of 0 for
> > > sequences, then indeed it is not suitable.
> > 
> > So you can use it yourself as a function, because it works like you expect.
> > However, I think about 99% of the Euphoria programmers expect a type when
> > used as function _not_ to crash, but to return either TRUE or FALSE.
> > 
> > Regards,
> >    Juergen
> 
> Are you sure?

Yes, I am.

> It depends on the context, in my view, as an atom may be a
> boolean and a sequence never can.

Sure. And therefore the following code
[Definition of a type 'boolean']

sequence s
s = {}           -- or whatever else
? boolean(s)

should print 0 (FALSE) -- but it should not crash.
It should never crash, regardless of the context.
Only the result of the type function depends on the
context, i.e. on its argument.
I never would expect a tool for checking something
to crash deliberately -- it should work properly and
tell me the result of the check.

The following code snippet is copied from the
documentation of gets():
sequence buffer
object line
integer fn

-- read a text file into a sequence
fn = open("myfile.txt", "r")
if fn = -1 then
   puts(1, "Couldn't open myfile.txt\n")
   abort(1)
end if

buffer = {}
while 1 do
   line = gets(fn)
   if atom(line) then
      exit    -- -1 is returned at end of file
   end if
   buffer = append(buffer, line)
end while

I believe code like this is well known and often used
by many Eu programmers. The built-in type-check function
atom() does not crash when 'line' isn't an atom, it just
returns 0, as probably everyone would expect. And I think
most Eu coders would expect user-defined types to work
according to the same principle.

> This is why the argument type for a type
> is not "object" by default,

This is correct. It is not "object" by default, because
there is no default for it at all.
In all my type functions, I use "object" as argument type.
And I recommend everyone to do so, who wants to write code
which should follow the "principle of least surprise".

> which your comment would imply.
> 
> At any rate it is easy to conform to that no crash policy:
> }}}
<eucode>
> global constant FALSE = 1=0
>                ,TRUE = not FALSE
> 
> global type boolean(object x)
> integer y
> y=not compare(x, TRUE) -- y is TRUE iff x is, otherwise it is FALSE
> return not compare(x, y)
> end type
> </eucode>
{{{

> I'm afraid it would slow things down a little. Any benchmarks?

After having tested my code, I write at the beginning
without type_check

and only then I do benchmarking. So I don't know why it is so
important to save some microseconds in the user-defined type
boolean(). Am I missing something here?

Regards,
   Juergen

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

24. Re: 3.0.3

i don't know it this has been mentioned but maybee you could improve 'incude'
statements.

if i have a main directory, say .\main and a subdirectory, say .\bin and then
some executable located in .\main\bin that uses some includes located in .\main,
euphoria cant properly handle theese includes. take for example;

.\main
  |
  +-------.\bin
  |          +--------> myprog.exw
  |          
  +--------> include1.ew
  +--------> include2.ew
  +--------> include3.ew

include1.ew has the following topline statements;
include include2.ew
include include3.ew

myprog.exw has the following topline statements;
include ..\include1.ew


euphoria crashes 'cause it cant find include2.ew or include3.ew in the current
directory. So I think that it would be nice if include statements check the
relative path of the file that they appear in rather than the current directory.

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

25. Re: 3.0.3

Hayden McKay wrote:

> So I think that it would be nice if include statements check the
> relative path of the file that they appear in rather than the current
> directory.

This change has been made and should be part of the next version. :)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu