1. Too many namespaces

Forked from Re: Don't understand manual.

SDPringle said...
DonCole said...

Hello Everybody,

English being my native language, I don't understand this.

From the manual:

If the keyword public precedes the declaration, the scope extends to any file that explicitly includes the file in which the identifier is declared, or to any file that includes a file that in turn public includes the file containing the public declaration.

Don Cole

The phrase, 'public include' is not a verb. Those of us who worked to develop this can be poor at explaining the new syntax.

Shawn Pringle

Having looked at the cutting up of the baseline modules (i.e. creation of Namespaces) in version 4, I can't help thinking that too many namespaces are unnecessary and probably counter productive. I am looking at the situation based on current hardware, where 16 GB CPU attached RAM is becoming the standard in desktops, USB storage is 2GB per dollar, SSD is under $100 for 128 GB and 1 TB SATA drive costs $70. Perhaps it is a requirement of the way C language handles (or cannot handle) things. I have worked for a while with the non namespace version of wxeu of Matt and see no problems or delays in execution of fairly large code.

It seems to me that an effort should be made to coalesce various independent "modules" of the baseline Euphoria and settle for 3-5 namespaces, if you must have namespaces. I know the battle of namespaces vs no namespaces must have been fought in the past; I am not attempting to restart the battle, but rather to look at the enormous hardware progress since the decision was made to go namespaces route. The only advantage I see at present of retaining the current numerous namespaces is the advent of connections to Android.

Some developers would argue that they cannot remember too many names of constants, etc., etc. This can be addressed at the .e level and .ex level with use of appropriate two letter prefixes on constants and on program name.

new topic     » topic index » view message » categorize

2. Re: Too many namespaces

Euphoria 4 could have been designed with far fewer namespaces than it currently has. But what evidence do we have that this has a significant impact on memory usage, performance, or useability? At present each include file has it's own namespace. To me this is quite natural, easily understood, and solves the problems they were designed to solve. I don't see how a smaller number would serve the purpose, at least not without great difficulty.

Changing this now would break many existing applications. This could be justified only if there was a truly compelling need. I don't see such a need.

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

3. Re: Too many namespaces

EUWX said...

Having looked at the cutting up of the baseline modules (i.e. creation of Namespaces) in version 4, I can't help thinking that too many namespaces are unnecessary and probably counter productive. I am looking at the situation based on current hardware, where 16 GB CPU attached RAM is becoming the standard in desktops, USB storage is 2GB per dollar, SSD is under $100 for 128 GB and 1 TB SATA drive costs $70. Perhaps it is a requirement of the way C language handles (or cannot handle) things. I have worked for a while with the non namespace version of wxeu of Matt and see no problems or delays in execution of fairly large code.

Namespaces aren't there for performance. They're there to prevent having to create names that are future proofed to be unique. That's pretty much impossible.

EUWX said...

It seems to me that an effort should be made to coalesce various independent "modules" of the baseline Euphoria and settle for 3-5 namespaces, if you must have namespaces. I know the battle of namespaces vs no namespaces must have been fought in the past; I am not attempting to restart the battle, but rather to look at the enormous hardware progress since the decision was made to go namespaces route. The only advantage I see at present of retaining the current numerous namespaces is the advent of connections to Android.

I can't see what the benefit of this would be, or how any of this relates at all to Android or anything hardware related.

EUWX said...

Some developers would argue that they cannot remember too many names of constants, etc., etc. This can be addressed at the .e level and .ex level with use of appropriate two letter prefixes on constants and on program name.

The prefixes are problematic. What happens when two library authors choose the same two letters? Using namespaces is an elegant way to solve this problem. They really only need to be used when there is a conflict. But when there is a conflict, the solution is quick and easy, and you never have to touch 3rd party code.

Matt

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

4. Re: Too many namespaces

EUWX said...

... I can't help thinking that too many namespaces are unnecessary and probably counter productive. I am looking at the situation based on current hardware...

Maybe you don't understand the namespace concept. They have nothing whatsoever to do with runtime performance.

EUWX said...

Some developers would argue that they cannot remember too many names of constants, etc., etc. This can be addressed at the .e level and .ex level with use of appropriate two letter prefixes on constants and on program name.

prefixes used this way are actually a type of namespace. Except that they are hard-coded and thus cannot be modified easily if the situation demands it. The Euphoria namespace is a method of allowing the use of flexible (and optional) prefixing.

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

5. Re: Too many namespaces

DerekParnell said...
EUWX said...

... I can't help thinking that too many namespaces are unnecessary and probably counter productive. I am looking at the situation based on current hardware...

Maybe you don't understand the namespace concept. They have nothing whatsoever to do with runtime performance.

I do not recall making any attempt at claiming better or worse runtime performance with the use of namespaces.
The concept of being able to create a variable name in my application program without worrying about the same name being already there in a pre-existing module I am going to use, is a luxury that the namespace concept denies the application programmer.

DerekParnell said...
EUWX said...

Some developers would argue that they cannot remember too many names of constants, etc., etc. This can be addressed at the .e level and .ex level with use of appropriate two letter prefixes on constants and on program name.

