On 8/30/07, Fabio Filasieno fabio.filasieno@gmail.com wrote:
I'll show the most evident thing
add: newObject after: oldObject "Add the argument, newObject, as an element of the receiver. Put it in the sequence just succeeding oldObject. Answer newObject."
| index | index _ self find: oldObject. self insert: newObject before: index + 1. ^newObject
Why ? Why there is a NEED for this ? to save me 2 lines of code ?
I would dump it.
This is your most obvious example? And you're not worried about 2 lines of code but you are concerned about 1 character? This is a pretty handy and clear operator and allows Smalltalk to read more like English.
If the user needs to do that he could write: find then insert. is it ?
And what would this code look like exactly? Not C++'s awful iterators I hope.
This is an example of bloat !
Opinion.
A functional programmer (LISP) don't even have the stack data structure. They use a list. As they are very very concerned of bloat.
????? Surely you must mean Scheme here. Common Lisp is the most bloated unorganized pile of odd and inconsistently named functions I have ever seen. Powerful, but concerned of bloat? Obviously not.
In OrderedCollection I would dump: addLast: (make Add be addLast)
They are the same in the places it makes sense. But it doesn't always, hence the two separate methods.
Don't you think that this numbers shout at you `I'm bloat !` 50% overhead => the method is not doing anything (declaration and return) and inlining would remove this overhead . 50% just 2 calls to self...
Small methods *are* Smalltalk. What exactly of Smalltalk do you actually like? The environment? Are you sure you don't just want Haskell/Ocaml/whatever in a Smalltalk-like IDE? Perhaps you should check out the Lisp+Slime combination.
In Ocaml there is simply no bloat. Just open their doc. count the methods. There are very few.
Which means everytime I want to do certain things I have to write specialized methods for it. In Smalltalk most of these have been done in the image already. In most any language I know besides Smalltalk I always have a "utilities" library I build up from all these methods I would otherwise have to keep redefining.
LISP is even more terse.
Not sure which Lisp you mean here but:
http://www.ffconsultancy.com/languages/ray_tracer/verbosity.html
The reason Lisps tend to be terse is because of Macros, but I'm kind of confused how this applies to your point that the libraries should have few methods. Common lisp probably has more methods for collections then Smalltalk, and with odd names.
For example, filtering a collection: select:/reject: (Smalltalk), filter (Haskell, Ocaml, Python, etc.), remove-if-not (Common Lisp)
Then there is the following, which is a bit more subjective.
I don't care of traits. I don't care of inheritance, the less the better. It confuses me.
I really don't see what it *is* that you like of Smalltalk besides perhaps the IDE and the debugger.