1. Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1639 views
Euphoria is a very high-level programming language with several features that set it apart from the crowd:
Ha, ha, there is few that sets it "apart from the crowd", see below.
- Euphoria programs run on: o Windows o DOS o Linux o FreeBSD o Mac OS X
- Euphoria is free and open source
Most other languages do that.
- The language is flexible, powerful, and easy to learn.
Python and Lua are too. It sound like marketing fluff.
- There is no waiting for compiles and links - just edit and run.
There exist a thing called a "fast compiler" - interpretation is not needed for fast turn-around times.
- You can create and distribute royalty-free, stand-alone executable files.
So? Python and Lua can do that too.
- Dynamic storage allocation is fundamental to Euphoria. Arrays grow or shrink in size without the programmer having to worry about allocating and freeing chunks of memory. Elements of an array (Euphoria sequence) can be a dynamic mixture of different types and sizes of data.
Python has lists and Lua has tables for this. Both are more flexible.
- Euphoria provides extensive run-time error checking for: out-of-bounds subscripts, uninitialized variables, bad parameter values for library routines, illegal value assigned to a variable, and many more. If something goes wrong you'll get a full error message, with a call traceback and a listing of variable values. With other languages you'll typically get protection faults with useless dumps of machine registers and addresses.
Not with other languages, but with C and C. And for them there is Valgrind.
- The Euphoria interpreter is more than 30 times faster than either Perl or Python, and it's considerably faster than all other interpreted languages, according to the "Great Computer Language Shootout" benchmark (see demo\bench\bench.doc).
The official benchmark does not list Euphoria at all.
- If that isn't enough, there's a Euphoria To C Translator that can translate any Euphoria program to C, and boost your speed even more. Why waste time debugging hand-coded C/C++? You can easily develop a Euphoria program, and then generate the C code.
"Hand-coded C/C" is much more efficient than the generated code. Agan, this is marketing fluff and it is almost lying IMHO.
- Euphoria programs are not constrained by any 640K memory restrictions for which MS-DOS is infamous. All versions of Euphoria let you use all the memory on your system, and if that isn't enough, a swap file on disk will provide additional virtual memory.
It's 2009. Nobody cares .
- RDS has developed a flexible and simple database system (EDS) that is portable across all Euphoria platforms.
EDS is embarassing, if you ask me. The implementation uses binary search? Give me a break.
- The Linux, FreeBSD and OS X implementations of Euphoria let you access C routines and variables in shared libraries, for tasks ranging from graphics, to GUI programming, to Internet programming. The good news is, you'll be programming in Euphoria, not C.
There are other languages than C and most languages do interface with C pretty well.
2. Re: Euphoria vs. other programming languages
- Posted by Fendaril Mar 04, 2009
- 1610 views
Lua is a scripting language and last I heard could not create stand-alone executables. Ohand take you bullcrap trolling "critiscism" somewhere else. If you do not like euphoria go away.
3. Re: Euphoria vs. other programming languages
- Posted by DerekParnell (admin) Mar 04, 2009
- 1641 views
Ha, ha, there is few that sets it "apart from the crowd", see below. ...
Before I can attempt to address your post, I'd like to understand why you have written it. Can you let me know your motive for it? The tone seems quite negative so I'm not sure what you are trying to achieve.
4. Re: Euphoria vs. other programming languages
- Posted by Fendaril Mar 04, 2009
- 1612 views
Its obviously negative.
5. Re: Euphoria vs. other programming languages
- Posted by ChrisB (moderator) Mar 04, 2009
- 1627 views
So don't use it. We all have our own reasons for using euphoria, if you prefer other languages, go for it, and best of luck to you. Personally mine is the sheer simplicity and ease of understanding the code. If your brain fits python and lua, use them.
Chris
6. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1603 views
I was too harsh. But apart from that, the documentation needs to be updated IMHO. Concentrate on the GUI tools that you have developed. And mention the comercial projects on your website. You need better marketing.
Other examples:
You are forced to write different code for different data types simply to copy the data, ask for its current length, concatenate it, compare it etc. The manuals for those languages are packed with routines such as "strcpy", "strncpy", "memcpy", "strcat", "strlen", "strcmp", "memcmp", etc. that each only work on one of the many types of data. The specialised routines may have been more efficient when C was developed in the 60s. Hardware has changed tremendously ever since.
This is misleading at best. It is almost lying. It only refers to C and C is still more efficient than EU even though the hardware has changed.
Unlike other languages such as LISP and Smalltalk, Euphoria's "garbage collection" of unused storage is a continuous process that never causes random delays in execution of a program, and does not pre-allocate huge regions of memory.
I guess Smalltalk and LISP have better GC's than EU right now. Again, this is misleading, out-of-date and unconvincing. Please emphasize EU's real advantages rather than these misleading "facts".
7. Re: Euphoria vs. other programming languages
- Posted by shfrance Mar 04, 2009
- 1607 views
By my count the critic has picked the fruit of 6 languages and 3 OS's to make his points. I would suggest rather than cherry picking for projectiles, he should aid in concocting this fruit salad. As he obviously has invested most of his myopic life staring at a screen, he could be well qualified to assist in the pursuit of the elegant simplicity that is the Euphoria way.
8. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1624 views
Lua is a scripting language and last I heard could not create stand-alone executables. Ohand take you bullcrap trolling "critiscism" somewhere else. If you do not like euphoria go away.
srlua seems to build executables for Lua.
9. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1600 views
By my count the critic has picked the fruit of 6 languages and 3 OS's to make his points. I would suggest rather than cherry picking for projectiles, he should aid in concocting this fruit salad.
I don't understand this. English is not my mother tongue. But you seem to be unable to count, so I have not tried that hard to understand you ...
As he obviously has invested most of his myopic life staring at a screen, he could be well qualified to assist in the pursuit of the elegant simplicity that is the Euphoria way.
So your insult is that I am qualified. Better luck next time.
10. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 04, 2009
- 1612 views
You are forced to write different code for different data types simply to copy the data, ask for its current length, concatenate it, compare it etc. The manuals for those languages are packed with routines such as "strcpy", "strncpy", "memcpy", "strcat", "strlen", "strcmp", "memcmp", etc. that each only work on one of the many types of data. The specialised routines may have been more efficient when C was developed in the 60s. Hardware has changed tremendously ever since.
This is misleading at best. It is almost lying. It only refers to C and C is still more efficient than EU even though the hardware has changed.
I think you have an overly simple view of what 'efficient' means. Most higher level languages claim (rightly so) to be more efficient with programmer time, which at this point is typically more expensive than machine time. So your comment regarding hardware change is exactly why this point is relevant. Overall efficiency is often improved by using higher level languages. Of course, the trade off needs to be evaluated for each application.
Unlike other languages such as LISP and Smalltalk, Euphoria's "garbage collection" of unused storage is a continuous process that never causes random delays in execution of a program, and does not pre-allocate huge regions of memory.
I guess Smalltalk and LISP have better GC's than EU right now. Again, this is misleading, out-of-date and unconvincing. Please emphasize EU's real advantages rather than these misleading "facts".
Is your guess based on anything, or just random? You don't offer any reasons to back it up.
I can't quickly find any details on Smalltalk garbage collection, but this criticism does seem to apply to at least some forms of Lisp. Is your comment based on some other implementation?
These criticisms of GC should definitely be aimed at things like Java or Microsoft's CLR/Mono. Java does allocate large chunks of memory up front. Both of these also do periodic garbage collection, which can cause pauses in the execution. So you're correct that it could be more up to date.
Of course, being convincing is something that's entirely in the eye of the beholder. Clearly, you're not, which is Ok. Fortunately for you, there are other options available.
Matt
11. Re: Euphoria vs. other programming languages
- Posted by jeremy (admin) Mar 04, 2009
- 1597 views
He is right in that some of the docs need to be updated. For isntance, the quote about 640k. There is another one that Euphoria can now create programs that use a sound blaster card!
Quotes like that are only harming us. Some of the others that Critic has mentioned, I think he just doesn't understand things. On a few occassions he said other languages can do that, but w/the addition of all sorts of libraries, 3rd party tools, etc... Well, any language can do anything if you look hard enough.
Anyway, I would't spend a whole lot of time on this thread, but I would take a few things serious, such as updating our marketing data. Further, I'd like to suggest that the web site needs a huge face lift. Both of those are hurting Euphoria.
Jeremy
12. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1649 views
Is your guess based on anything, or just random? You don't offer any reasons to back it up.
As if EU's doc is backed up... But anyway: http://www.lispworks.com/products/myths_and_legends.html Lispworks has a generational GC. I think Visualworks (Smalltalk) has something similar.
These criticisms of GC should definitely be aimed at things like Java or Microsoft's CLR/Mono. Java does allocate large chunks of memory up front. Both of these also do periodic garbage collection, which can cause pauses in the execution. So you're correct that it could be more up to date.
Quite true, at least for Java (I don't know about CLR). But it is a bit like saying "EU fragments memory, because it has no copying GC".
13. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1590 views
I think you have an overly simple view of what 'efficient' means.
But the excerpt that I quoted refers to the hardware/execution efficiency.
14. Re: Euphoria vs. other programming languages
- Posted by ghaberek (admin) Mar 04, 2009
- 1632 views
- RDS has developed a flexible and simple database system (EDS) that is portable across all Euphoria platforms.
EDS is embarassing, if you ask me.
I want to address this statement in particular. The point of EDS is that it is, as the document states, flexible and simple. At its core, EDS is nothing more than an efficient way to store Euphoria objects on disk. Other languages may offer this functionality, but hardly without the grace and simplicity (and low-level compression) of EDS (I'm thinking of Python's "pickling").
The implementation uses binary search? Give me a break.
What's wrong with binary search? It's rather fast on small data sets, and is proportionally faster as data sets grow than many other search methods (especially linear search). Larger database systems like MySQL use B-trees, which are better fit for large sets of (seemingly) unorganized data (which is what MySQL is aimed at, anyway). EDS always stores data in sorted order, so binary search works great for what we need.
-Greg
15. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1614 views
Some of the others that Critic has mentioned, I think he just doesn't understand things.
You are a funny guy.
On a few occassions he said other languages can do that, but w/the addition of all sorts of libraries, 3rd party tools, etc...
That's incorrect. Python's usable out of the box and ships with many libaries. It seems you have never used it.
16. Re: Euphoria vs. other programming languages
- Posted by jeremy (admin) Mar 04, 2009
- 1605 views
Some of the others that Critic has mentioned, I think he just doesn't understand things.
You are a funny guy.
On a few occassions he said other languages can do that, but w/the addition of all sorts of libraries, 3rd party tools, etc...
That's incorrect. Python's usable out of the box and ships with many libaries. It seems you have never used it.
Actually, I have used Python extensively. What I was refering to is the use of a compiler for Lua, then the use of valgrind for C. Anyway, you have not answered Derek's question really. Why did you write a message like this? Was it to antagonize or to offer criticism of the documents or ??? That would help us in addressing your concerns, if that is your end goal and not turn this thread into a mud slinging contest.
Jeremy
17. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1618 views
Anyway, you have not answered Derek's question really. Why did you write a message like this? Was it to antagonize or to offer criticism of the documents or ??? That would help us in addressing your concerns, if that is your end goal and not turn this thread into a mud slinging contest.
I must admit that I like being harsh. But I did not start the personal attacks.
Anyway, I have two points: The first one is to critize the quoted parts of the documentation. I am almost offended by some parts of EU's documentation.
My second point is to discuss EU, in particular compare it with Lua and Python.
18. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1604 views
I want to address this statement in particular. The point of EDS is that it is, as the document states, flexible and simple. At its core, EDS is nothing more than an efficient way to store Euphoria objects on disk.
Ah, that explains a lot. Ok.
Other languages may offer this functionality, but hardly without the grace and simplicity (and low-level compression) of EDS (I'm thinking of Python's "pickling").
Well, it's simple enough for me:
import pickle pickle.dump({"key": "value", "key2": "value2"}, open("mydata.dat", "wb+")) value = pickle.load(open("mydata.dat", "rb"))
19. Re: Euphoria vs. other programming languages
- Posted by jeremy (admin) Mar 04, 2009
- 1611 views
Anyway, I have two points: The first one is to critize the quoted parts of the documentation. I am almost offended by some parts of EU's documentation.
Ok, with that, I agree with you. Maybe we should start another thread for identifying and fixing these quotes/statements.
My second point is to discuss EU, in particular compare it with Lua and Python.
As for comparing, I think you have made your points. Other languages can do the same thing Euphoria can. Some are more powerful in some areas, others are less powerful. In the end, choosing a programming language really comes down to a personal choice. What clicks best with you. I could argue that you could write any program in any language and it would be 99% true. Sure, you may not want to write a web server in dos batch, but I am sure it could be done.
Jeremy
20. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1607 views
Ok, with that, I agree with you. Maybe we should start another thread for identifying and fixing these quotes/statements.
Go ahead.
21. Re: Euphoria vs. other programming languages
- Posted by DerekParnell (admin) Mar 04, 2009
- 1592 views
I must admit that I like being harsh. But I did not start the personal attacks.
I'm sorry that you like being harsh; that must be lonely sometimes. Also, I'm sorry that you think that there have been personal attacks here. I'm having trouble seeing those, but then I'm quite old.
Anyway, I have two points: The first one is to critize the quoted parts of the documentation. I am almost offended by some parts of EU's documentation.
My second point is to discuss EU, in particular compare it with Lua and Python.
So let me get this straight, you write a lot of critical remarks, most of which are not constructive critism (IMHO) because you want to critize. Ok, I guess you succeeded in that aim. Well done.
You also wish to discuss comparisions between EU, Lua, and Python. Ok, I suspect that that topic of discussion will be a potentially huge one, so you have only just begun it here.
Is the ultimate purpose for your interest here to improve EU or to convince people away from EU? If it is to improve it, then welcome and I hope you can add some material efforts to that goal, because we are very short staffed. If you wish to talk people out of using EU then you have begun your argumements in a poorer manner than I think is needed for that.
22. Re: Euphoria vs. other programming languages
- Posted by ghaberek (admin) Mar 04, 2009
- 1623 views
import pickle pickle.dump({"key": "value", "key2": "value2"}, open("mydata.dat", "wb+")) value = pickle.load(open("mydata.dat", "rb"))
Already I can see an advantage of EDS over pickle: EDS has tables, which allow me to separate my data into a more logical structure. I suppose a clever arrangement of lists may yield a similar result.
And how do you fetch only "key" or "key2" from the file? What if you've got one hundred keys? or ten thousand keys? or one million keys? Do you have to load the whole file back into memory at once then write it all back to disk if you only want to update one key? That seems rather... slow.
-Greg
23. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1609 views
So let me get this straight, you write a lot of critical remarks, most of which are not constructive critism (IMHO) because you want to critize. Ok, I guess you succeeded in that aim. Well done.
I'd be more constructive to fix the documentation than to argue with me.
24. Re: Euphoria vs. other programming languages
- Posted by DerekParnell (admin) Mar 04, 2009
- 1605 views
So let me get this straight, you write a lot of critical remarks, most of which are not constructive critism (IMHO) because you want to critize. Ok, I guess you succeeded in that aim. Well done.
I'd be more constructive to fix the documentation than to argue with me.
Correct. That's why I'm not arguing with. It would also be more constructive to provide us with what you think it should say as well as what is wrong with the current words. I understand though that this might not be possible in all cases. I too have come across things in which I know to be wrong but I don't know how to fix it. But in any case, I'm sure that you, being a wordsmith, will be able to help us correct the information provided so far. I look forward to your contributions.
25. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1598 views
Already I can see an advantage of EDS over pickle: EDS has tables, which allow me to separate my data into a more logical structure.
Well, you wanted simple, you got simple.
And how do you fetch only "key" or "key2" from the file? What if you've got one hundred keys? or ten thousand keys? or one million keys?
Well, I'd rather use sqlite than EDS for this, but OK, you have a point.
Do you have to load the whole file back into memory at once then write it all back to disk if you only want to update one key? That seems rather... slow.
Something similar happens to sequences all the time in EU, so personally I see this as an own goal. (Please don't be offended.)
26. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 04, 2009
- 1599 views
Correct. That's why I'm not arguing with. It would also be more constructive to provide us with what you think it should say as well as what is wrong with the current words.
Come on, I told you what's wrong with them and what to emphazise instead. If you don't agree and I have not convinced you why should I contribute? So that you can give a tit-for-tat response?
And who thinks I am the right person to praise EU, anyway?
27. Re: Euphoria vs. other programming languages
- Posted by Kat Mar 04, 2009
- 1641 views
- Last edited Mar 05, 2009
Lua is a scripting language and last I heard could not create stand-alone executables. Ohand take you bullcrap trolling "critiscism" somewhere else. If you do not like euphoria go away.
srlua seems to build executables for Lua.
There's TWO libs in the archives for using Lua in Eu. I think if Eu is the caller, then the combo Eu-Lua is a standalone (with more than one file).
useless
28. Re: Euphoria vs. other programming languages
- Posted by jimcbrown (admin) Mar 05, 2009
- 1576 views
There's TWO libs in the archives for using Lua in Eu. I think if Eu is the caller, then the combo Eu-Lua is a standalone (with more than one file).
useless
Hi Kat.
29. Re: Euphoria vs. other programming languages
- Posted by Tom Mar 05, 2009
- 1600 views
Here is a updated version of "Yet Another..."
Tom
Yet Another Programming Language?
Euphoria is a very high-level programming language. It is unique amongst a crowd of conventional languages.
First, Euphoria delivers the "expected" features of a modern language:
- open source
- free for personal and commercial use
- produces royalty-free, stand-alone, programs
- multi-platform--Windows, Linux, FreeBSD, OSX, and even Dos
- provides a choice of multi-platform gui toolkits: IUP, GTK, wxWindows
- features a Windows IDE and gui library written in Euphoria
- syntax-colored editors, profiling, and tracing of code
- dynamic memory allocation and efficient garbage collection
- interfacing to existing C libraries and databases
- well-documented, lots of example source-code, and an enthusiastic forum
- edit and run convenience
Euphoria is unique
What makes Euphoria unique is a design that uses an atom/sequence paradigm for data-types. An atom is single numeric value (either a number or character), while a sequence is a collection of numeric values (atoms, strings, nested sequences, ... ).
What follows from this design are some advantages over conventional languages:
- the language syntax is smaller--and thus easier to learn
- the language syntax is consistent--and thus easier to program
- routines are more generic--a routine used for strings may also be applied to any data structure
- a higher level view of programming
- sequences are dynamic
you may create and destroy at willand modify them to any size and complexity
Euphoria has qualities that conventional languages wish to have:
- Euphoria programs are considerably faster than conventional interpreted languages--Euphoria makes a better website server
- Euphoria programs can be translated then compiled as C programs--fast programs become even faster
- Euphoria lets you write multi-tasking programs--independent of the platform you are using
- Euphoria has meaningful error messages--it is easier to fix mistakes
- Euphoria has an elegant design--Euphoria programmers enjoy programming in Euphoria
As a //first// programming language:
- Easy to learn, easy to program
- No limits as to what you can program
- Euphoria programming skills will enhance learning other languages
As an //extension// to languages you already know:
- A fast, flexible, and powerful language
- Euphoria, the language you will prefer to program in
But, my favorite language is ...
You will find that Euphoria programmers are also knowledgeable in other languages. I find that the more tools you have (saws and hammers, or programming languages) the richer you are. Picking the correct tool is part of the art of programming. It will remain true that some people can program better in their favorite language rather than an arguably superior language.
Give Euphoria a try, and discover why it has enthusiastic supporters.
30. Re: Euphoria vs. other programming languages
- Posted by euphoric (admin) Mar 05, 2009
- 1582 views
Nice work Tom!
31. Re: Euphoria vs. other programming languages
- Posted by Critic Mar 05, 2009
- 1571 views
Tom, great work! I have nothing to criticize.
32. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 06, 2009
- 1610 views
I do.
It is simply not true that other conventional languages "wish to have" meaningful error messages.
Sure, it all depends what you include in "conventional languages". This would deserve at least a footnote. In the two I use more, and the one which I use at work, meaningful error messages are fairly standard. (Pascal, Eiffel and SAS).
As for the "elegant design"... of course, it is a question of taste. No clear way to determine or set the visibility of a symbol? No PBR? Forward references that make maintainance as difficult as in C? Those are at least three reasons for which I definitely disagree with this statement. Not to mention those 30-bit integers which make interfacing with other languages such a pleasure.
You should add, so as not to mislead newcomers: "A language without a programming IDE". Visual Euphoria (from the archive) is a first step towards that, but obviously falls short of an useful IDE.
CChris
33. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 06, 2009
- 1526 views
No clear way to determine or set the visibility of a symbol?...Forward references that make maintainance as difficult as in C?
LOL
Matt
34. Re: Euphoria vs. other programming languages
- Posted by Mike Mar 06, 2009
- 1592 views
@ Tom - great work!
35. Re: Euphoria vs. other programming languages
- Posted by Tom Mar 06, 2009
- 1547 views
- Last edited Mar 07, 2009
Thanks CChris, I need as many viewpoints as possible to improve the documentation.
"Elegant" is a loaded word. Clearly I will need to do some thinking as how best to defend such a viewpoint.
I used to enjoy Pascal but decided ( ; ) line endings were not to my taste.
At the moment I have compared Euphoria to Lua and Python. When I try examples in those languages and make mistakes the error messages can be very confusing to merelative to Euphoria.
I like the simplicity of Euphoria because pointers and PBR are not part of the language. This is "elegant" for me in a high level language.
I do not understand your requirements for variables and scope.
A slick windows gui may be nice, but how do you go about creating one?
36. Re: Euphoria vs. other programming languages
- Posted by ChrisB (moderator) Mar 07, 2009
- 1515 views
So, Judith's IDE, isn't slick enough?
Chris
37. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 08, 2009
- 1504 views
Thanks CChris, I need as many viewpoints as possible to improve the documentation.
"Elegant" is a loaded word. Clearly I will need to do some thinking as how best to defend such a viewpoint.
I used to enjoy Pascal but decided ( ; ) line endings were not to my taste.
A single unshifted key, and it helps the compiler understand stuff which is more natural for humans. But of course whether a tradeoff is appropriate or not starts becoming very subjective.
At the moment I have compared Euphoria to Lua and Python. When I try examples in those languages and make mistakes the error messages can be very confusing to merelative to Euphoria.
I like the simplicity of Euphoria because pointers and PBR are not part of the language. This is "elegant" for me in a high level language.
I dislike the ugliness of programming when you have to pass some state around routine chunks. Sequence indexes and access to RAM addresses (if only it was faster) may be consider a decent alternative to pointers. But not for PBR.
I do not understand your requirements for variables and scope.
Ability to tell where a symbol is defined from, or where it will be seen from, with as little a earch overhead as possible, and as much certainty as possible. Eu 4.0 is even worse than 3.1.1 in that respect.
A slick windows gui may be nice, but how do you go about creating one?
Please check the Visual Euphoria project in the archive. As a mentioned, it is only a first step. I had strongly enhanced it, but lost some of the files in a HD crash, and didn't spend much time trying to get it to work again. spent_memory hat dodo doubt com doubt au may have the only working copy left, but hasn't replied to my requests to send one back.
BTW Critic is not an alias for me, nor the other way round. We simply seem to agree on many issues.
CChris
38. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 08, 2009
- 1485 views
So, Judith's IDE, isn't slick enough?
Chris
It is a designing IDE, not a programming IDE. You can't use it for non win32lib-based apps. It doesn't tell you where symbols are defined, how the inclusion tree (now graph) looks like, doesn't provide any routine management, doesn't provide code templates, doesn't provie autocompletion or other routine argument tips, etc etc etc
You may say that advanced text editors do provide many of those features. That is true. But, for instance, none that I know abou can properly highlight instances of variables with an user defined type - just one tiny example.
CChris
39. Re: Euphoria vs. other programming languages
- Posted by ChrisB (moderator) Mar 08, 2009
- 1457 views
Then what is also needed is the "perfect" IDE design, to run alongside eu4.0 development.
Chris
40. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 08, 2009
- 1474 views
I do not understand your requirements for variables and scope.
Ability to tell where a symbol is defined from, or where it will be seen from, with as little a search overhead as possible, and as much certainty as possible. Eu 4.0 is even worse than 3.1.1 in that respect.
Please substantiate this claim.
While the global scope still exists, it's use is discouraged, and would probably have been removed completely, except for legacy code.
Matt
41. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 09, 2009
- 1467 views
I do not understand your requirements for variables and scope.
Ability to tell where a symbol is defined from, or where it will be seen from, with as little a search overhead as possible, and as much certainty as possible. Eu 4.0 is even worse than 3.1.1 in that respect.
Please substantiate this claim.
While the global scope still exists, it's use is discouraged, and would probably have been removed completely, except for legacy code.
Matt
If an identifier appears at line x in file y, you now don't know at all in which line and which file it was defined. In 3.1, you know it comes from a previously parsed symbol.
Likewise, there is no way to determine easily where a public symbol is being seen. You have to follow all the chains of "public include" directives that start from the definition file to sort it out. In 3.1, a global symbol was seen from the point where it is defined onwards, period.
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
Need more? There is.
CChris
42. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 09, 2009
- 1475 views
If an identifier appears at line x in file y, you now don't know at all in which line and which file it was defined. In 3.1, you know it comes from a previously parsed symbol.
A previously parsed symbol...from somewhere. Could be anywhere, maybe without any reference to that file, or anything remotely like it. Granted, this is still possible (and is why I mentioned global scope), but less likely, and should at least give the coder a warning in 4.0.
Likewise, there is no way to determine easily where a public symbol is being seen. You have to follow all the chains of "public include" directives that start from the definition file to sort it out. In 3.1, a global symbol was seen from the point where it is defined onwards, period.
As opposed to wondering which files were included and were filling up the global namespace? At least there is a chain of public includes.
I really can't understand what your point is in bringing this up. Are you concerned at determining who can see a particular symbol from the perspective of that symbol? As you mentioned, everyone can see a global symbol. That's a very blunt instrument, and has consequences that make it a lot less useful than it originally sounds.
I guess you're interested in some sort of external packaging mechanism again. I know that you love to add maintenance points, but I've had enough of config files that affect code behavior with java and its endless xml files. Even there, the trend seems to be away from that, and towards code annotations, which at least are done right where the code is.
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
I've used Win32Lib with 4.0. So have others. Perhaps the example isn't as obvious as you think.
Need more? There is.
Since you've yet to give any reasons why it's more difficult in 4.0 to determine scope and to find where symbols are defined than with 3.1, yes, I would like to hear more.
Matt
43. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 10, 2009
- 1478 views
If an identifier appears at line x in file y, you now don't know at all in which line and which file it was defined. In 3.1, you know it comes from a previously parsed symbol.
A previously parsed symbol...from somewhere.
Currently from anywhere. Previously only from a known part of the set of source files. This makes a whole differece on average, and it is detrimental to the maintainability of 4.0 code.
Could be anywhere, maybe without any reference to that file, or anything remotely like it. Granted, this is still possible (and is why I mentioned global scope), but less likely, and should at least give the coder a warning in 4.0.
Likewise, there is no way to determine easily where a public symbol is being seen. You have to follow all the chains of "public include" directives that start from the definition file to sort it out. In 3.1, a global symbol was seen from the point where it is defined onwards, period.
As opposed to wondering which files were included and were filling up the global namespace? At least there is a chain of public includes.
Do you mean that you don't know which files are in the source set? Come on, let's talk about real life.
Most editors have a search in file/folder ability. In 3.1, you need to simply list those statements. In 4.0, you need to see how they chain to one another. Can this be portrayed as simple?
I really can't understand what your point is in bringing this up. Are you concerned at determining who can see a particular symbol from the perspective of that symbol?
Yes, because it becomes tricky and error prone to adjust it.
As you mentioned, everyone can see a global symbol. That's a very blunt instrument, and has consequences that make it a lot less useful than it originally sounds.
Wrong, both in 3.1 and 4.0.
In 3.1, a global symbol can be seen any place parsed after it has been defined, not everywhere. Lots of code use this feature at their advantage.
In 4.0, a global symbol is further hidden if defined by an ancestor or sibling file. You need to add in extra include statements to see it. This has two drawbacks: 1/ vastly increasing the occcurrence of cyclic inclusion, which in turn require badly designed forward references to avoid errors; 2/ vastly decreasing the reusability of include files, since they must very often bear an explicit include directive for their parents, even though the aim is to allow several distinct parents, some of them user supplied, to include them.
I guess you're interested in some sort of external packaging mechanism again. I know that you love to add maintenance points, but I've had enough of config files that affect code behavior with java and its endless xml files. Even there, the trend seems to be away from that, and towards code annotations, which at least are done right where the code is.
Of course, and that was my main grief against the 3.1 nclusion system. But other more serious problems have been added.
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
I've used Win32Lib with 4.0. So have others. Perhaps the example isn't as obvious as you think.
R. Stowasser has posted many instances of problems. The way w32start.ew works now is at best unpredictable, and it is central to the proper working of newUIObj().
Need more? There is.
Since you've yet to give any reasons why it's more difficult in 4.0 to determine scope and to find where symbols are defined than with 3.1, yes, I would like to hear more.
Matt
Simply _read_ the emails you reply to _before_ replying.
CChris
44. Re: Euphoria vs. other programming languages
- Posted by jeremy (admin) Mar 10, 2009
- 1447 views
CChris,
IMHO, your claims are incorrect. The new system is much better, much cleaner, much easier to understand what is going on period. We've been over this a thousand times and if I recall, out of over 15 votes, you are the only person who has expressed a distaste for the new public/include system. Everyone else is on the other side. Not that majority always is better, but it may mean something. The only feasable thing that could be done to make it better would be to remove the global keyword, but this has serious consequences for legacy code, which is why it remains.
Jeremy
45. Re: Euphoria vs. other programming languages
- Posted by jimcbrown (admin) Mar 10, 2009
- 1430 views
Currently from anywhere. Previously only from a known part of the set of source files. This makes a whole differece on average, and it is detrimental to the maintainability of 4.0 code.
In large programs, I typically have to use grep to figure out which file defined the symbol that i was trying to used. I have done this since eu 1.5!
Since the normal practice is to place all includes at the top of the file, there is no practical difference.
Do you mean that you don't know which files are in the source set? Come on, let's talk about real life.
This happens to me on a daily basis. ;) Luckily I have grep ... and ls ...
Most editors have a search in file/folder ability. In 3.1, you need to simply list those statements. In 4.0, you need to see how they chain to one another. Can this be portrayed as simple?
Why is it necessary to check the entire chain? You just need to check two types of places: where the symbol is being used and where the symbol is declared. grep searching is good enough for this (and 3.1 did not really make this any easier than 4.0)
I really can't understand what your point is in bringing this up. Are you concerned at determining who can see a particular symbol from the perspective of that symbol?
Yes, because it becomes tricky and error prone to adjust it.
It is really easy to expand the visibility of the symbol, so I assume you are talking about trying to hide it from more files.
How often is this really necessary?
As you mentioned, everyone can see a global symbol. That's a very blunt instrument, and has consequences that make it a lot less useful than it originally sounds.
Wrong, both in 3.1 and 4.0.
In 3.1, a global symbol can be seen any place parsed after it has been defined, not everywhere. Lots of code use this feature at their advantage.
The only major way this feature has been used is to allow redefinitions of builtins to call the original builtins. Since we have an alternate way to do this (the eu: namespace), problem solved.
In 4.0, a global symbol is further hidden if defined by an ancestor or sibling file.
Only if the ancestor file declares a symbol in public scope AND that symbol is still visible by the time we get to the usage.
In 3.1, this problem still existed if both symbols were global, only we got an error message because 3.1 wasn't smart enough to figure out which symbol to use.
In 3.1, this problem still existed if the file had a local symbol with the same name.
You need to add in extra include statements to see it.
Which, for the global vs global case, was requried for 3.1 as well.
This has two drawbacks: 1/ vastly increasing the occcurrence of cyclic inclusion, which in turn require badly designed forward references to avoid errors;
In other words, 1/ is not a drawback unless you take as a given that forward references are bad in general.
2/ vastly decreasing the reusability of include files, since they must very often bear an explicit include directive for their parents, even though the aim is to allow several distinct parents, some of them user supplied, to include them.
This is not an aim. All files should explicitly include the files that declare the symbols that they wish to use. This is good practice, this is how it should work.
The exception to this is large multi-file libraries, which is what public include is meant to be used for. One file serves as the file to include directly in the user app, and public include exposes the right symbols to the user.
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
R. Stowasser has posted many instances of problems. The way w32start.ew works now is at best unpredictable, and it is central to the proper working of newUIObj().
Agreed. forward referencing changed how the global keyword works. This is a good reason for all major libraries to change to the new public keyword instead.
46. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 10, 2009
- 1450 views
If an identifier appears at line x in file y, you now don't know at all in which line and which file it was defined. In 3.1, you know it comes from a previously parsed symbol.
A previously parsed symbol...from somewhere.
Currently from anywhere. Previously only from a known part of the set of source files. This makes a whole differece on average, and it is detrimental to the maintainability of 4.0 code.
CChris, in your own [preferred!] coding style, you had files that used variables in files that you never included in any way, shape or form, but required the file that included them to have defined the file. I seriously don't understand how you can claim to be interested in maintainability.
Could be anywhere, maybe without any reference to that file, or anything remotely like it. Granted, this is still possible (and is why I mentioned global scope), but less likely, and should at least give the coder a warning in 4.0.
Likewise, there is no way to determine easily where a public symbol is being seen. You have to follow all the chains of "public include" directives that start from the definition file to sort it out. In 3.1, a global symbol was seen from the point where it is defined onwards, period.
As opposed to wondering which files were included and were filling up the global namespace? At least there is a chain of public includes.
Do you mean that you don't know which files are in the source set? Come on, let's talk about real life.
Most editors have a search in file/folder ability. In 3.1, you need to simply list those statements. In 4.0, you need to see how they chain to one another. Can this be portrayed as simple?
The point of a public symbol was for a library to expose its API this way, but still retain the ability to share other symbols amongst its files without exposing those by using the export scope. So you would assume that any source file that has included the library would be able to see all of the public symbols in that library. This seems extremely simple to me.
As an application author, your concern is that you're using the library in question. And it's very easy to do that by putting include the_library.e in the source file. As the library author, you know that any source file that includes your library will be able to see your public symbols.
If you're relying on globals simply being in the same folder, then you still have to worry about inclusion order (in 3.1).
I really can't understand what your point is in bringing this up. Are you concerned at determining who can see a particular symbol from the perspective of that symbol?
Yes, because it becomes tricky and error prone to adjust it.
I agree, you are unable to comprehend it.
As you mentioned, everyone can see a global symbol. That's a very blunt instrument, and has consequences that make it a lot less useful than it originally sounds.
Wrong, both in 3.1 and 4.0.
In 3.1, a global symbol can be seen any place parsed after it has been defined, not everywhere. Lots of code use this feature at their advantage.
In 4.0, a global symbol is further hidden if defined by an ancestor or sibling file. You need to add in extra include statements to see it. This has two drawbacks: 1/ vastly increasing the occcurrence of cyclic inclusion, which in turn require badly designed forward references to avoid errors; 2/ vastly decreasing the reusability of include files, since they must very often bear an explicit include directive for their parents, even though the aim is to allow several distinct parents, some of them user supplied, to include them.
Yes, I left out the parsed before issue. But this is an important point, so thanks for bringing my attention to it. Strange order of inclusion issues can easily trip you up in 3.1, causing global symbols you were counting on not to be available. In 4.0, it's less important, though it opens some possibility of symbol clashes, which, BTW are easily resolvable, unlike the order of inclusion issues in 3.1.
In fact, in 4.0 you do not need to add an include statement to see the globals elsewhere. Please understand the topic before you fly off the handle.
- Please enlighten us as to a better forward reference design. I know that your proposal was discussed on the developers list, but the broader audience of the EuForum has not had the opportunity to review it.
- The re-usability of code is not reduced at all. You can still use this paradigm as before, using global symbols. It's still a broken way of doing things. You can get the same effect by exposing an API for the users of your library to use. This would be like requiring win32lib users to make their event handlers global, and to have win32lib call them directly.
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
I've used Win32Lib with 4.0. So have others. Perhaps the example isn't as obvious as you think.
R. Stowasser has posted many instances of problems. The way w32start.ew works now is at best unpredictable, and it is central to the proper working of newUIObj().
Huh? He found some bugs in the implementation. Most of his findings have been fixed (still working on one). As I said, I've used win32lib with 4.0, and it works just fine. Please leave the FUD somewhere else.
Since you've yet to give any reasons why it's more difficult in 4.0 to determine scope and to find where symbols are defined than with 3.1, yes, I would like to hear more.
Simply _read_ the emails you reply to _before_ replying.
CChris, I have read them. So have others. We've all called BS. If you have anything new to say, then I'd be interested to hear it, but not your same, discredited arguments.
Matt
47. Re: Euphoria vs. other programming languages
- Posted by Tom Mar 10, 2009
- 1452 views
I have changed the documentation. It looks like original text belonged to a stand-alone introduction to the Euphoria download. I have turned it (welcome.txt) into a one page intro to the new reference manual. Nothing is finalcomments are welcome.
Tom
48. Re: Euphoria vs. other programming languages
- Posted by RStowasser Mar 10, 2009
- 1464 views
- Last edited Mar 11, 2009
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
I've used Win32Lib with 4.0. So have others. Perhaps the example isn't as obvious as you think.
R. Stowasser has posted many instances of problems. The way w32start.ew works now is at best unpredictable, and it is central to the proper working of newUIObj().
Hi Chris,
actually I do not quite understand you. I once wrote to you that this quarrel is academic and that there are more ways to reach a goal. Many ways lead to Rome. If I report a problem then because I use Eu 4.0, because it is alpha, because I do not find a workaround for myself and because I trust into the development team. If I had your knowledge and your capabilities I would try to offer a solution myself. Really.
Btw I would not insist on full compatibility between Eu 4.0 and 3.1.1 applications. Other languages do this neither with their versions. To port programs from 3.1.1 to 4.0 you have to change some keywords anyway. (label, entry, continue, switch, break). I will not use global with Eu 4.0. And to be honest I would deprecate the use of global in Eu4.0 at all. Using the public and export keywords seem to be the better strategy to test and maintain separate modules / libraries. I do run my include files with exw/exwc to see if there are error messages. And although I like IDE and Win32lib they are also good examples in my opinion that they could be improved in Eu 4.0 only by using public and export. This would lead to a different structure of the include files, but I think this would also help to test and maintain the individual modules more effectively.
Roland
49. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 11, 2009
- 1403 views
CChris,
IMHO, your claims are incorrect. The new system is much better, much cleaner,
We probably mean slightly different things by this, even though we both use his notion.
much easier to understand what is going on period.
Quite the contrary.
We've been over this a thousand times and if I recall, out of over 15 votes, you are the only person who has expressed a distaste for the new public/include system. Everyone else is on the other side. Not that majority always is better, but it may mean something.
Has there been any community vote on such an important aspect? I can't remember it.
The only feasable thing that could be done to make it better would be to remove the global keyword, but this has serious consequences for legacy code, which is why it remains.
Jeremy
And would be very silly. Rather, use various mechanisms to prevent the need for global identifiers, so as to use them as sparingly as they should.
CChris
50. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 11, 2009
- 1463 views
The only feasable thing that could be done to make it better would be to remove the global keyword, but this has serious consequences for legacy code, which is why it remains.
And would be very silly. Rather, use various mechanisms to prevent the need for global identifiers, so as to use them as sparingly as they should.
This is exactly what we're doing: providing superior alternatives to using global scope. You still haven't figured it out, as evidenced by your comments. Why would removing global be silly (aside from legacy concerns)?
Matt
51. Re: Euphoria vs. other programming languages
- Posted by jeremy (admin) Mar 11, 2009
- 1405 views
Simply put, I give up. I'll spend my valuable time doing something constructive. Sorry.
Jeremy
52. Re: Euphoria vs. other programming languages
- Posted by Fendaril Mar 11, 2009
- 1387 views
You always give up.
53. Re: Euphoria vs. other programming languages
- Posted by ghaberek (admin) Mar 11, 2009
- 1410 views
I never finish anyth
54. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 12, 2009
- 1471 views
Currently from anywhere. Previously only from a known part of the set of source files. This makes a whole differece on average, and it is detrimental to the maintainability of 4.0 code.
In large programs, I typically have to use grep to figure out which file defined the symbol that i was trying to used. I have done this since eu 1.5!
Since the normal practice is to place all includes at the top of the file, there is no practical difference.
Inclusion of libraries happens usually at the top of the main file, because they are used almost from that point on, specially if they require some initialization.
For subfiles, ie files you include so as to split up your own code into moe manageable chnks, I don't think this is so clear cut. It is clearer to declare a variable or a file close to the point it is used.
Do you mean that you don't know which files are in the source set? Come on, let's talk about real life.
This happens to me on a daily basis. ;) Luckily I have grep ... and ls ...
Most editors have a search in file/folder ability. In 3.1, you need to simply list those statements. In 4.0, you need to see how they chain to one another. Can this be portrayed as simple?
Why is it necessary to check the entire chain? You just need to check two types of places: where the symbol is being used and where the symbol is declared. grep searching is good enough for this (and 3.1 did not really make this any easier than 4.0)
Not true.
file1.e includes file2.e file2.e includes file3.e file3.e includes file4.e
Identifier x is defined as public in file4.e . Where is it seen from? You have to follow th chain of public inclusions to guess whether it is visible in file1.e or not.
global was more straightforward, as you need only grep or similar utility. Some symbols must have less broad a scope, of course, but public is clearly not a good answer to the issue.
I really can't understand what your point is in bringing this up. Are you concerned at determining who can see a particular symbol from the perspective of that symbol?
Yes, because it becomes tricky and error prone to adjust it.
It is really easy to expand the visibility of the symbol, so I assume you are talking about trying to hide it from more files.
How often is this really necessary?
Not true again.
If you expand the visibility of some symbol in a deeply nested file, by adding another public qualifier to an include statement, you change the visibility of all symbols in that file. Not really the desired effect sometimes.
As you mentioned, everyone can see a global symbol. That's a very blunt instrument, and has consequences that make it a lot less useful than it originally sounds.
Wrong, both in 3.1 and 4.0.
In 3.1, a global symbol can be seen any place parsed after it has been defined, not everywhere. Lots of code use this feature at their advantage.
The only major way this feature has been used is to allow redefinitions of builtins to call the original builtins. Since we have an alternate way to do this (the eu: namespace), problem solved.
Problem not solved, since redefining other global symbols - from instance from the standard library - was just as common as redefinng builtins.
In 4.0, a global symbol is further hidden if defined by an ancestor or sibling file.
Only if the ancestor file declares a symbol in public scope AND that symbol is still visible by the time we get to the usage.
In 3.1, this problem still existed if both symbols were global, only we got an error message because 3.1 wasn't smart enough to figure out which symbol to use.
In 3.1, this problem still existed if the file had a local symbol with the same name.
You need to add in extra include statements to see it.
Which, for the global vs global case, was requried for 3.1 as well.
This has two drawbacks: 1/ vastly increasing the occcurrence of cyclic inclusion, which in turn require badly designed forward references to avoid errors;
In other words, 1/ is not a drawback unless you take as a given that forward references are bad in general.
Yes, they are. Declare before use had been one of the strength of the language.
Note that I only agree to "forward references are bad in general". With proper restrictions, they are handy but yet not too harmful. And forward referencing is obviously needed, if only to remove the need for cyclic inclusions.
2/ vastly decreasing the reusability of include files, since they must very often bear an explicit include directive for their parents, even though the aim is to allow several distinct parents, some of them user supplied, to include them.
This is not an aim. All files should explicitly include the files that declare the symbols that they wish to use. This is good practice, this is how it should work.
We have different faiths it seems. In large programs, this is very unpractical.
The exception to this is large multi-file libraries, which is what public include is meant to be used for. One file serves as the file to include directly in the user app, and public include exposes the right symbols to the user.
Not always and not in an easy to trace manner, see above.
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
R. Stowasser has posted many instances of problems. The way w32start.ew works now is at best unpredictable, and it is central to the proper working of newUIObj().
Agreed. forward referencing changed how the global keyword works. This is a good reason for all major libraries to change to the new public keyword instead.
55. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 12, 2009
- 1367 views
If an identifier appears at line x in file y, you now don't know at all in which line and which file it was defined. In 3.1, you know it comes from a previously parsed symbol.
A previously parsed symbol...from somewhere.
Currently from anywhere. Previously only from a known part of the set of source files. This makes a whole differece on average, and it is detrimental to the maintainability of 4.0 code.
CChris, in your own [preferred!] coding style, you had files that used variables in files that you never included in any way, shape or form, but required the file that included them to have defined the file. I seriously don't understand how you can claim to be interested in maintainability.
The coding style should reflect, as much as possible, the intended code and data flow. So, if some structure fits the bill, it is more maintainable because it is understood more easily and is less likely to have bugs in the first place.
Could be anywhere, maybe without any reference to that file, or anything remotely like it. Granted, this is still possible (and is why I mentioned global scope), but less likely, and should at least give the coder a warning in 4.0.
Likewise, there is no way to determine easily where a public symbol is being seen. You have to follow all the chains of "public include" directives that start from the definition file to sort it out. In 3.1, a global symbol was seen from the point where it is defined onwards, period.
As opposed to wondering which files were included and were filling up the global namespace? At least there is a chain of public includes.
Do you mean that you don't know which files are in the source set? Come on, let's talk about real life.
Most editors have a search in file/folder ability. In 3.1, you need to simply list those statements. In 4.0, you need to see how they chain to one another. Can this be portrayed as simple?
The point of a public symbol was for a library to expose its API this way, but still retain the ability to share other symbols amongst its files without exposing those by using the export scope. So you would assume that any source file that has included the library would be able to see all of the public symbols in that library. This seems extremely simple to me.
Another of your lies, Critic is right someimes.
The aim is to have parts of a program, either third party code or not, share symbols for others not to see, and also to allow symbols being seen everywhere even though they are not defined in the main source file.
As an application author, your concern is that you're using the library in question. And it's very easy to do that by putting include the_library.e in the source file. As the library author, you know that any source file that includes your library will be able to see your public symbols.
If you're relying on globals simply being in the same folder, then you still have to worry about inclusion order (in 3.1).
What is wrong with an inclusion order which shows in the simplest possible way which file uses which? Answer: i is too rigid and we have to deal with cyclic inclusions. That's where forward referencing helps on a case by xase basis.
I really can't understand what your point is in bringing this up. Are you concerned at determining who can see a particular symbol from the perspective of that symbol?
Yes, because it becomes tricky and error prone to adjust it.
I agree, you are unable to comprehend it.
As you mentioned, everyone can see a global symbol. That's a very blunt instrument, and has consequences that make it a lot less useful than it originally sounds.
Wrong, both in 3.1 and 4.0.
In 3.1, a global symbol can be seen any place parsed after it has been defined, not everywhere. Lots of code use this feature at their advantage.
In 4.0, a global symbol is further hidden if defined by an ancestor or sibling file. You need to add in extra include statements to see it. This has two drawbacks: 1/ vastly increasing the occcurrence of cyclic inclusion, which in turn require badly designed forward references to avoid errors; 2/ vastly decreasing the reusability of include files, since they must very often bear an explicit include directive for their parents, even though the aim is to allow several distinct parents, some of them user supplied, to include them.
Yes, I left out the parsed before issue. But this is an important point, so thanks for bringing my attention to it. Strange order of inclusion issues can easily trip you up in 3.1, causing global symbols you were counting on not to be available. In 4.0, it's less important, though it opens some possibility of symbol clashes, which, BTW are easily resolvable, unlike the order of inclusion issues in 3.1.
I cannot see any fact that support that claim, quite the contrary.
In fact, in 4.0 you do not need to add an include statement to see the globals elsewhere. Please understand the topic before you fly off the handle.
- Please enlighten us as to a better forward reference design. I know that your proposal was discussed on the developers list, but the broader audience of the EuForum has not had the opportunity to review it.
Will do on another thread, this one becomes fairly nested.
- The re-usability of code is not reduced at all. You can still use this paradigm as before, using global symbols. It's still a broken way of doing things. You can get the same effect by exposing an API for the users of your library to use. This would be like requiring win32lib users to make their event handlers global, and to have win32lib call them directly.
You limit yourself to the library - main app paradigm. It is certainly not the only possible one for larger apps.
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
I've used Win32Lib with 4.0. So have others. Perhaps the example isn't as obvious as you think.
R. Stowasser has posted many instances of problems. The way w32start.ew works now is at best unpredictable, and it is central to the proper working of newUIObj().
Huh? He found some bugs in the implementation. Most of his findings have been fixed (still working on one). As I said, I've used win32lib with 4.0, and it works just fine. Please leave the FUD somewhere else.
Since you've yet to give any reasons why it's more difficult in 4.0 to determine scope and to find where symbols are defined than with 3.1, yes, I would like to hear more.
Simply _read_ the emails you reply to _before_ replying.
CChris, I have read them. So have others. We've all called BS. If you have anything new to say, then I'd be interested to hear it, but not your same, discredited arguments.
Matt
CChris
56. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 12, 2009
- 1380 views
Further, even though the "global" keyword has been left in, its semantics have changed, to the effect of breaking most complex libraries available. win32lib is perhaps the most obvious example.
I've used Win32Lib with 4.0. So have others. Perhaps the example isn't as obvious as you think.
R. Stowasser has posted many instances of problems. The way w32start.ew works now is at best unpredictable, and it is central to the proper working of newUIObj().
Hi Chris,
actually I do not quite understand you. I once wrote to you that this quarrel is academic and that there are more ways to reach a goal. Many ways lead to Rome. If I report a problem then because I use Eu 4.0, because it is alpha, because I do not find a workaround for myself and because I trust into the development team. If I had your knowledge and your capabilities I would try to offer a solution myself. Really.
I did, but ayatollah Matt & Jeremy said there was nothing to discuss. [/quote RStowasser] Btw I would not insist on full compatibility between Eu 4.0 and 3.1.1 applications. [/quote] Most Eu coders are happy to have had time to write code that eventually works. When the compatibility breakage goes beyond cosmetic changes like variable names, it is quite unreasonable to ask them to rewrite, as the code organisation itself may be affected. The coder base is simply not large enough for the luxury you suggest. Perl could do it, not Eu.
Other languages do this neither with their versions. To port programs from 3.1.1 to 4.0 you have to change some keywords anyway. (label, entry, continue, switch, break). I will not use global with Eu 4.0.
As I said, a 10 minute nearly automated change process is acceptable, I think. You cannot get past it anyway, or not easily. Changing the semantics of the language is a completely different story.
And to be honest I would deprecate the use of global in Eu4.0 at all. Using the public and export keywords seem to be the better strategy to test and maintain separate modules / libraries. I do run my include files with exw/exwc to see if there are error messages. And although I like IDE and Win32lib they are also good examples in my opinion that they could be improved in Eu 4.0 only by using public and export. This would lead to a different structure of the include files, but I think this would also help to test and maintain the individual modules more effectively.
Roland
Why deprecate global? It has very legitimate uses. But alternative schemes should be provided so that it becomes useful only for special cases, just like goto.
I'll soon (in the next 6 hours I guess) post an alternate scheme. It ensures modularization, keeps the declare befor use paradigm, and keeps global unchanged - but in check. Its being unchecked has been indeed a prolem, which public attempted to solve, but with too bad collateral damage. Note that I am not directing much criticism towards export. export is fragile because a change in source system geometry will break it, but it is handy often enough to be kept, I think.
CChris
57. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 12, 2009
- 1375 views
CChris, in your own [preferred!] coding style, you had files that used variables in files that you never included in any way, shape or form, but required the file that included them to have defined the file. I seriously don't understand how you can claim to be interested in maintainability.
The coding style should reflect, as much as possible, the intended code and data flow. So, if some structure fits the bill, it is more maintainable because it is understood more easily and is less likely to have bugs in the first place.
To be clear here (because I'm sure there are readers that aren't aware of what you're talking about), the 'structure' we're discussing is where there is a library that relies on the application using it to define certain globals, and then use those symbols. Of course, if multiple symbols match, you're SOL, without modifying the library. This sort of requirement to modify 3rd party code was a big driver behind the scope and inclusion changes in 4.0.
And I've yet to hear anyone but you argue it should be considered a good practice to write a source file that uses other source files where it does not express that dependency as an include file. This would be like a user writing a library that depended upon win32lib, but never included win32lib.
The point of a public symbol was for a library to expose its API this way, but still retain the ability to share other symbols amongst its files without exposing those by using the export scope. So you would assume that any source file that has included the library would be able to see all of the public symbols in that library. This seems extremely simple to me.
Another of your lies, Critic is right someimes.
The aim is to have parts of a program, either third party code or not, share symbols for others not to see, and also to allow symbols being seen everywhere even though they are not defined in the main source file.
Critic realized that we had a miscommunication. Please explain how I have lied, for apparently I have lied even to myself.
I can't see anything that I said above that contradicts this statement of yours. If you want the main file to do the 'heavy lifting' of including libraries, and avoid having to do that in other files that are part of the application, then simply use public include for your libraries, and have the sub files include main_app.ex, and you've got explicit inclusion there, without having to resort to globals.
Really, most of your arguments come down to you being lazy, and believing that include statements are harmful to maintenance, not to mention too much effort.
As an application author, your concern is that you're using the library in question. And it's very easy to do that by putting include the_library.e in the source file. As the library author, you know that any source file that includes your library will be able to see your public symbols.
If you're relying on globals simply being in the same folder, then you still have to worry about inclusion order (in 3.1).
What is wrong with an inclusion order which shows in the simplest possible way which file uses which? Answer: i is too rigid and we have to deal with cyclic inclusions. That's where forward referencing helps on a case by xase basis.
The problem is that the inclusion order of a large set of source files can be a very fragile thing. And if some parts of your code rely on certain other parts, and if you have dependency cycles, then you've created additional maintenance to straighten out the dependency cycles.
One of the major benefits of the current design of forward referencing is that if you put include some_file.e in your code, then you can be assured that all symbols from some_file.e are available to the current file, without having to worry about dependency cycles.
I really can't understand what your point is in bringing this up. Are you concerned at determining who can see a particular symbol from the perspective of that symbol?
Yes, because it becomes tricky and error prone to adjust it.
I agree, you are unable to comprehend it.
Yes, I left out the parsed before issue. But this is an important point, so thanks for bringing my attention to it. Strange order of inclusion issues can easily trip you up in 3.1, causing global symbols you were counting on not to be available. In 4.0, it's less important, though it opens some possibility of symbol clashes, which, BTW are easily resolvable, unlike the order of inclusion issues in 3.1.
I cannot see any fact that support that claim, quite the contrary.
Yes, I pointed this out already above [that you can't see why it is true]. Consider, for instance, your preferred paradigm of having a library rely on symbols defined in another symbol, but not including that file. This requires that those symbols be created before that file is included and parsed. If that happens later, the code is broken. QED
- The re-usability of code is not reduced at all. You can still use this paradigm as before, using global symbols. It's still a broken way of doing things. You can get the same effect by exposing an API for the users of your library to use. This would be like requiring win32lib users to make their event handlers global, and to have win32lib call them directly.
You limit yourself to the library - main app paradigm. It is certainly not the only possible one for larger apps.
I'm not sure what you mean here. But I was referring, generally, to the practice of using third party code in some other piece of code. The code in question could be designed to be a library itself, so that users of the new library would be using libraries that use libraries, and possibly multiple such libraries.
But the important point is that to the end user, the library is a black box. He includes the library into his project, and uses the API provided by the author of the library. And here's the important part: the library works like it's supposed to, no matter what other libraries are used, or in which order they are included into the project. You've chosen a particularly problematic way to do this, since it's fragile to things like namespace conflicts, and doesn't necessarily play nicely with other libraries.
Matt
58. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 12, 2009
- 1350 views
Hi Chris,
actually I do not quite understand you. I once wrote to you that this quarrel is academic and that there are more ways to reach a goal. Many ways lead to Rome. If I report a problem then because I use Eu 4.0, because it is alpha, because I do not find a workaround for myself and because I trust into the development team. If I had your knowledge and your capabilities I would try to offer a solution myself. Really.
I did, but ayatollah Matt & Jeremy said there was nothing to discuss.
Chris, we discussed this a lot. We discussed it until everyone but you agreed.
Most Eu coders are happy to have had time to write code that eventually works. When the compatibility breakage goes beyond cosmetic changes like variable names, it is quite unreasonable to ask them to rewrite, as the code organisation itself may be affected. The coder base is simply not large enough for the luxury you suggest. Perl could do it, not Eu.
Well, this is mainly what we have in the case of euphoria 4.0. You keep mentioning things that structurally break most 3.1 code. There are a few cases where this might be true due to reliance on global symbols and parsing order, I believe they are quite rare, and easily fixed.
You're a long way from convincing anyone who has knowledge of 4.0 that we're all going to have to do major overhauls of our code due to the change to scoping and forward referencing. The new standard library will perhaps be the most difficult part, and even that shouldn't be too difficult.
Other languages do this neither with their versions. To port programs from 3.1.1 to 4.0 you have to change some keywords anyway. (label, entry, continue, switch, break). I will not use global with Eu 4.0.
As I said, a 10 minute nearly automated change process is acceptable, I think. You cannot get past it anyway, or not easily. Changing the semantics of the language is a completely different story.
Please stop trying to propagate ignorance.
And to be honest I would deprecate the use of global in Eu4.0 at all. Using the public and export keywords seem to be the better strategy to test and maintain separate modules / libraries. I do run my include files with exw/exwc to see if there are error messages. And although I like IDE and Win32lib they are also good examples in my opinion that they could be improved in Eu 4.0 only by using public and export. This would lead to a different structure of the include files, but I think this would also help to test and maintain the individual modules more effectively.
Why deprecate global? It has very legitimate uses. But alternative schemes should be provided so that it becomes useful only for special cases, just like goto.
The global scope could possibly bail you out like goto. Though I'm not sure it's even that useful. It does allow some dangerous coding practices, so it certainly allows the shooting of one's foot like goto does.
Matt
59. Re: Euphoria vs. other programming languages
- Posted by jimcbrown (admin) Mar 12, 2009
- 1349 views
Inclusion of libraries happens usually at the top of the main file, because they are used almost from that point on, specially if they require some initialization.
For subfiles, ie files you include so as to split up your own code into moe manageable chnks, I don't think this is so clear cut. It is clearer to declare a variable or a file close to the point it is used.
This has never been the case for me. This appears to be a rare practice.
Not true.
file1.e includes file2.e file2.e includes file3.e file3.e includes file4.e
Identifier x is defined as public in file4.e . Where is it seen from? You have to follow th chain of public inclusions to guess whether it is visible in file1.e or not.
global was more straightforward, as you need only grep or similar utility. Some symbols must have less broad a scope, of course, but public is clearly not a good answer to the issue.
Assuming file1.e is the main file that I am editing, why do i care that file2/3 have x?
If i want to use x in file1.e I should include file4.e in file1.e anyways. I should not rely on file2.e including file1.e for me, or any other automagic.
Not true again.
If you expand the visibility of some symbol in a deeply nested file, by adding another public qualifier to an include statement, you change the visibility of all symbols in that file. Not really the desired effect sometimes.
Right, public include is not meant to be used to expand the visible scope of a single symbol. public include isn't meant to be used outside libraries, and only then to allow a single file to expose all the public symbols in the library (regardless of which files originally declare the public symbols) - in effect allowing you to turn a huge 1-file library into a set of more managable smaller files.
public include's can be deeply nested, but this is as bad a practice as using global. public include should only be used in the main api file of the library (the one that is included to get access to all the routines of the library) and not elsewhere. Even in this usage, the public include should be limited to one leve.
Problem not solved, since redefining other global symbols - from instance from the standard library - was just as common as redefinng builtins.
What does that have to do with anything?
Yes, they are. Declare before use had been one of the strength of the language.
Note that I only agree to "forward references are bad in general". With proper restrictions, they are handy but yet not too harmful. And forward referencing is obviously needed, if only to remove the need for cyclic inclusions.
But you digress.
We have different faiths it seems. In large programs, this is very unpractical.
Why?
Any small library will be one file, which when included directly in the main app, there is little functional difference between global or public.
Any significantly large multi-file library will exposes all public symbols in the api file, which the main app can pretend is a single file library.
If you are lazy, you can include everything at once in a getitall.e and then public include getitall.e - this is bad practice, however.
Not always and not in an easy to trace manner, see above.
Only if the ancestor file declares a symbol in public scope AND that symbol is still visible by the time we get to the usage.
In 3.1, this problem still existed if both symbols were global, only we got an error message because 3.1 wasn't smart enough to figure out which symbol to use.
In 3.1, this problem still existed if the file had a local symbol with the same name.
Which, for the global vs global case, was requried for 3.1 as well.
Agreed. forward referencing changed how the global keyword works. This is a good reason for all major libraries to change to the new public keyword instead.
60. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 12, 2009
- 1371 views
CChris, in your own [preferred!] coding style, you had files that used variables in files that you never included in any way, shape or form, but required the file that included them to have defined the file. I seriously don't understand how you can claim to be interested in maintainability.
The coding style should reflect, as much as possible, the intended code and data flow. So, if some structure fits the bill, it is more maintainable because it is understood more easily and is less likely to have bugs in the first place.
To be clear here (because I'm sure there are readers that aren't aware of what you're talking about), the 'structure' we're discussing is where there is a library that relies on the application using it to define certain globals, and then use those symbols.
Not true. What I describe is NOT a library, but rather a plugin, optional component, removable component, call it as you like. It is NOT the black box that a third party library ideally is.
Of course, if multiple symbols match, you're SOL, without modifying the library. This sort of requirement to modify 3rd party code was a big driver behind the scope and inclusion changes in 4.0.
And I've yet to hear anyone but you argue it should be considered a good practice to write a source file that uses other source files where it does not express that dependency as an include file. This would be like a user writing a library that depended upon win32lib, but never included win32lib.
When a subfile defines an API, there is nothing wrong with that. Your example shows your utter lack of grasping the subject, since it concerns a totally different issue.
The point of a public symbol was for a library to expose its API this way, but still retain the ability to share other symbols amongst its files without exposing those by using the export scope. So you would assume that any source file that has included the library would be able to see all of the public symbols in that library. This seems extremely simple to me.
Another of your lies, Critic is right someimes.
The aim is to have parts of a program, either third party code or not, share symbols for others not to see, and also to allow symbols being seen everywhere even though they are not defined in the main source file.
Critic realized that we had a miscommunication. Please explain how I have lied, for apparently I have lied even to myself.
Even though you have my text right in front of your eyes, you make it say something completely different. I'm used to it, you've done it over and nauseatingly over before.
Saying something which is blatantly different from an easily available truth, for the some purpose of pretending to be right, i indeed lying. This doesn't eclude the fact that you may be lying to tyourself as well, I quite believe it actually. The two don't cancel out.
I can't see anything that I said above that contradicts this statement of yours. If you want the main file to do the 'heavy lifting' of including libraries, and avoid having to do that in other files that are part of the application, then simply use public include for your libraries, and have the sub files include main_app.ex, and you've got explicit inclusion there, without having to resort to globals.
which prevents reusing the subfiles with a parent of a different name, unless you edit them. Good job.
Really, most of your arguments come down to you being lazy, and believing that include statements are harmful to maintenance, not to mention too much effort.
As an application author, your concern is that you're using the library in question. And it's very easy to do that by putting include the_library.e in the source file. As the library author, you know that any source file that includes your library will be able to see your public symbols.
If you're relying on globals simply being in the same folder, then you still have to worry about inclusion order (in 3.1).
What is wrong with an inclusion order which shows in the simplest possible way which file uses which? Answer: i is too rigid and we have to deal with cyclic inclusions. That's where forward referencing helps on a case by xase basis.
The problem is that the inclusion order of a large set of source files can be a very fragile thing. And if some parts of your code rely on certain other parts, and if you have dependency cycles, then you've created additional maintenance to straighten out the dependency cycles.
Usually, cyclic dependenes arise because of only a few identifiers, less than a handful. In that case, an import <identifier> directive will indeed include the file, but (temporarily) hiding any unneeded public symbol. Parser won't choke on chicken and egg issues, and you still have mention of the file being relied upon. Much better conveying of the intent of the coder. [quote mattlewis]
One of the major benefits of the current design of forward referencing is that if you put include some_file.e in your code, then you can be assured that all symbols from some_file.e are available to the current file, without having to worry about dependency cycles. [/qote] and with terrible overhead, and multiplying the points to look at when the included library changes. Good job.
I really can't understand what your point is in bringing this up. Are you concerned at determining who can see a particular symbol from the perspective of that symbol?
Yes, because it becomes tricky and error prone to adjust it.
I agree, you are unable to comprehend it.
Yes, I left out the parsed before issue. But this is an important point, so thanks for bringing my attention to it. Strange order of inclusion issues can easily trip you up in 3.1, causing global symbols you were counting on not to be available. In 4.0, it's less important, though it opens some possibility of symbol clashes, which, BTW are easily resolvable, unlike the order of inclusion issues in 3.1.
I cannot see any fact that support that claim, quite the contrary.
Yes, I pointed this out already above [that you can't see why it is true]. Consider, for instance, your preferred paradigm of having a library rely on symbols defined in another symbol, but not including that file. This requires that those symbols be created before that file is included and parsed. If that happens later, the code is broken. QED
That's why an import directive is useful for - more on this later.
- The re-usability of code is not reduced at all. You can still use this paradigm as before, using global symbols. It's still a broken way of doing things. You can get the same effect by exposing an API for the users of your library to use. This would be like requiring win32lib users to make their event handlers global, and to have win32lib call them directly.
You limit yourself to the library - main app paradigm. It is certainly not the only possible one for larger apps.
I'm not sure what you mean here. But I was referring, generally, to the practice of using third party code in some other piece of code. The code in question could be designed to be a library itself, so that users of the new library would be using libraries that use libraries, and possibly multiple such libraries.
But the important point is that to the end user, the library is a black box. He includes the library into his project, and uses the API provided by the author of the library. And here's the important part: the library works like it's supposed to, no matter what other libraries are used, or in which order they are included into the project. You've chosen a particularly problematic way to do this, since it's fragile to things like namespace conflicts, and doesn't necessarily play nicely with other libraries.
Matt
61. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 12, 2009
- 1328 views
Hi Chris,
actually I do not quite understand you. I once wrote to you that this quarrel is academic and that there are more ways to reach a goal. Many ways lead to Rome. If I report a problem then because I use Eu 4.0, because it is alpha, because I do not find a workaround for myself and because I trust into the development team. If I had your knowledge and your capabilities I would try to offer a solution myself. Really.
I did, but ayatollah Matt & Jeremy said there was nothing to discuss.
Chris, we discussed this a lot. We discussed it until everyone but you agreed.
The inclusion system was discussed, not the forward referencing.
Most Eu coders are happy to have had time to write code that eventually works. When the compatibility breakage goes beyond cosmetic changes like variable names, it is quite unreasonable to ask them to rewrite, as the code organisation itself may be affected. The coder base is simply not large enough for the luxury you suggest. Perl could do it, not Eu.
Well, this is mainly what we have in the case of euphoria 4.0. You keep mentioning things that structurally break most 3.1 code. There are a few cases where this might be true due to reliance on global symbols and parsing order, I believe they are quite rare, and easily fixed.
You're a long way from convincing anyone who has knowledge of 4.0 that we're all going to have to do major overhauls of our code due to the change to scoping and forward referencing. The new standard library will perhaps be the most difficult part, and even that shouldn't be too difficult.
There are certainly easier to use alternatives, in other languages. I'm not referring to C or Java here.
Other languages do this neither with their versions. To port programs from 3.1.1 to 4.0 you have to change some keywords anyway. (label, entry, continue, switch, break). I will not use global with Eu 4.0.
As I said, a 10 minute nearly automated change process is acceptable, I think. You cannot get past it anyway, or not easily. Changing the semantics of the language is a completely different story.
Please stop trying to propagate ignorance.
And to be honest I would deprecate the use of global in Eu4.0 at all. Using the public and export keywords seem to be the better strategy to test and maintain separate modules / libraries. I do run my include files with exw/exwc to see if there are error messages. And although I like IDE and Win32lib they are also good examples in my opinion that they could be improved in Eu 4.0 only by using public and export. This would lead to a different structure of the include files, but I think this would also help to test and maintain the individual modules more effectively.
Why deprecate global? It has very legitimate uses. But alternative schemes should be provided so that it becomes useful only for special cases, just like goto.
The global scope could possibly bail you out like goto. Though I'm not sure it's even that useful. It does allow some dangerous coding practices, so it certainly allows the shooting of one's foot like goto does.
Matt
CChris
62. Re: Euphoria vs. other programming languages
- Posted by CChris Mar 12, 2009
- 1364 views
Inclusion of libraries happens usually at the top of the main file, because they are used almost from that point on, specially if they require some initialization.
For subfiles, ie files you include so as to split up your own code into moe manageable chnks, I don't think this is so clear cut. It is clearer to declare a variable or a file close to the point it is used.
This has never been the case for me. This appears to be a rare practice.
Not true.
file1.e includes file2.e file2.e includes file3.e file3.e includes file4.e
Identifier x is defined as public in file4.e . Where is it seen from? You have to follow th chain of public inclusions to guess whether it is visible in file1.e or not.
global was more straightforward, as you need only grep or similar utility. Some symbols must have less broad a scope, of course, but public is clearly not a good answer to the issue.
Assuming file1.e is the main file that I am editing, why do i care that file2/3 have x?
If i want to use x in file1.e I should include file4.e in file1.e anyways. I should not rely on file2.e including file1.e for me, or any other automagic.
So, if x was in file3.e and was then moved to file4.e, you want to review all your code? You'll understand that O don't quite agree to this being good for maintainance.
Not true again.
If you expand the visibility of some symbol in a deeply nested file, by adding another public qualifier to an include statement, you change the visibility of all symbols in that file. Not really the desired effect sometimes.
Right, public include is not meant to be used to expand the visible scope of a single symbol. public include isn't meant to be used outside libraries, and only then to allow a single file to expose all the public symbols in the library (regardless of which files originally declare the public symbols) - in effect allowing you to turn a huge 1-file library into a set of more managable smaller files.
public include's can be deeply nested, but this is as bad a practice as using global. public include should only be used in the main api file of the library (the one that is included to get access to all the routines of the library) and not elsewhere. Even in this usage, the public include should be limited to one leve.
In a nutshell, it is not very useful, and has been overadvertised as solving isssues it doesn't.
Problem not solved, since redefining other global symbols - from instance from the standard library - was just as common as redefinng builtins.
What does that have to do with anything?
You claim that a problem is soved by emphasizing that a possibly small part was solved.
Yes, they are. Declare before use had been one of the strength of the language.
Note that I only agree to "forward references are bad in general". With proper restrictions, they are handy but yet not too harmful. And forward referencing is obviously needed, if only to remove the need for cyclic inclusions.
But you digress.
Nope, you may get it when I post my alternate system. This was delayed because of the frum being down or a few hours recently.
We have different faiths it seems. In large programs, this is very unpractical.
Why?
Any small library will be one file, which when included directly in the main app, there is little functional difference between global or public.
Agreed
Any significantly large multi-file library will exposes all public symbols in the api file, which the main app can pretend is a single file library.
What is "the API file"? Exposed identifiers may be defined in any subunit of the library, and which file it is might change without notice.
If you are lazy, you can include everything at once in a getitall.e and then public include getitall.e - this is bad practice, however.
LLet me rebutt this with a single example. In win32lib, the getDC() function, which is used extensively, is defined in w32resources.ew, which win32lib.ew includes. Now, don't expect anything to work if you just include that file.
Not always and not in an easy to trace manner, see above.
Only if the ancestor file declares a symbol in public scope AND that symbol is still visible by the time we get to the usage.
In 3.1, this problem still existed if both symbols were global, only we got an error message because 3.1 wasn't smart enough to figure out which symbol to use.
In 3.1, this problem still existed if the file had a local symbol with the same name.
Which, for the global vs global case, was requried for 3.1 as well.
Agreed. forward referencing changed how the global keyword works. This is a good reason for all major libraries to change to the new public keyword instead.
A good code breaker for no benefit, you mean.
CChris
63. Re: Euphoria vs. other programming languages
- Posted by jimcbrown (admin) Mar 12, 2009
- 1355 views
[quote CChris]
Inclusion of libraries happens usually at the top of the main file, because they are used almost from that point on, specially if they require some initialization.
For subfiles, ie files you include so as to split up your own code into moe manageable chnks, I don't think this is so clear cut. It is clearer to declare a variable or a file close to the point it is used.
This has never been the case for me. This appears to be a rare practice.
Why quote me if you aren't going to respond?
So, if x was in file3.e and was then moved to file4.e, you want to review all your code? You'll understand that O don't quite agree to this being good for maintainance.
grep makes this easy.
In a nutshell, it is not very useful, and has been overadvertised as solving isssues it doesn't.
I never claimed this. In fact, see below. (Granted, 'public' alone isn't enough to solve the issues, but combined with other eu 4.0 changes the issues are fully resolved.)
You claim that a problem is soved by emphasizing that a possibly small part was solved.
This is true. If you replace all global symbols with public symbols, then the risk of a conflict goes down significantly.
Basically, the most likely conflict between public symbols will occur when you wish to use two public symbols with the same name in the same file. Otherwise, you almost never have that confusion.
In the event that you do in fact want to do the above, this is a namespacing issue. This issue was treated separately, but it works.
So now that I've emphasized the other part, we see that the problem is solved.
Nope, you may get it when I post my alternate system. This was delayed because of the frum being down or a few hours recently.
Since the public scope and 4.0's forward referencing a) are not related to each other and b) have been implemented separately from each other - the only way I see this making sense is if you are against the entirety of changes in 4.0 as a systematic whole.
Which isn't necessarily a bad thing. Especially if you have an alternative system that a) is implemented and b) the implementation works.
What is "the API file"? Exposed identifiers may be defined in any subunit of the library, and which file it is might change without notice.
um...without notice?! If the library author moves public symbol jc from file jha.e to jba.e, the author will still update the includes for mainapilib.e so that including mainapilib.e gets you jc.
LLet me rebutt this with a single example. In win32lib, the getDC() function, which is used extensively, is defined in w32resources.ew, which win32lib.ew includes. Now, don't expect anything to work if you just include that file.
This rebutts nothing. getitall.e should be including win32lib.ew to get the getDC symbol. I have no idea why you mention the idea of including w32resources.ew directly instead of including win32lib.ew
A good code breaker for no benefit, you mean.
CChris
Well... since global is left in for compatibility purposes only, in principle we should probably omit global symbols from being forward referenced. This is a minor detail however, if the goal is to replace all use of global with public (so its probably not worth the effort of changing the internals of eu to make that work).
64. Re: Euphoria vs. other programming languages
- Posted by DerekParnell (admin) Mar 12, 2009
- 1310 views
Another of your lies, Critic is right someimes.
I did, but ayatollah Matt & Jeremy ...
Christian,
how is inflamatory language going to help you or anyone else here?
This discussion about include file philosophy comes down to a difference of opinion. You have a specific opinion about what constitutes good programming practice and the current development team has a different opinion. As you well know, before you left the team, discussions amongst us all went on for what seemed like months about this issue. A number of ideas were tried out and what we have now is, IMO, the best outcome of all those discussions and experiments. Sure, I still think we could have done it a bit differently, but not all my suggestions were endorsed by the group as a whole. I got over it.
The language still has global so you are free to continue using your coding style in your libraries. And in just the same way, the development team has standardized on an include file coding style which has been demonstrated in the new standard library. No one is trying to force you to use a particular coding style in your own code.
My take on how we got to the new position is based on what problems we were trying to solve. They included ...
- How do we avoid name clashes with symbols that are exposed from a module (file)?
- How do we help code readers understand file inter-dependancies?
- How do we enable coders to group together related routines?
In v3 Euphoria, there is only one way to expose a symbol - use the global scope attribute. This meant that the probability of clashes between independantly written libraries is high. Further more, in some cases (include topologies), the only way to resolve a clash was to edit the source code of a third-party library. This 'resolution' could break at any time whenever a new release of that edited library was made, which of course was out of one's control.
Because the global scope is pervasive, one can include a file, say "A.E" that can include any number of other files, which in turn can include any number of still further files, etc, etc, etc... And a global symbol at the deepest nesting level can still be used in your application. On the surface, this seems like a handy time saver. You are not obliged to know in which particular file that symbol has been declared in. In fact, you'd probably have to use a 'grep' like tool to find it. This technique also means that you are not necessarily aware of your application's dependancy on the file that actually declares that global symbol.
In v4, we decided to make a simple rule to help us be aware of which files a given file was dependant on: If a file needs to use a symbol that has been declared in a standard library file, then it must explicitly include that standard library file.
To enable this rule to work, we came up with the public scope attribute. This is used instead of global to expose a symbol. The difference is that is only exposes the symbol to files that explicitly include it and no further up the include tree. This means that if "A" includes "B", and "B" includes "C", then "A" cannot see the public symbols declared inside "C". Of course, "A" can see "B"'s public symbols and "B" can see "C"'s public symbols.
This however gave as a new situation. When a library is huge, it is often broken into smaller sub-library files for maintenance/management reasons. Conceptually though, these sub-files are still part of a single library. It can be thought of as a multi-file library. But if an application includes the top-level library file (eg. win32lib) and that library file actually includes sub-library files in which public symbols are declared (intended for the application to use) it means that the application can't see them. This is a situation in which we need to propagate the exposed symbols from one level below a file to one level above the file. In other words, public symbols declared in a file that is included by win32lib, need to be made visible to the application that include win32lib.
This is achieved by having win32lib do a public include of its sub-library files. This is totally transparent to the application because conceptually, win32lib is the library file in which the exposed API is declared. So, from the point of view of the application, it needs to use a symbol from the win32lib library so it explicitly includes win32lib. This gives the application writer a consistant approach and frees the library writer to manage the multi-file library without breaking applications.
Having a multi-file library should make it easier for the library writer to organize the placement of routines so that related routines are near each other. This is a maintenance time-saver. However, in v3 Euphoria, this was not always possible due to the idea that code could only refer to other symbols that were 'above'. This meant that the physical placement of routines overrode the logical placement of routines. In large libraries, this could lead to situations were related routines are in different files, or widely separated in the same file. It also meant that a change to one routine's code might also mean you need to relocate that routine to get it to work again. The net result is the fragmentation of your library, which doesn't help readers or maintenance coding. The other technique to overcome this limitation is to use the routine_id() concept, but this comes with a performance overhead.
In v4, the limitation of where routines are placed has been lifted. One is no longer constrained to an artificial physical layout of code in order to get routines to 'see' each other. Instead, one can now group together related pieces of code.
Not all name clashes are resolved with public though. If two included files both declare the same exposed symbol name, your application needs a way to tell Euphoria which one you are referencing. This is done using the namespace concept. Each included file can have a namespace associated with it. This is just a name that you give to the file so you can qualify references to exposed symbols from that file. For example...
include foo.e as A include bar.e as B if A:func() = B:func() then ...
In this case, both foo.e and bar.e declare an exposed symbol called 'func'. For Euphoria to know which 'func' you mean to use, you need to tell it via the namespace id. In this example, the namespace we gave to foo.e is 'A', and to bar.e is 'B'.
Actually, if the library writer has been on the ball, they would have given their files default namespaces and documented them of course too. For example ...
-- foo.e -- namespace foo public function func() ... end function -----
-- bar.e -- namespace bar public function func() ... end function -----
Then the application could have been written ...
include foo.e include bar.e if foo:func() = bar:func() then ...
Note that these are default namespaces. You can still override them by using the "as" clause, if you want to.
65. Re: Euphoria vs. other programming languages
- Posted by euphoric (admin) Mar 12, 2009
- 1353 views
This discussion about include file philosophy comes down to a difference of opinion.
Wow. Great elucidation Derek! This should be in the Wiki or Documentation...
66. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 12, 2009
- 1393 views
To be clear here (because I'm sure there are readers that aren't aware of what you're talking about), the 'structure' we're discussing is where there is a library that relies on the application using it to define certain globals, and then use those symbols.
Not true. What I describe is NOT a library, but rather a plugin, optional component, removable component, call it as you like. It is NOT the black box that a third party library ideally is.
No, I understand what you're doing. I'm saying you're doing it wrong. It's generally called dependency injection or possibly inversion of control.
I can't see anything that I said above that contradicts this statement of yours. If you want the main file to do the 'heavy lifting' of including libraries, and avoid having to do that in other files that are part of the application, then simply use public include for your libraries, and have the sub files include main_app.ex, and you've got explicit inclusion there, without having to resort to globals.
which prevents reusing the subfiles with a parent of a different name, unless you edit them. Good job.
Yes, I am explicitly saying don't do this. It is really bad practice. There is a better way to get the same effect. See the links I provided above. I'll repeat: You're doing it wrong.
The problem is that the inclusion order of a large set of source files can be a very fragile thing. And if some parts of your code rely on certain other parts, and if you have dependency cycles, then you've created additional maintenance to straighten out the dependency cycles.
Usually, cyclic dependenes arise because of only a few identifiers, less than a handful. In that case, an import <identifier> directive will indeed include the file, but (temporarily) hiding any unneeded public symbol. Parser won't choke on chicken and egg issues, and you still have mention of the file being relied upon. Much better conveying of the intent of the coder.
Yes, something like that could work. But again, it's fragile. You've added another point of maintenance that may need to be changed. The intent of the coder is perfectly conveyed by standard include directives, even though you don't believe in them.
One of the major benefits of the current design of forward referencing is that if you put include some_file.e in your code, then you can be assured that all symbols from some_file.e are available to the current file, without having to worry about dependency cycles.
and with terrible overhead, and multiplying the points to look at when the included library changes. Good job.
I'm not sure what you're referring to, but the best I can figure is the overhead in the parser. When files have properly declared their dependencies, it's not too bad. And well worth the effort for the application or library developer.
Yes, it was a good job.
Matt
67. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 12, 2009
- 1345 views
The inclusion system was discussed, not the forward referencing.
How can you say this with a straight face? You provided an implementation, and various developers (including me) asked you questions about it. You basically refused to answer some of our questions, and most of the other answers that you gave were basically unsatisfactory.
Meanwhile, we all discussed other options for forward referencing and came to a consensus after several proposals and revisions.
Matt
68. Re: Euphoria vs. other programming languages
- Posted by mattlewis (admin) Mar 12, 2009
- 1342 views
Assuming file1.e is the main file that I am editing, why do i care that file2/3 have x?
If i want to use x in file1.e I should include file4.e in file1.e anyways. I should not rely on file2.e including file1.e for me, or any other automagic.
So, if x was in file3.e and was then moved to file4.e, you want to review all your code? You'll understand that O don't quite agree to this being good for maintainance.
I don't know who 'O' is, but presumably there was a good reason for moving it that made sense. In that case, yes, I would expect you to do this, or at least try running the code to see who can't see it. Are you suggesting that you often move things around in files without thinking of the consequences?
If you think of your files as semi-independent modules, this all makes sense. If you simply see them as a way to keep any one file from growing too large, then you probably have bigger problems maintaining your software.
In a nutshell, [public include] is not very useful, and has been overadvertised as solving isssues it doesn't.
I disagree. It solves precisely the issues it was meant to solve. And by that I mean it gives authors of multi-file libraries the flexibility to share some symbols only amongst the library itself, and to share other symbols within and without the library, all without polluting the global namespace.
What problems do you believe are being over advertised?
Any significantly large multi-file library will exposes all public symbols in the api file, which the main app can pretend is a single file library.
What is "the API file"? Exposed identifiers may be defined in any subunit of the library, and which file it is might change without notice.
The API file would be considered as the main file in a library. Win32Lib.ew, for instance. In other words, whatever file your documentation tells users to include. So long as that file uses public include with any library files with publicly scoped symbols, the end user doesn't have to care about which sub file actually defines the symbol.
If you are lazy, you can include everything at once in a getitall.e and then public include getitall.e - this is bad practice, however.
Let me rebutt this with a single example. In win32lib, the getDC() function, which is used extensively, is defined in w32resources.ew, which win32lib.ew includes. Now, don't expect anything to work if you just include that file.
Why would we? Is that file documented? To my knowledge, users are told to include win32lib.ew. This example doesn't rebut anything, but shows that you should use a library the way the author intended, or you're on your own, and some things probably won't work.
Only if the ancestor file declares a symbol in public scope AND that symbol is still visible by the time we get to the usage.
In 3.1, this problem still existed if both symbols were global, only we got an error message because 3.1 wasn't smart enough to figure out which symbol to use.
In 3.1, this problem still existed if the file had a local symbol with the same name.
Which, for the global vs global case, was requried for 3.1 as well.
Agreed. forward referencing changed how the global keyword works. This is a good reason for all major libraries to change to the new public keyword instead.
A good code breaker for no benefit, you mean.
Most code won't even break due to these changes. And there is plenty of benefit, even if you can't comprehend it.
Matt
69. Re: Euphoria vs. other programming languages
- Posted by jeremy (admin) Mar 12, 2009
- 1403 views
... SNIP ...
No, I understand what you're doing. I'm saying you're doing it wrong.
... SNIP ...
Yes, I am explicitly saying don't do this. It is really bad practice. ... I'll repeat: You're doing it wrong.
I think he means: You're Doing It Wrong!
Jeremy