prefixes used this way are actually a type of namespace. Except that they are hard-coded and thus cannot be modified easily if the situation demands it. The Euphoria namespace is a method of allowing the use of flexible (and optional) prefixing.

A constant declared and used in a low level (i.e. at the level of .e and now with GUI at the level of .ex) should not have to be "modified easily if the situation demands it". If an application programmer wants to modify it, he should first define (myname = includeprog:incname) and then use and modify "myname" ad lib.

However, you have missed the whole point of my argument.
There was a need in the past that the "library" with which the application programmer was working need not be all present in the final exe, and Euphoria addresses this extremely well. But look at the huge libraries and dlls people are working with now. A monolithic unalterable library of functions automatically a part of the final application is not particularly memory hogging by today's availability of memory. There is absolutely no need to discard unused functions when creating a final executable or even running Euphoria as interpreter - not from the point of memory needs nor from the point of better speed of execution. Once one understands this fundamental change in the hardware and the enormously increased speed of CPU, the need for 50 namespaces can probably be condensed to 4 or 1.

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

6. Re: Too many namespaces

mattlewis said...
EUWX said...

Having looked at the cutting up of the baseline modules (i.e. creation of Namespaces) in version 4, I can't help thinking that too many namespaces are unnecessary and probably counter productive. I am looking at the situation based on current hardware, where 16 GB CPU attached RAM is becoming the standard in desktops, USB storage is 2GB per dollar, SSD is under $100 for 128 GB and 1 TB SATA drive costs $70. Perhaps it is a requirement of the way C language handles (or cannot handle) things. I have worked for a while with the non namespace version of wxeu of Matt and see no problems or delays in execution of fairly large code.

Namespaces aren't there for performance. They're there to prevent having to create names that are future proofed to be unique. That's pretty much impossible.

I did not suggest that Namespaces were there for performance. I merely suggest that the application programmer should not have to worry at all
1. about duplicating a name that exists in a module he is going to use; 2. about using explicitly a name in the Euphoria library, which he knows is most probably there and would have a prefix he remebers. Preferably there should be only 1-6 prefixes and not 50-100 include_namespace: as there is at present.

mattlewis said...
EUWX said...

It seems to me that an effort should be made to coalesce various independent "modules" of the baseline Euphoria and settle for 3-5 namespaces, if you must have namespaces. I know the battle of namespaces vs no namespaces must have been fought in the past; I am not attempting to restart the battle, but rather to look at the enormous hardware progress since the decision was made to go namespaces route. The only advantage I see at present of retaining the current numerous namespaces is the advent of connections to Android.

I can't see what the benefit of this would be, or how any of this relates at all to Android or anything hardware related.

My caution about Android OS was only intended to separate those devices as still "inferior" in memory compared to desktop computers.

mattlewis said...
EUWX said...

Some developers would argue that they cannot remember too many names of constants, etc., etc. This can be addressed at the .e level and .ex level with use of appropriate two letter prefixes on constants and on program name.

The prefixes are problematic. What happens when two library authors choose the same two letters? Using namespaces is an elegant way to solve this problem. They really only need to be used when there is a conflict. But when there is a conflict, the solution is quick and easy, and you never have to touch 3rd party code.

Matt

Euphoia should have only one namespace or if needed, perhaps 3-5 namespaces. Over the years you have been incorporating good .e and .ex from various contributors; that is fine but they should become completely a part of Euphoria, and similar additions should be infrequent. Anything outside of that should be considered "having an affair" with somebody else's wife and the application programmer should suffer the consequence of philandering.
To continue with the analogy, if the application programmer wants to have this "affair" often, he should house that "girl friend" in separate accommodation, "re-dress" and "re-name" her, making her his special concubine. Euphoria's one or four wives (namespace(s)) would not be concerned with these concubines and the concubines would not have to worry about the wife (wives)

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

7. Re: Too many namespaces

EUWX said...

I do not recall making any attempt at claiming better or worse runtime performance with the use of namespaces.

Maybe not, but that's what you wrote.

EUWX said...

The concept of being able to create a variable name in my application program without worrying about the same name being already there in a pre-existing module I am going to use, is a luxury that the namespace concept denies the application programmer.

You have that backwards. Namespaces mean that you don't have to worry about naming conflicts like that, because there is an easy solution. And it's not a problem at all if you don't need to use the symbol in the library but only your local symbol.

EUWX said...
DerekParnell said...
EUWX said...

Some developers would argue that they cannot remember too many names of constants, etc., etc. This can be addressed at the .e level and .ex level with use of appropriate two letter prefixes on constants and on program name.

prefixes used this way are actually a type of namespace. Except that they are hard-coded and thus cannot be modified easily if the situation demands it. The Euphoria namespace is a method of allowing the use of flexible (and optional) prefixing.

A constant declared and used in a low level (i.e. at the level of .e and now with GUI at the level of .ex) should not have to be "modified easily if the situation demands it". If an application programmer wants to modify it, he should first define (myname = includeprog:incname) and then use and modify "myname" ad lib.

