Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't like the conflation of "-" as both "word separator in the name" and "namespace". I prefer keeping the "/", so you would get "snu/lines" instead of "some-nice-string-utils/lines". Otherwise I think this article is great, and I don't see why more languages don't use this kind of system, instead of dumping all symbols in the imported namespace into the current namespace.


I went back and forth on this.

Using / has one major disadvantage. You can’t name macros w/stdin, w/stdout, w/file, etc.

It’s short for “with-“. It’s only a few characters, but it adds up.

Admittedly it’s more important in arc, where brevity is a feature, not a bug.

On the other hand, having a full separator for the namespace is worthwhile. One idea I toyed with is:

my-func@pkg

So the namespace is on the right, not the left.

But I decided this is even worse, even if it does match e.g. how we ssh into things.

Ultimately it’s hard to beat a global namespace with prefixing conventions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: