7 ms·
Unfortunately it does not make much sense. Prefixes are more like an simple hack. The idea of package has both advantages and disadvantages: Advantages: * p
by lispm 12y ago
Unfortunately it does not make much sense.
Prefixes are more like an simple hack.
The idea of package has both advantages and disadvantages:
Advantages:
* packages prefix can be omitted if the symbol is accessible
* package is an actual data structure. This allows me to do calculations with it: for example I can find all symbols in a package or I can find all packages.
Disadvantage:
* more complicated
* conflicts possible when I want to use symbols from some other package in a package
- tree_of_item 12y agoThe environment is a data structure as well, and if functions use prefixes you can find all functions with a particular prefix.
- lispm 12y agoTCP-PACKET-FILTER WINDOW-STREAM-DRAW-STRING What is the prefix of above symbols?
- tree_of_item 12y agoIf they use prefixes, which they might not. I agree that these should, in order to make this kind of programmatic environment manipulation possible. The fact that these don't have prefixes or some other regular distinguishing feature is a design flaw: you either have namespaces, or you commit to prefixing/suffixing/metadata attached to everything and document how it works. Although, `tcp-` and `window-` seem like they might be used in the way you expect.
- deleted 12y ago[deleted]
- deleted 12y ago[deleted]
- dragonwriter 12y agoLots of module/namespace solutions manage the "prefix or conflict" issue by allowing aliased imports (as well as qualified imports), so you can manage conflicts that would otherwise occur without dragging the package name around with every use of the problem symbol.
- pnathan 12y agoThe more code I write, the more I fully write out namespace names (thus answering the question "where does this function get defined"), so the code starts to look like prefix based naming anyway. (Not that I am against namespacing - I think being able to have namespaced packages is a really good idea).
- mercurial 12y agoMany namespace/module systems let you do something like import really_long_name as rln You still get the answer to your question, without sacrificing terseness. For the record, I also tend to use fully-qualified names when it makes sense. Some languages make this impossible though (I'm looking at you, Java and your files with twenty or thirty lines of IDE-generated imports).
- e40 12y agoI've been using packages for so long in CL and I never think about them. I think about other stuff. Like, how do I get format to do that thing I want it to do? I always have to look it up. Packages? They just work and work well. I think RMS is having the same problem really smart people have: if it can't be made perfect I don't want it. I regularly see this in some smart people. They reject stuff because it's not the way they want it, without them being able to articulate why they don't want it. In the early 90's I (and others) wrote not a small package and we used prefixes to avoid problems. It was ugly though, and a real package system would have been nice. For those interested, it's here: https://github.com/franzinc/eli https://github.com/franzinc/eli