4 ms·
Very thought-provoking idea. So, here I am designing the Next Big Language. And I'll take your suggestion. Now, first issue: if I say x = "dog", then the valu
by ggchappell 18y ago
Very thought-provoking idea.
So, here I am designing the Next Big Language. And I'll take your suggestion.
Now, first issue: if I say x = "dog", then the value of x is really
1 => 'd', 2 => 'o', 3 => 'g'
Right? And despite the fact that this is an O.D., it should print in a string-like way: dog. Now suppose I do
x['z'] = (1 => 2, 2 => 3)
Now x is
1 => 'd', 2 => 'o', 3 => 'g', 'z' => (1 => 2, 2 => 3)
How should it print now?
Next issue: If I do y[1] = 'a' and y[3] = 'b', and then y << 'c', what is the value of y?
Final issue: Do the above questions really matter?
One could argue in the first case that if I want something to print nicely, then I will probably keep it in a "reasonable" form, and not mix data types in odd ways. So it really doesn't matter much how the O.D. I came up with prints.
Similarly, in the second case, if I want a collection to work well as a stack or queue, then I am probably not going to use the bracket operator to do strange things with it. So it doesn't matter which of the multiple reasonable options for the behavior of << is chosen.
Or maybe it does matter?
- joe_the_user 18y agoHey, Someone took it seriously! I would assume that strings and "ordinary" O.D. would differ in their object type: each would inherit from an abstract O.D. and each would have a different print/display function (you could have a "hidden" variable specifying this function if you wished to keep in all concrete). If I do y[1] = 'a' and y[3] = 'b', and then y << 'c', what is the value of y? probably y = { 1=>'a', 3=>'b', 4=>'c'}, though like any good OO/metaprogramming language, "<<" would be an overidable function. "Do the above questions really matter?" I am arguing for the next language and by that token, I haven't answered all the questions this raises. I think old languages like lisp and new languages like Ruby prove that new languages can unleash new possibilities, even more than fifty years after the original computer languages were created. Thanks for your detailed reply, seriously...