He means the naming. Again, if two libraries decide to use the same prefix, you have no choice but to modify one of those libraries. With namespaces, you can simply choose a different namespace for your file to use to address one of the libraries and be completely clear about what's going on, both to the programmer and to euphoria. And you only have to do this in places where it is a real problem. No other code is affected or needs to be changed.

EUWX said...

However, you have missed the whole point of my argument.
There was a need in the past that the "library" with which the application programmer was working need not be all present in the final exe, and Euphoria addresses this extremely well. But look at the huge libraries and dlls people are working with now. A monolithic unalterable library of functions automatically a part of the final application is not particularly memory hogging by today's availability of memory. There is absolutely no need to discard unused functions when creating a final executable or even running Euphoria as interpreter - not from the point of memory needs nor from the point of better speed of execution. Once one understands this fundamental change in the hardware and the enormously increased speed of CPU, the need for 50 namespaces can probably be condensed to 4 or 1.

And once again, even though supposedly this isn't your point, you're tying namespaces to hardware and performance. Although, to be fair, namespaces can somewhat improve parsing performance when they are used, because we are able to bind the symbols sooner and prevent later lookups.

Nevertheless, when interpreting, nothing is discarded. The binder does discard some things. You're possibly right that the performance gains are pretty minimal now, although the performance of ARM hardware tells me otherwise. The translator discards unused things and uses this information to help optimize code. None of this relates to namespaces in any meaningful way.

I'll repeat this again. The main benefit of namespaces are for the programmer. It makes using third party code and writing libraries easier.

Matt

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

8. Re: Too many namespaces

EUWX said...

I did not suggest that Namespaces were there for performance. I merely suggest that the application programmer should not have to worry at all
1. about duplicating a name that exists in a module he is going to use; 2. about using explicitly a name in the Euphoria library, which he knows is most probably there and would have a prefix he remebers. Preferably there should be only 1-6 prefixes and not 50-100 include_namespace: as there is at present.

You are contradicting yourself by requiring authors to make unique names. Reducing the number of prefixes makes this task harder.

EUWX said...

Euphoia should have only one namespace or if needed, perhaps 3-5 namespaces. Over the years you have been incorporating good .e and .ex from various contributors; that is fine but they should become completely a part of Euphoria, and similar additions should be infrequent. Anything outside of that should be considered "having an affair" with somebody else's wife and the application programmer should suffer the consequence of philandering.
To continue with the analogy, if the application programmer wants to have this "affair" often, he should house that "girl friend" in separate accommodation, "re-dress" and "re-name" her, making her his special concubine. Euphoria's one or four wives (namespace(s)) would not be concerned with these concubines and the concubines would not have to worry about the wife (wives)

WTF are you talking about? Again, you contradict yourself by suggesting a solution that makes the problem worse. Namespaces accomplish exactly what you claim to value, so I can't understand why you want to go backward and make this more difficult.

And from what bodily orifice did you pull "3-5 namespaces?" What would they be? Would you arbitrarily group things together that have nothing in common? Have you actually taken a look at the standard library? It doesn't sound like you have.

Matt

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

9. Re: Too many namespaces

Matt:
You have your own example you worked with for quite a while.
You used wxWidgets.
All the constants there have a prefix wx
In your version 16 of wxEuphoria, the whole .dll becomes memory resident. That means you got the file functions of wxWidgets which Euphoria already has and therefore, does not need. Yet using the dll, you are using that extra memory for a facility of wxWidgets you do not need. And there are many more facilities in wxWidgets which are duplicates of or similar to existing Euphoria facilities.
I have used comfortably your monolithic version of wxeu for GUI and not used the file functions therein, because I am using the Euphoria's "native" file functions. No problem there. Look at some other libraries; you will find that people have taken the same approach of using a relevant prefix.

In a nutshell, all I am saying is that there should not be 50 or 100 namespaces in Euphoria, but only 3-5, perhaps 8. The extra memory usage would not be a significant problem now (unlike the situation at the turn of the Century). If there are some good .e and .ex wandering around in the rapideuphoria archive, incorporate them if they are half relevant but into and within existing namespaces and reduce the number of existing namespaces at the same time.

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

10. Re: Too many namespaces

EUWX said...

Matt:
You have your own example you worked with for quite a while.
You used wxWidgets.
All the constants there have a prefix wx

That comes from wxWidgets. I'd much rather have various controls broken up more so we didn't have to have ginormous names to prevent duplication. wxWidgets handles this by being C++ and having names being members of distinct classes. Namespaces provide the closest approximation of this, and using public symbols could even help mimic inheritance.

Doing this would make using the library easier and more elegant, but is a bit more difficult in some ways in maintaining the wrapper.

EUWX said...

In your version 16 of wxEuphoria, the whole .dll becomes memory resident. That means you got the file functions of wxWidgets which Euphoria already has and therefore, does not need. Yet using the dll, you are using that extra memory for a facility of wxWidgets you do not need. And there are many more facilities in wxWidgets which are duplicates of or similar to existing Euphoria facilities.

You keep talking about having everything be "memory resident." That may be an interesting discussion to have, but how does it relate to namespaces? Or namespaces to a dll?

EUWX said...

