1. Can types be global
- Posted by don cole <doncole at pacbell.net> Nov 28, 2006
- 561 views
- Last edited Nov 29, 2006
This works (in the same file). type caps(integer x) return x >= 'A' and x<= 'Z' end type This doesn't in an incude file. global type caps(integer x) return x >= 'A' and x<= 'Z' end type Why whats wrong? Don Cole
2. Re: Can types be global
- Posted by Juergen Luethje <j.lue at gmx.de> Nov 29, 2006
- 568 views
don cole wrote: > This works (in the same file). > > type caps(integer x) > return x >= 'A' and x<= 'Z' > end type > > This doesn't in an incude file. > > global type caps(integer x) > return x >= 'A' and x<= 'Z' > end type > > Why whats wrong? > > Don Cole Of course can types be global. A user-defined type is just a single-parameter function that returns TRUE or FALSE. Look e.g. here <http://www.rapideuphoria.com/type.zip> for a file that contains a collection of useful global types. Works fine. Are you really sure that you did include the right file? Regards, Juergen
3. Re: Can types be global
- Posted by Chris Bensler <bensler at nt.net> Nov 29, 2006
- 567 views
Make sure typechecking is not disabled within the include file or any files it includes. Chris Bensler ~ The difference between ordinary and extraordinary is that little extra ~ http://empire.iwireweb.com - Empire for Euphoria
4. Re: Can types be global
- Posted by don cole <doncole at pacbell.net> Nov 29, 2006
- 548 views
Chris Bensler wrote: > > Make sure typechecking is not disabled within the include file or any files > it includes. > > Chris Bensler > ~ The difference between ordinary and extraordinary is that little extra ~ > <a href="http://empire.iwireweb.com">http://empire.iwireweb.com</a> - Empire > for Euphoria Would that be without type_check? If so how can I override this. I can't find that in there but I would like to be sure with an override. Don Cole
5. Re: Can types be global
- Posted by don cole <doncole at pacbell.net> Nov 29, 2006
- 546 views
Juergen Luethje wrote: > > Of course can types be global. > A user-defined type is just a single-parameter function that returns > TRUE or FALSE. > Look e.g. here <<a > href="http://www.rapideuphoria.com/type.zip">http://www.rapideuphoria.com/type.zip</a>> > for a file that > contains a collection of useful global types. Works fine. I downloaded your type.e
global type upper_char (object x) --I was told that if statements took more ---time. if integer(x) then if x <= 'Z' then return x >= 'A' else return find(x, "ÄÖÜ") != 0 end if end if return 0 end type
Are you really sure that you did include the right file? Yes, have other procedures and functions in there that work.
Regards,
Juergen
Don Cole }}}
6. Re: Can types be global
- Posted by Juergen Luethje <j.lue at gmx.de> Nov 29, 2006
- 542 views
don cole wrote: > Chris Bensler wrote: >> >> Make sure typechecking is not disabled within the include file or any files >> it includes. > > Would that be without type_check? Yes. > If so how can I override this. > I can't find that in there but I would like to be sure with an override. with type_check see <http://rapideuphoria.com/refman_2.htm#62> Regards, Juergen
7. Re: Can types be global
- Posted by Juergen Luethje <j.lue at gmx.de> Nov 29, 2006
- 546 views
don cole wrote: > --I was told that if statements took more ---time. This is not generally true, but depends on the concrete situation. E.g. it should be considered, that in Euphoria short-circuit evaluation <http://rapideuphoria.com/refman_2.htm#shortcir> -- which can save time -- only works in a statement that uses if, elsif, or while. Regards, Juergen
8. Re: Can types be global
- Posted by Chris Bensler <bensler at nt.net> Nov 29, 2006
- 575 views
- Last edited Nov 30, 2006
Juergen Luethje wrote: > > don cole wrote: > > > Chris Bensler wrote: > >> > >> Make sure typechecking is not disabled within the include file or any files > >> it includes. > > > > Would that be without type_check? > > Yes. > > > If so how can I override this. > > I can't find that in there but I would like to be sure with an override. > > with type_check > > see <<a > href="http://rapideuphoria.com/refman_2.htm#62">http://rapideuphoria.com/refman_2.htm#62</a>> > > Regards, > Juergen You cannot override with or without type_check. You can turn typechecking on or off at different points in your program, but if a file contains a with/out type_check statement, there is no way to override that with an opposing statement. What happens is that the part of code that is marked as 'without type_check' will never get type_checked, until the 'with type_check' statement is encountered, then all code until the next 'without type_check' or the end of the file, will be type_checked. Clear as mud, right? :P Chris Bensler ~ The difference between ordinary and extraordinary is that little extra ~ http://empire.iwireweb.com - Empire for Euphoria
9. Re: Can types be global
- Posted by don cole <doncole at pacbell.net> Nov 30, 2006
- 576 views
Chris Bensler wrote: > > Juergen Luethje wrote: > > > > don cole wrote: > > > > > Chris Bensler wrote: > > >> > > >> Make sure typechecking is not disabled within the include file or any > > >> files > > >> it includes. > > > > > > Would that be without type_check? > > > > Yes. > > > > > If so how can I override this. > > > I can't find that in there but I would like to be sure with an override. > > > > with type_check > > > > see <<a > > href="http://rapideuphoria.com/refman_2.htm#62">http://rapideuphoria.com/refman_2.htm#62</a>> > > > > Regards, > > Juergen > > You cannot override with or without type_check. > You can turn typechecking on or off at different points in your program, but > if a file contains a with/out type_check statement, there is no way to > override > that with an opposing statement. > > What happens is that the part of code that is marked as 'without type_check' > will never get type_checked, until the 'with type_check' statement is > encountered, > then all code until the next 'without type_check' or the end of the file, will > be type_checked. > > Clear as mud, right? :P > > Chris Bensler > ~ The difference between ordinary and extraordinary is that little extra ~ > <a href="http://empire.iwireweb.com">http://empire.iwireweb.com</a> - Empire > for Euphoria O.K.
-----------include file (mygets.e}
global type caps(integer x) return x >= 'A' and x<= 'Z' end type
---------page1.e include myfile.e if caps(list[2][$]) then here I get error 'caps not declared' ---------main program
include mygets.e include page1.e
Would without type_check cause this error?
Thanks, Don Cole }}}
10. Re: Can types be global
- Posted by Juergen Luethje <j.lue at gmx.de> Nov 30, 2006
- 554 views
Chris Bensler wrote: > Juergen Luethje wrote: >> >> don cole wrote: >> >>> Chris Bensler wrote: >>>> >>>> Make sure typechecking is not disabled within the include file or any files >>>> it includes. >>> >>> Would that be without type_check? >> >> Yes. >> >>> If so how can I override this. >>> I can't find that in there but I would like to be sure with an override. >> >> with type_check >> >> see <<a >> href="http://rapideuphoria.com/refman_2.htm#62">http://rapideuphoria.com/refman_2.htm#62</a>> >> >> Regards, >> Juergen > > You cannot override with or without type_check. > You can turn typechecking on or off at different points in your program, but > if a file contains a with/out type_check statement, there is no way to > override > that with an opposing statement. This is absolutely right, of course. It seems that I was somehow confused yesterday. Thanks for un-confusing me. Regards, Juergen
11. Re: Can types be global
- Posted by Juergen Luethje <j.lue at gmx.de> Nov 30, 2006
- 564 views
don cole wrote: > -------------include file (mygets.e} > > > global type caps(integer x) > return x >= 'A' and x<= 'Z' > end type > > > -----------page1.e > include myfile.e > if caps(list[2][$]) then-- here I get error 'caps not declared' > -----------main program > > include mygets.e > include page1.e > --------------------------- > Would without type_check cause this error? No. Using "without type_check" just switches type checking off, it does not cause and error at all. The point here is, that you have to include "mygets.e", _before_ you use any code located in this file. So your program should look like this:
-------------include file (mygets.e} global type caps(integer x) return x >= 'A' and x<= 'Z' end type -----------page1.e include mygets.e include myfile.e if caps(list[2][$]) then-- here I get error 'caps not declared' -----------main program include page1.e ---------------------------
Regards, Juergen
12. Re: Can types be global
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Dec 01, 2006
- 535 views
- Last edited Dec 02, 2006
On Wed, 29 Nov 2006 22:22:32 -0800, don cole <guest at RapidEuphoria.com> wrote: >Would without type_check cause this error? No. Absolutely not. Have you yourself created three/four small files like the code you posted and tested it? If not, why not? Pete