Re: Too many namespaces
- Posted by _tom (admin) Sep 18, 2013
- 3453 views
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