I have used comfortably your monolithic version of wxeu for GUI and not used the file functions therein, because I am using the Euphoria's "native" file functions. No problem there. Look at some other libraries; you will find that people have taken the same approach of using a relevant prefix.

In previous versions of euphoria, there was often no other way. The initial introduction of namespaces helped a bit. The current version of namespaces are a much more complete solution.

EUWX said...

In a nutshell, all I am saying is that there should not be 50 or 100 namespaces in Euphoria, but only 3-5, perhaps 8. The extra memory usage would not be a significant problem now (unlike the situation at the turn of the Century). If there are some good .e and .ex wandering around in the rapideuphoria archive, incorporate them if they are half relevant but into and within existing namespaces and reduce the number of existing namespaces at the same time.

You keep saying that there should be fewer namespaces, but you have no justification. You talk about memory consumption, but if anything, it's (slightly) higher with namespaces, since they are themselves symbols. So, aside from your wrong assumptions about memory, what advantage do you see in reducing the number of namespaces?

I count 63 default namespaces in the standard library. Of course, you are not forced to use any of these. Which do you propose to combine? How will this improve the life of a euphoria programmer?

Matt

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

11. Re: Too many namespaces

"Which do you propose to combine? How will this improve the life of a euphoria programmer?

Matt"

The following comes quickly to my mind.

A CPU has register to register instructions, Arithmetic instructions, registers/memory operations, memory/memory operations I/O, and branching.
A language has:
1. Maths,
2. I/O functions,
.... 2A. inc file functions and port addressing right up to Internet connection and networking,
.... 2B. fancy I/O to include Audio/video, etc
.... 2C. GUI because of the enormous size, to include text handling,
3. system inc. branching and OS related,
4. …. and miscellaneous.

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

12. Re: Too many namespaces

EUWX said...

"Which do you propose to combine? How will this improve the life of a euphoria programmer?

Matt"

The following comes quickly to my mind.

A CPU has register to register instructions, Arithmetic instructions, registers/memory operations, memory/memory operations I/O, and branching.
A language has:
1. Maths,
2. I/O functions,
.... 2A. inc file functions and port addressing right up to Internet connection and networking,
.... 2B. fancy I/O to include Audio/video, etc
.... 2C. GUI because of the enormous size, to include text handling,
3. system inc. branching and OS related,
4. …. and miscellaneous.

LOL: and miscellaneous.

Not gonna happen. That would be miserable. I note that you didn't even attempt to address how it would make a programmer's life better.

I would also add that we're not just talking about a language, which probably has a lot less than what you're talking about. We're talking about a standard library that has a lot of functionality.

Matt

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

13. Re: Too many namespaces

Prior to the introduction of namespaces Euphoria had a serious problem. Whenever a program used a third party include file there was always the possibility, and in the case of larger files, the likelyhood of a name clash. In many cases the only solution was to rename the clashing function, procedure, or other public symbol. This was tedious and error prone. Having multiple include files from different authors only compounded the problem. As an ideal a programmer should be able to treat an include file as a black box. It should never be necessary to even look at the files contents, let alone modify it.

Adding a prefix to public symbols was a viable but far from ideal solution. It greatly reduces the chances of a clash but doesn't really avoid them completely. Win32lib is a case in point. The code is littered with w32this and w32that, the only purpose being to avoid name clashes. It worked but wasn't what you would call elegant. But with Euphoria as then existed there really was no practical alternative.

Namespaces were a simple and elegant solution. Whenever there is a clash all a programmer needs to do is specify the namespace followed by the symbol name, as in "namespace:routinemame(). By default the namespace is the same as the name of the include file. If this produces a clash the programmer can override this name as necessary. Instead of trying to avoid the name clashes it provides the means of dealing with them. A programmer can use include files as they are without massaging them to avoid name clashes. An include file author can use names that fit their function instead of worrying about name clashes. Many other programming languages use similar methods.

I am not saying that namespaces are a perfect solution. In this imperfect world perfection is something that we strive for but never really achieved.

Using a namespace for each include fills the need. Having fewer namespaces would reduce the chances of a name clash but wouldn't avoid them. And at the same time it would add a few new ones.

But all of this is academic. Namespaces have existed in Euphoria 4.x for a long time and many applications rely on them as they currently exist. It would require a really compelling reason to change this now. To date no one has even come close to providing one.

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

14. Re: Too many namespaces

EUWX said...

I do not recall making any attempt at claiming better or worse runtime performance with the use of namespaces.
The concept of being able to create a variable name in my application program without worrying about the same name being already there in a pre-existing module I am going to use, is a luxury that the namespace concept denies the application programmer.

Ok ... at this point I'm believing that either you honestly do not understand what the namespace concept and implementation is all about, or you are trolling. In either case, it seems that I can't help you. Sorry.

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

15. Re: Too many namespaces

Namespaces themselves even predate 4.x, weren't they introduced with 3.11 or even earlier?

However, even then there were still occasional clashes.

The other piece of the puzzle, even if it is sometimes difficult to understand, is the fixes to the include mechanism as introduced in 4.x. With that, symbol clashes should be pretty rare.

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

16. Re: Too many namespaces

DerekParnell said...
EUWX said...

I do not recall making any attempt at claiming better or worse runtime performance with the use of namespaces.
The concept of being able to create a variable name in my application program without worrying about the same name being already there in a pre-existing module I am going to use, is a luxury that the namespace concept denies the application programmer.

Ok ... at this point I'm believing that either you honestly do not understand what the namespace concept and implementation is all about, or you are trolling. In either case, it seems that I can't help you. Sorry.

I am not trolling. Matt has not answered clearly; perhaps you can answer.
wxWidgets has windows Gui, Grid, file functions and others. Yet they have no namespaces which Matt had to worry about when he did his version 16. wxWidgets has all constants., etc with wx prefix.
When you can understand the reasoning behind their work, you will perhaps understand what I am talking about.
The place I forked this from was related to to problems generated by the use of Namespaces which deny convenient access to application programmer.
In the forum, there are a thousand such occurrences.

I have said enough, and it is obvious that you do not want to address your own faulty thinking of small programs for doing little things. Your thinking has not graduatedc to the existence of enormous memory which can and should be used in a way that helps the application programmer to use Euphoria.

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

17. Re: Too many namespaces

EUWX said...

I am not trolling. Matt has not answered clearly; perhaps you can answer.

I think I answered extremely clearly the questions that you wrote. I'm not sure you understand that the questions you asked or that the assertions you keep making are wrong.

EUWX said...

wxWidgets has windows Gui, Grid, file functions and others. Yet they have no namespaces which Matt had to worry about when he did his version 16. wxWidgets has all constants., etc with wx prefix.
When you can understand the reasoning behind their work, you will perhaps understand what I am talking about.
The place I forked this from was related to to problems generated by the use of Namespaces which deny convenient access to application programmer.
In the forum, there are a thousand such occurrences.

What's unclear is why you believe that namespaces make things less clear.

EUWX said...

I have said enough, and it is obvious that you do not want to address your own faulty thinking of small programs for doing little things. Your thinking has not graduatedc to the existence of enormous memory which can and should be used in a way that helps the application programmer to use Euphoria.

You are a very confused person, and obviously you're only interested in saying silly things. Please stop. Your questions have been answered. If you think some part of those answers is unclear, please quote it and tell us what you think is unclear. If you're going to keep nattering on about people not coming to grip with some irrelevant aspect of computer hardware or software, then please just stop.

Matt

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

18. Re: Too many namespaces

You ask: " tell us what you think is unclear"

I have already stated and asked that
1. wxWidgets as an example and many other MUCH MORE USED pieces of software do NOT have Namespaces where you have 50 in Euphoria Are those developers
- ALL OF THEM - WRONG?
2. wxWidgets as an example and many other MUCH MORE USED pieces of software settle for a nice 2-3 letter prefix for the needs I have identified before and the needs you already know about and Euphoria cannot have a similar way because in your opinion it would more confusing to the application developer.

You are trying to empirically justify 50 namespaces when other larger bodies of developers find one sufficient for their major and elaborate and much more used piece of work.
I am going to stop anyway now, whether or not you address these two issues, or justify your empirical stand of the need for 50 namespaces.
I am happy in the knowledge that other major C and C plus plus developers do not think of fragmenting their work in too many and mostly irrelevant Namespaces.

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

19. Re: Too many namespaces

Hi

Just to chip in.

So what we have so far is that namespaces avoid name clashes, make code reading easier, have very little memory overhead, make very little speed difference, and are optional. They have solved a lot of problems.

Personally, I only very rarely use them anyway (only when I have a clash)

I'm still using the global keyword for goodness sake. (don't remove it by the way!)

If you really have that much free time on your hands, copy the entire standard library into one uberfile, and rename any routines you need to. Euphoria is open source after all.

My point is not to be deliberately provocative, but just to demonstrate that Eu allows you the flexibility to do things as you want, whereas the much more used languages, in this respect, are quite a bit less flexible.

Chris

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

20. Re: Too many namespaces

EUWX said...

You ask: " tell us what you think is unclear"

I have already stated and asked that
1. wxWidgets as an example and many other MUCH MORE USED pieces of software do NOT have Namespaces where you have 50 in Euphoria Are those developers
- ALL OF THEM - WRONG?

I already pointed out that wxWidgets is C++, and so it uses classes. Which means that most of their symbols are inside of a class' scope. The problem is much different there. Though a lot of C++ people would tell you that they should have put their code inside of a namespace. C++ namespaces are a bit different than euphoria's, but the C++ standard library is inside of its own namespace. And then most things inside of it are classes. It is common for C++ libraries to use namespaces.

EUWX said...

2. wxWidgets as an example and many other MUCH MORE USED pieces of software settle for a nice 2-3 letter prefix for the needs I have identified before and the needs you already know about and Euphoria cannot have a similar way because in your opinion it would more confusing to the application developer.

This was also answered clearly: You still end up with clashes. You also end up with clumsy names to avoid those clashes. It's true that wxWidgets doesn't use a C++ namespace. But it also doesn't throw everything into the same scope / namespace.

EUWX said...

You are trying to empirically justify 50 namespaces when other larger bodies of developers find one sufficient for their major and elaborate and much more used piece of work.
I am going to stop anyway now, whether or not you address these two issues, or justify your empirical stand of the need for 50 namespaces.

