1. ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1648 views
keyword: ' tan ' is a built-in math function
tan is also a color name used by xpm files, and other programs
How come tan is built-in and not isolated to the Math library ?
2. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1665 views
keyword: ' tan ' is a built-in math function
tan is also a color name used by xpm files, and other programs
How come tan is built-in and not isolated to the Math library ?
tan has always been built in.
Matt
3. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1656 views
tan has always been built in.
Matt
Putting it another way
The 4.0 scanner is looking for a '( ' after ' tan ' and can not
tell the difference of the constant ' tan ' from the function ' tan '
4. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1631 views
tan has always been built in.
Matt
Putting it another way
The 4.0 scanner is looking for a '( ' after ' tan ' and can not
tell the difference of the constant ' tan ' from the function ' tan '
This works for me:
? tan( 0.5 ) constant tan = "some color?" ? tan
If you're accessing the constant from another file, you'd need to use a namespace, otherwise it would resolve to the built-in. Overriding built-ins has changed a little for 4.0. In previous versions, user-defined symbols would override built-ins with no way to get at the built-in wherever the overriding symbol is in scope.
We added the override scope to operate in a similar way. Also, built-in symbols can be accessed using the eu namespace.
Matt
5. Re: ver4 keyword Conflict
- Posted by jeremy (admin) Oct 03, 2011
- 1631 views
For example:
include abc.e as abc override function tan(atom a) return a * 100.0 end function ? abc:tan -- tan constant found in abc.e ? tan(10) -- your tan function ? eu:tan(20) -- euphoria's built in tan function
6. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1618 views
Thanks Jeremy and Matt:
I understand about name space, but I still think that if you have standard libraries then
all Math functions should be located in a standard Math library.
This was one of the initial goals for having standard libraries.
I tried the code I was using in win98 and it work ok
Oh well I guess I'll just have to edit my files
If I used namespace then I would have to do more editing,
then if I edit some xpm files and change tan to some other name.
7. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1614 views
I understand about name space, but I still think that if you have standard libraries then
all Math functions should be located in a standard Math library.
This was one of the initial goals for having standard libraries.
Anything implemented in euphoria or via machine_func or machine_proc goes into the standard library. tan has always been a built-in. Likewise, puts is still built-in, and not located in std/io.e. I don't foresee tan (or, e.g., sin, sqrt) going anywhere.
Matt
8. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 03, 2011
- 1597 views
I understand about name space, but I still think that if you have standard libraries then
all Math functions should be located in a standard Math library.
This was one of the initial goals for having standard libraries.
Anything implemented in euphoria or via machine_func or machine_proc goes into the standard library. tan has always been a built-in. Likewise, puts is still built-in, and not located in std/io.e. I don't foresee tan (or, e.g., sin, sqrt) going anywhere.
Matt
While my preference would be to turn tan() into a machine_func() and expose it via std/math.e - for the same reasons that BRyan does, this would be breaking backwards compatibility with Euphoria 1.x, 2.x, 3.0, 3.1.1, 4.0, 4.0.1, 4.0.2, and 4.0.3.
9. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1610 views
While my preference would be to turn tan() into a machine_func() and expose it via std/math.e - for the same reasons that BRyan does, this would be breaking backwards compatibility with Euphoria 1.x, 2.x, 3.0, 3.1.1, 4.0, 4.0.1, 4.0.2, and 4.0.3.
Jim:
Most code written for 3.11 or earlier is not compatible with ver 4 because of
DOS code,DOS interrupts, conflicts of keywords, etc.
Also compatible problems with Linux code
10. Re: ver4 keyword Conflict
- Posted by jeremy (admin) Oct 03, 2011
- 1628 views
...snip... but I still think that if you have standard libraries then all Math functions should be located in a standard Math library.
This was one of the initial goals for having standard libraries.
One of the things we are stuck with is core functions and additional functions. Core functions are what you get built right into Euphoria. No additional libraries/includes are needed to use these functions, they are embedded into eui.exe. The standard library are those functions that are in addition to the core, built-in functions.
I, however, see what you are speaking of and it would be nice to have these methods under a namespace but as Jim pointed out it would break every existing Euphoria application back to 1.0. Python has the same concept of libraries vs. built-ins, http://docs.python.org/library/functions.html ... For example, abs, len, cmp are all built-ins.
11. Re: ver4 keyword Conflict
- Posted by jeremy (admin) Oct 03, 2011
- 1599 views
Most code written for 3.11 or earlier is not compatible with ver 4 because of DOS code,DOS interrupts, conflicts of keywords, etc. Also compatible problems with Linux code
I disagree. Almost all of my programs from 3.x ran just fine under 4.x w/no change. I did use a keyword in one of my libraries and had to make a change there.
Jeremy
12. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1600 views
Most code written for 3.11 or earlier is not compatible with ver 4 because of DOS code,DOS interrupts, conflicts of keywords, etc. Also compatible problems with Linux code
I disagree. Almost all of my programs from 3.x ran just fine under 4.x w/no change. I did use a keyword in one of my libraries and had to make a change there.
Jeremy
Jeremy:
Just some of the keywords I can remember I had conflicts with in old code are :
case, label, continue, sizeof, loop
13. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 03, 2011
- 1607 views
Jim:
Most code written for 3.11 or earlier is not compatible with ver 4
4.0 was going to break code from earlier versions because of the scope of the changes. Agreement was reached that this would be the very last time that breaking changes should be required though. (At issue was the way namespaces were done.)
(A caveat - some changes planned for 5.0, like object oriented support, might eventually require breaking changes as well. Still, lets hope that lessons learned in the move from 3.11 to 4.0 will be remembered and applied when the time comes.)
because of
DOS code,DOS interrupts,
Can't argue with that.
conflicts of keywords, etc.
This is inevitable. A preprocessor is included with 4.0 to rewrite code to fix the conflicts, so this should only be a minor nuisance, not a major roadblock.
Also compatible problems with Linux code
I was not aware of this. Examples?
14. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1591 views
Jim:
Most code written for 3.11 or earlier is not compatible with ver 4
4.0 was going to break code from earlier versions because of the scope of the changes. Agreement was reached that this would be the very last time that breaking changes should be required though. (At issue was the way namespaces were done.)
(A caveat - some changes planned for 5.0, like object oriented support, might eventually require breaking changes as well. Still, lets hope that lessons learned in the move from 3.11 to 4.0 will be remembered and applied when the time comes.)
Well, I don't think it was quite as absolute as you seem to imply here. I mean, this would preclude just about anything ever being added or changed, language-wise. We do want to minimize breaking changes in minor releases. There will be some new keywords and built-ins, though probably less than what we got with 4.0.
Matt
15. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1584 views
[ problems with Linux code ]
I was not aware of this. Examples?
Jim:
What about curses ?
16. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1625 views
[ problems with Linux code ]
I was not aware of this. Examples?
Jim:
What about curses ?
I believe that went away with either 3.0 or 3.1, or maybe even before that. Definitely before 4.0.
Matt
17. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 03, 2011
- 1631 views
[ problems with Linux code ]
I was not aware of this. Examples?
Jim:
What about curses ?
I believe that went away with either 3.0 or 3.1, or maybe even before that. Definitely before 4.0.
Matt
Even when we had it, I wasn't happy with the way it was implemented. It was basically linked in to make it easier to implement position() and get_mouse() et al. and nothing more. None of the underlying ncurses stuff was exposed throught he langauge, you couldn't use it at all. (Well, you could do it via open_dll("") on Linux/GNU but imvho this isn't different at all from just open_dll("libncurses.so.5") - which should still work with 4.0.)
ncurses has a separate set of functions for wide character (e.g. unicode) support that weren't compatible with the older set of functions (that is, you weren't allowed to mix and match calls from the two sets, you had to pick one or the other) and since Euphoria only used the non unicode set, it wasn't possible to do unicode/UTF-8 with Euphoria and urxvt.
This works very nicely with 4.0, however. (It should work fine with 3.0 as well, since that's when ncurses was removed.)
Is there anything else besides ncurses and get_mouse()/gpm ?
18. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 03, 2011
- 1639 views
Jim:
Most code written for 3.11 or earlier is not compatible with ver 4
4.0 was going to break code from earlier versions because of the scope of the changes. Agreement was reached that this would be the very last time that breaking changes should be required though. (At issue was the way namespaces were done.)
(A caveat - some changes planned for 5.0, like object oriented support, might eventually require breaking changes as well. Still, lets hope that lessons learned in the move from 3.11 to 4.0 will be remembered and applied when the time comes.)
Well, I don't think it was quite as absolute as you seem to imply here. I mean, this would preclude just about anything ever being added or changed, language-wise. We do want to minimize breaking changes in minor releases. There will be some new keywords and built-ins, though probably less than what we got with 4.0.
Matt
Well, breaking changes caused by new keywords and such exempted. Those are trivial and can be dealt with in an automated fashion, so having those in minor releases is not a big deal.
19. Re: ver4 keyword Conflict
- Posted by petelomax Oct 03, 2011
- 1599 views
I understand about name space, but I still think that if you have standard libraries then
all Math functions should be located in a standard Math library.
This was one of the initial goals for having standard libraries.
Anything implemented in euphoria or via machine_func or machine_proc goes into the standard library. tan has always been a built-in. Likewise, puts is still built-in, and not located in std/io.e. I don't foresee tan (or, e.g., sin, sqrt) going anywhere.
Matt
While my preference would be to turn tan() into a machine_func() and expose it via std/math.e - for the same reasons that BRyan does, this would be breaking backwards compatibility with Euphoria 1.x, 2.x, 3.0, 3.1.1, 4.0, 4.0.1, 4.0.2, and 4.0.3.
I'm not sure what the fuss is about. It just means
?tan(0.5)
would have to become
include std/maths.e ?tan(0.5)
Is that really such a deal breaker?
Pete
20. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1549 views
I'm not sure what the fuss is about. It just means
?tan(0.5)
would have to become
include std/maths.e ?tan(0.5)
Is that really such a deal breaker?
From the user's perspective, that's all it would be. There's quite a bit more involved in making tan something other than a built-in. Note that tan has its own OPCODE in euphoria IL code.
Jim mentioned making tan a machine_func. This would definitely be slower than what it is now. I'm not sure what you really gain by doing so, other than a sense of purity. Again, I haven't heard anyone ask why #puts# or #printf# or #?# aren't in std/io.e.
Matt
21. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 03, 2011
- 1569 views
I'm not sure what the fuss is about. It just means
?tan(0.5)
would have to become
include std/maths.e ?tan(0.5)
Is that really such a deal breaker?
Pete
Less so for 4.0
In the past, you might have had issues if you wanted to use the name tan for something else. I think 4.0's namespacing handles this quite nicely though, and as Matt points out you can declare a constant with the name tan and use it as a color too - at least in 4.0.
22. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 03, 2011
- 1596 views
Jim mentioned making tan a machine_func. This would definitely be slower than what it is now. I'm not sure what you really gain by doing so, other than a sense of purity.
I agree with that statement.
Again, I haven't heard anyone ask why #puts# or #printf# or #?# aren't in std/io.e.
Matt
I don't like #?#
Anyways, the reason is - speed. IO is pretty basic and it's something we have to do a lot. Better make it as fast as possible.
The same applies to tan(). But I've never used it, so I don't care how slow it is.
23. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1573 views
Anyways, the reason is - speed. IO is pretty basic and it's something we have to do a lot. Better make it as fast as possible.
The same applies to tan(). But I've never used it, so I don't care how slow it is.
Well, simply with respect to speed, I wouldn't worry about the I/O performance, since the actual I or O is typically going to dwarf just about anything we do. Stuff like tan, however, is quite likely to be speed critical for someone doing lots of number crunching.
This would be especially important to someone working on, say, a physics library.
Matt
24. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 03, 2011
- 1552 views
Anyways, the reason is - speed. IO is pretty basic and it's something we have to do a lot. Better make it as fast as possible.
The same applies to tan(). But I've never used it, so I don't care how slow it is.
Well, simply with respect to speed, I wouldn't worry about the I/O performance, since the actual I or O is typically going to dwarf just about anything we do. Stuff like tan, however, is quite likely to be speed critical for someone doing lots of number crunching.
This would be especially important to someone working on, say, a physics library.
Matt
I've changed my mind. tan() is probably important enough to keep a builtin for this reason. (In addition to that other reason, backwards compatibility.)
25. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1534 views
Anyways, the reason is - speed. IO is pretty basic and it's something we have to do a lot. Better make it as fast as possible.
The same applies to tan(). But I've never used it, so I don't care how slow it is.
Well, simply with respect to speed, I wouldn't worry about the I/O performance, since the actual I or O is typically going to dwarf just about anything we do. Stuff like tan, however, is quite likely to be speed critical for someone doing lots of number crunching.
This would be especially important to someone working on, say, a physics library.
Matt
I've changed my mind. tan() is probably important enough to keep a builtin for this reason. (In addition to that other reason, backwards compatibility.)
Matt:
If someone is smart enough to be working on a physics library they would use another
language like FORTRAN in a DLL or SO.
They would not depend on the Euphoria to do the High speed complex calculations.
26. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1546 views
If someone is smart enough to be working on a physics library they would use another
language like FORTRAN in a DLL or SO.
They would not depend on the Euphoria to do the High speed complex calculations.
People do all sorts of stuff in euphoria, in part because it is pretty fast for an interpreted language.
If it will make you feel better, you can add this to your local std/math.e:
public function tan( object o ) return eu:tan( o ) end function
I suppose we could even add that to the library, but it seems like a waste. Either way, tan et.al. will continue to be built-ins for euphoria.
Matt
27. Re: ver4 keyword Conflict
- Posted by jeremy (admin) Oct 03, 2011
- 1526 views
If someone is smart enough to be working on a physics library they would use another
language like FORTRAN in a DLL or SO.
They would not depend on the Euphoria to do the High speed complex calculations.
Um, what? Have you seen any games written in Euphoria? What about in Fortran? Besides, it was just an example. I doubt a Euphoria programmer wants to write a physics engine in Fortran just to write his/her game in Euphoria.
For another example, I have a program that I am working on which takes a route defined in a GPX file and estimates given your performance metrix how long it will take you to traverse the route, bicycling or hiking. This is very calculation dependent. I can perform these calculations faster in Euphoria than any other language I use on a regular basis except for C, it's a bit faster. That's just another example. I'm sure there are hundreds of examples. For mine, it needs to be as fast as humanly possible because I wish it to execute in web requests and some GPX files will be 100,000 lat/lon points. I have to be able to compute the distance, bearing, elevation change, grade and then apply performance metrix from other sources and then compute new lat/lon points based off each of those metrix. Euphoria gives me that ability right now. No way I want to develop a web application in Fortran. Nor do I want to write all my formulas in Fortran, creating a DLL/SO, then wrap it in Euphoria. I use Euphoria because it's fast, at math alike.
Jeremy
28. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 03, 2011
- 1527 views
If someone is smart enough to be working on a physics library they would use another
language like FORTRAN in a DLL or SO.
They would not depend on the Euphoria to do the High speed complex calculations.
People do all sorts of stuff in euphoria, in part because it is pretty fast for an interpreted language.
If it will make you feel better, you can add this to your local std/math.e:
public function tan( object o ) return eu:tan( o ) end function
I suppose we could even add that to the library, but it seems like a waste. Either way, tan et.al. will continue to be built-ins for euphoria.
Matt
The original problem was that BRyan could not reuse tan as a constant to refer to the color blue.
Jeremy and Matt have demonstrated that this is possible. BRyan, is your original problem solved?
29. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1527 views
Jeremy:
You did understand what I said was to use math critical calculations in
another language like FORTRAN in a DLL and CALL them from Euphoria.
30. Re: ver4 keyword Conflict
- Posted by jeremy (admin) Oct 03, 2011
- 1545 views
Jeremy:
You did understand what I said was to use math critical calculations in
another language like FORTRAN in a DLL and CALL them from Euphoria.
Yes, and I was saying that no Euphoria programmer would want to do that. Euphoria is fast enough. For my stuff doing hundreds of thousands of calculations in real time, it works great, in part because the critical, time sensitive math routines are built in.
Jeremy
31. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1531 views
MATT:
Download from the archive the file "Axiom Editor" and run it on 4.x.
You also need win32lib dated Jun 17/08 from the archive
Run the editor and you will see the conflict tan constant has with tan function.
This is just an example to show you that namespace
can not solve all conflicts only editing can solve them.
If tan was in a math library then namespace would be fine.
32. Re: ver4 keyword Conflict
- Posted by BRyan Oct 03, 2011
- 1544 views
Jeremy:
You did understand what I said was to use math critical calculations in
another language like FORTRAN in a DLL and CALL them from Euphoria.
Yes, and I was saying that no Euphoria programmer would want to do that. Euphoria is fast enough. For my stuff doing hundreds of thousands of calculations in real time, it works great, in part because the critical, time sensitive math routines are built in.
Jeremy
I knew that you flew gliders but I did not know you worked on bicycles like the Wright Brothers.
33. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 03, 2011
- 1534 views
Download from the archive the file "Axiom Editor" and run it on 4.x.
You also need win32lib dated Jun 17/08 from the archive
Run the editor and you will see the conflict tan constant has with tan function.
This is just an example to show you that namespace
can not solve all conflicts only editing can solve them.
If tan was in a math library then namespace would be fine.
Yes, I understand what you're saying, and I agree that some pre-4.0 code will require some editing. You've found one example. The problem is easy to solve, and some older code will need to be updated.
Matt
34. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 04, 2011
- 1482 views
MATT:
Download from the archive the file "Axiom Editor" and run it on 4.x.
You also need win32lib dated Jun 17/08 from the archive
Run the editor and you will see the conflict tan constant has with tan function.
This is just an example to show you that namespace
can not solve all conflicts only editing can solve them.
If tan was in a math library then namespace would be fine.
Wrong.
This can be fixed using namespaces.
I was able to fix this exact error by using namespaces. See Interwiki link failed for pastey:95, pastey:95 if you can't figure out how to do this. It's so simple!
35. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 04, 2011
- 1489 views
MATT:
Download from the archive the file "Axiom Editor" and run it on 4.x.
You also need win32lib dated Jun 17/08 from the archive
Run the editor and you will see the conflict tan constant has with tan function.
This is just an example to show you that namespace
can not solve all conflicts only editing can solve them.
If tan was in a math library then namespace would be fine.
Wrong.
This can be fixed using namespaces.
I was able to fix this exact error by using namespaces. See Interwiki link failed for pastey:95, pastey:95 if you can't figure out how to do this. It's so simple!
Err, use http://openeuphoria.org/pastey/95.wc
36. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 04, 2011
- 1478 views
Yes, I understand what you're saying, and I agree that some pre-4.0 code will require some editing.
4.0? I got this error with Euphoria 2.3 alpha!
Euphoria Interpreter 2.3 alpha for Linux. Copyright (c) Rapid Deployment Software 2001 Permission is freely granted to anyone to copy and redistribute this Public Domain Edition of Euphoria. file name to execute? /dev/shm/ax/CL.E /dev/shm/ax/CL.E:42 Syntax error - expected to see possibly '(', not ',' "# c " & tan, ^ Press Enter...
37. Re: ver4 keyword Conflict
- Posted by Vinoba Oct 04, 2011
- 1526 views
Jeremy:
You did understand what I said was to use math critical calculations in
another language like FORTRAN in a DLL and CALL them from Euphoria.
Yes, and I was saying that no Euphoria programmer would want to do that. Euphoria is fast enough. For my stuff doing hundreds of thousands of calculations in real time, it works great, in part because the critical, time sensitive math routines are built in.
Jeremy
There is an extensive set of routines and libraries available in Cern library. It seems they are free to use and there are wrappers and several GUIs too. They use these routines to define how to accelerate particles so as to annihilate us all in the shortest possible time. It would be worth your while to look at these and I am sure you all (at least at the Euphoria developer level) would be able to use them in your accelerated, high speed, self-destructive physics calculations!
No offense intended.
http://cernlib.web.cern.ch/cernlib/
38. Re: ver4 keyword Conflict
- Posted by mattlewis (admin) Oct 04, 2011
- 1503 views
MATT:
Download from the archive the file "Axiom Editor" and run it on 4.x.
You also need win32lib dated Jun 17/08 from the archive
Run the editor and you will see the conflict tan constant has with tan function.
This is just an example to show you that namespace
can not solve all conflicts only editing can solve them.
If tan was in a math library then namespace would be fine.
Wrong.
This can be fixed using namespaces.
I was able to fix this exact error by using namespaces. See Interwiki link failed for pastey:95, pastey:95 if you can't figure out how to do this. It's so simple!
Err, use http://openeuphoria.org/pastey/95.wc
Yes, but you've edited the file, which was my point. Maybe that wasn't BRyan's point.
Matt
39. Re: ver4 keyword Conflict
- Posted by jimcbrown (admin) Oct 04, 2011
- 1494 views
Yes, but you've edited the file, which was my point.
No argument there. Although I'm not sure this case is the best example. The keyword conflict exists in Euphoria 2.3 (I think that's when namespaces were first introduced) so I'm assuming the issue here is that someone is trying to port pre-2.3/pre-namespace code over, in which case some editing is required. If this code had been written for 2.3 (or later), then no editing would have been required. (At least, not for this case.)
Maybe that wasn't BRyan's point.
I had assumed that the argument was that editing the file to make use of namespaces was not enough, but that it was also necessary to change the name of the constant from tan to some other name (like Tan or TAN or thecolourtan) because edits to make use of namespaces were, by themselves, not enough to resolve the problem.
Perhaps this thread should have been named "Y2K1 ver2.3 keyword Conflict"