3 ms·
One comment on the article mentioned that programming languages need to have many concepts, and concepts built on concepts, and concepts built on those. So you
by webjprgm 13y ago
One comment on the article mentioned that programming languages need to have many concepts, and concepts built on concepts, and concepts built on those. So you can't have a new symbol for each concept since you build more and more concepts.
I think Lisp has too few symbols. I completely agree with the author on this.
I think there's a balance where we use enough symbols to make the structure of the code stand out but don't try to make everything into a symbol since the language is essentially extensible by the user in building the tower of concepts.
Next question: is operator overloading good? It lets you write extensions that feel like they are part of the language, but it also makes the code difficult to evaluate mentally since you might not know that an operator means something different now.
I've always found it rather annoying to use collection APIs in Java, or big num libraries, since you have to call long-named functions for simple operations. In C++ you can overload operators to concatenate, iterate, and inspect collections. But this can be misused (in C++, Lisp, and other languages) to make code harder to figure out.
Math notation, though, does have overloading. "+" is not just add two integers, it can be used for set operations sometimes. Also some notation is used differently in different disciplines, like math-like notation in some computer science papers (e.g. describing a type system or Lambda calculus evaluation) look similar to operators used in logic or calculus but mean different things. So operator overloading is common. Is it good?
- ionforce 13y agoOperator overloading is good if the operator continues to mean the same thing across domains. If I have two integers and I want to add them together to create a new integer, that's pretty clear. It's still clear that if I have two complex numbers or fractions that I would want to immutably add them up and create a new number. And so on with things like lists and sets, which as you pointed out are set operations. I would be less inclined to extend this to domains that aren't about numbers or sets, like genie + bottle What exactly does that do? It's kind of like implementing an interface. The implementation should do what it says on the box. In this case the box is the sign for addition.