These issues have been addressed multiple times.

The euphoria standard library is made up of various files that cover certain types of functionality. Where suitable, we've tried to present a consistent interface. For instance, several libraries have a public new() function to create an object of the type supplied by that file. Using namespaces, we don't have to worry about picking just the right prefix so that it will never conflict with any other library.

The solution of namespaces is an elegant way to know that no matter what any other library author creates, people can always use your code with other code. Prefixes do not stop this, because multiple people could choose the same prefixes. Or not bother with them at all. Using namespaces mean that there's always a way around this.

The namespaces in the standard library give the user a way to refer unambiguously to any part of that library. Also, if the user ends up with multiple files using the same default namespace, he can easily override that to be able to specify which one he wants at any given time.

EUWX said...

I am happy in the knowledge that other major C and C plus plus developers do not think of fragmenting their work in too many and mostly irrelevant Namespaces.

Yes, it is often said that ignorance is bliss. C does not provide a way to do this, so C developers must rely on ugly prefixes. C++ developers have additional tools to get around this, and they use them. Euphoria developers have tools to help them avoid these issues, too, and we certainly use them in the standard library.

I'm sorry if having different namespaces is too much of a cognitive load for you. This is not going to change in the standard library any time soon. You're going to have to come to grips with the fact that you are different. Please stop being obtuse and pretending that I haven't addressed your questions. We just disagree.

Matt

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

21. Re: Too many namespaces

If you want prefixes instead of namespaces, just think of a namespace as the prefix that you want. But it has the advantage that you can often leave it off. And if a clash still occurs, you can use your own namespace. You can't do that with prefixes.

Arthur

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

22. Re: Too many namespaces


You do not use your namespaces in the application you are writing. You use them only when including someone else's code, as a .e file.

If someone writes a mammal.e file, and i want to include it, so i can use it, and i happen to be writing code about a cow and a cat, i can include the same file twice, something like this:

include mammal.e as cow 
include mammal.e as cat 

Now i can use whatever internal functions and structures are in mammal.e under a "cat" and a "cow" namespace i choose, so i am not feeding hay to the cat or mice to the cow. I have not edited mammal.e, and the author of mammal.e did not use namespaces in their code. I can call cow:eats() and cat:eats() , it's the same eats() in mammal.e, in both calls, but 1) different instances, and 2) i didn't rename anything, and 3) the original programmer of mammal.e isn't bothered by it.

useless

someone, not me, edited this post.

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

23. Re: Too many namespaces

EUWX said...

I am happy in the knowledge that other major C plus plus developers do not think of fragmenting their work in too many and mostly irrelevant Namespaces.

ROTFLMAO!

Have you [no offense] actually read any C plus plus code?

You mentioned wxWidgets; just because all the namespaces (erm, classes) begin with "wx" it is not quite the same as "one namespace".
(Anyone actually want to count them?)

Maybe your problem is more to do with the lack of an appropriate help/lookup?

Anyway, reminds me of this little Hello World gem (and sadly I now understand the big one at the end).

Pete

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

24. Re: Too many namespaces

EUWX said...

You ask: " tell us what you think is unclear"

I have already stated and asked that
1. wxWidgets as an example and many other MUCH MORE USED pieces of software do NOT have Namespaces where you have 50 in Euphoria Are those developers
- ALL OF THEM - WRONG?

Matt didn't namespace inside of wxWidgets. He didn't need to, he might not have even been able to.

EUWX said...

2. wxWidgets as an example and many other MUCH MORE USED pieces of software settle for a nice 2-3 letter prefix for the needs I have identified before and the needs you already know about and Euphoria cannot have a similar way because in your opinion it would more confusing to the application developer.

So what if i write a wx-brace structural designer .e file, and Chris writes a windows x-plane .e file, and euphoric writes a wiccan-cross .e file, and we all use "wx_" to prefix all out functions in our files? It doesn't matter, because YOU can pick the "prefix" by including it with "namespace". You can use all the 2-letter prefixes you like, of your choosing, when you include a file. Altho with just 2 letters you may run out of prefixes.

Lets say i want to use a Commodore 1571 floppy drive to store data to send to a 3D printer, and to a laser printer that write to the sides of buildings. Someone else wrote all the code to do all the low-level stuff already. Funny thing tho, each include has a print() function: print to the floppy, print to the 3D xyz&feed&temperature controller, and the print() using laser to the barn. And Eu has a print().

If i simply include all the .e files, Eu will refuse and complain about not being able to resolve what the heck you want with so many different print() functions. So you whip out your 2-letter prefixes, and namespace the includes:

include C64-1571.e as C6 -- i'd use C64 
include laser-writer.e as la -- i'd use laser 
include Sooper3D.e as s3 -- i'd use anything else not just 2 chars 

Now i can save to the floppy using C6:print(), i can print to the side of the barn with la:print(), and i can make a gooey 3D printing mess with s3:print(). Or i can 3D print to the side of a barn and burn the paper with the laser. I namespaced with those mere 2-letter form you like.

useless

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

25. Re: Too many namespaces

--made up names, may or may not match actual items 
--I'm not a great programmer, so code may suck 
 
include WX.ex as wx 
include Banana.ex as ban 
include Cucumber.ex as cuke 
include Custard.ex as cust 
--I choose what to call my include files 
 
function new() 
     --some code to create a new 'thing' 
 return 0 
end function 
 
atom myWx, myBanana, myCuke, myCustard, myThing 
 
myWx = wx:new() 
myBanana = ban:new() 
myCuke = cuke:new() 
myCustard = cust:new() 
myThing = new() 

or

 
include WX.e 
include Banana.ex 
include Cucumber.ex 
include Custard.ex 
--designer of include files names functions as they see fit with prefixes 
 
atom myWx, myBanana, myCucumber, myThing 
 
myWx = wxNew()  --prefixes all routines with 'wx' 
myBanana = bnNew()  --prefixes all routines with 'bn' 
myCucumber = cuNew()  --prefixes all routines with 'cu' 
myCustard = cuNew()  --prefixes all routines with 'cu' 
myThing = new() 
--name clash between Cucumber and Custard files!! 
--I wish there was some major lookup table that all developers had to look at 
--to know what prefixes could be used and what routine names were already 
--used in ALL other include files so that anybody writing an include file 
--to be used by other people would know not to name their 'new()' the same as 
--somebody else's 'new()' 
new topic     » goto parent     » topic index » view message » categorize

26. Re: Too many namespaces

EUWX said...

...

Euphoia should have only one namespace or if needed, perhaps 3-5 namespaces. Over the years you have been incorporating good .e and .ex from various contributors; that is fine but they should become completely a part of Euphoria, and similar additions should be infrequent. Anything outside of that should be considered "having an affair" with somebody else's wife and the application programmer should suffer the consequence of philandering.
To continue with the analogy, if the application programmer wants to have this "affair" often, he should house that "girl friend" in separate accommodation, "re-dress" and "re-name" her, making her his special concubine. Euphoria's one or four wives (namespace(s)) would not be concerned with these concubines and the concubines would not have to worry about the wife (wives)

Oh, that's right! Nobody should be writing include files to be used without first having them officially incorporated into the language! Then the devs can rename everything and put it into the section they feel appropriate.

'Resistance is futile'

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

27. Re: Too many namespaces

evanmars said...
EUWX said...

...

Euphoia should have only one namespace or if needed, perhaps 3-5 namespaces. Over the years you have been incorporating good .e and .ex from various contributors; that is fine but they should become completely a part of Euphoria, and similar additions should be infrequent. Anything outside of that should be considered "having an affair" with somebody else's wife and the application programmer should suffer the consequence of philandering.
To continue with the analogy, if the application programmer wants to have this "affair" often, he should house that "girl friend" in separate accommodation, "re-dress" and "re-name" her, making her his special concubine. Euphoria's one or four wives (namespace(s)) would not be concerned with these concubines and the concubines would not have to worry about the wife (wives)

Oh, that's right! Nobody should be writing include files to be used without first having them officially incorporated into the language! Then the devs can rename everything and put it into the section they feel appropriate.

'Resistance is futile'

I have noticed that trying to escape the sexism is futile, for sure. Praps EUWX is another Ariel Castro. By another namespace, of course.

useless

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

28. Re: Too many namespaces

Matt: Thanks for your response and explanation. I see your point of view. We agree to disagree in some areas.

To those who are trying to explain to me how to use Namespaces or demonstrate the futility of my approach or suggestion, I just have to say this:
I have been a language developer for many years and an application programmer later. To date I have not had any problem with my approach which also is modular without having to use Namespaces. I have also used Euphoria with its Namespace approach and found it cumbersome. I have not tested performace and speed etc and have not claimed any inferiority of the Namespace approach, or superiority of my non-namespace approach to programming.

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

29. Re: Too many namespaces

EUWX said...

To date I have not had any problem with my approach which also is modular without having to use Namespaces. I have also used Euphoria with its Namespace approach and found it cumbersome.

It's feasible if you do not use many third party libraries. Or if you are willing to modify those third party libraries to prevent conflicts. I won't say that you're wrong to do either of those, but they are not paths that I (nor many) like to take.

Your assertion that namespaces are more cumbersome than prefixes is just silly, though. As already mentioned, there's nothing preventing you from using the same prefixes and a colon instead of an underscore. There's also nothing preventing you from using a rock to hammer nails, but don't expect the rest of us to think that you're onto something when we have a functioning air hammer.

Matt

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

30. Re: Too many namespaces

mattlewis said...

There's also nothing preventing you from using a rock to hammer nails, but don't expect the rest of us to think that you're onto something when we have a functioning air hammer.

Matt

But I have a functioning remote controlled Laser Gun - much better than an air hammer.

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

31. Re: Too many namespaces

EUWX said...
mattlewis said...

There's also nothing preventing you from using a rock to hammer nails, but don't expect the rest of us to think that you're onto something when we have a functioning air hammer.

But I have a functioning remote controlled Laser Gun - much better than an air hammer.

I'm not sure how you'd hammer nails with a laser, but assuming that works, why do you continue to request that we all go back to using rocks?

Matt

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

32. Re: Too many namespaces

mattlewis said...
EUWX said...
mattlewis said...

There's also nothing preventing you from using a rock to hammer nails, but don't expect the rest of us to think that you're onto something when we have a functioning air hammer.

But I have a functioning remote controlled Laser Gun - much better than an air hammer.

I'm not sure how you'd hammer nails with a laser, but assuming that works, why do you continue to request that we all go back to using rocks?

Matt

One needs technological expertise to use a remote controlled Laser Gun; if such does not exist to the required degree, rocks and "functioning air hammer" are an acceptable choice. Takes longer that way but you do achieve what little you set out to do. For major work though, and speed of coding one needs "a remote controlled Laser Gun"., e.g. a laser controlled gun can identify "food" and "fruits" and "apples" and "oranges" "seeds" in a collective and individual manner - if required, they will melt and mix with one shot, or be treated individually with accuracy because of the extreme narrow beam possible only with the laser.

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

33. Re: Too many namespaces

A tiresome thread...

Dear EUWX, I am having great difficulty in decoding what you write. As a result I have to guess at what you are trying to say; in turn what you write makes no sense. Mix in some cultural differences and the discussion becomes most interesting.

One idea I guess you are making is that current hardware has 16GB RAM, tremendous speed, and can not suffer from bloated and slow software. This is not Euphoric thinking. If you look the flyer of a local retailer you will notice that 4 to 8 GB RAM is typical. Bad data leads to bad credibility.

I guess that you feel a single monolithic include connected to each application is not harmful. I made an include that contains the contents of the standard library. After compiling, the result was about a 1MB file which I consider to be bloat if it had to be part of every application. (Fortunately O[ removes unused code in an application.)

If you do not understand the namespace concept of Euphoria then there must be others. This means the documentation needs improvement.

A single include that contains commonly used modules has some value. Typing one line instead of several include statements will make it easier for novice programmers. I will explore this idea for tutorials directed at novice programmers.

A single include that contains one's personal modules also has some value; here bloat is under control since you select what is included.

It is incorrect to visualize the standard library as consisting of fifty or more namespaces. Each include file has a default namespace identifier but you do not need to know them all for most uses.

I didn't spend much time in making sure this chart is complete. Duplicated identifiers in the standard library:

Identifier Namespace
clear map, stack
close eu, pipeio, sockets
compare eu, map
create pipeio, sockets
datetime datetime, locale
decode base64, url
encode base64, url
escape regex, text
find eu, regex
find_all regex, search
find_replace regex, search
format datetime, text
free eumem, machine
get locale, map, stdget
is_match regex, wildcard
keep_newlines syncolor, tokenize
new map, regex, stack, syncolor, tokenize
parse url, datetime
remove eu, map
reset syncolor, tokenize
set locale, stack
size map, stack
split regex, stdseq
sum math, stats
wrap text, graphics
STDERR io, pipeio
STDIN io, pipeio
STDOUT io, pipeio
URL_PROTOCOL common, url

List of namespaces with potential conflicts:

Namespace Possible Conflicts
base64 encode, decode
common URL_PROTOCOL
commandline parse
datetime datetime, format
eu close, compare, find, remove
eumem free
graphics wrap
io STDERR. STDIN, STDOUT
locale datetime, get, set
machine free
map clear, compare, new, remove
math sum
pipeio close, create, wrap
regex escape, find, find_all, find_replace, new, split
search find_all, find_replace
sockets close, create
stack clear, new , set
stats sum
stdget get
stdseq split
syncolor keep_newlines, new , reset
text escape, format, wrap
tokenize keep_newlines, new , reset
url decode, decode, parse, URL_PROTOCOL
wildcard is_match

Depending on what you are programming, it looks feasible to package the standard library into five includes (five namespaces). From a typing viewpoint I consider wx_ and wx: as equivalent effort.

You are free to pick any identifier you want in your programming; your identifier will take precedence. You will only need to use a namespace prefix if your identifier is duplicated in the standard library.

Since O[ is an open source project with limited resources the only way one can make a case for an alternative idea is with code. A language developer and application programmer could easily create a new (alternative) standard library. Such a library would interest many O[ programmers.

_tom

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

34. Re: Too many namespaces

Tom, that's a cool little Euphoria logo! :D

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

35. Re: Too many namespaces

You said over 1 mb is too big.

B00 ……………………………………………………………………. 988 kb
Elena …………………………………………………………………. 496 kb
LiveCode ……………………………………………………………..44.5 mb installer
Haskell setup ……………………………………………………….93 mb
Clojure……………………………………………………………….. .jar file over 3 mb
Netbeans Windows installer ……………………………….245 mb
Scala compiler …………………………………………………….10 mb
Java……………………………………………………………………. 30 mb
BCX …………………………………………………………………….247 kb
Freebasic ……………………………………………………………502 kb
Gambas…………………………………………………………….. 12 mb
Gentee………………………………………………………………. 2.6 mb
Purebasic………………………………………………………….. 19.5 mb
Python installer ………………………………………………… 19 mb

Almost all these products are much more used than Euphoria.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu