1. Re: we need official libs : Swap
Fun thing about discussions with so many voices .. you don't need to respond
to everything and every point, when some one else already has ..
Although I don't completely agree with everything, the pro's and con's are
pretty obvious now and so in the difference in criteria and perspective.
I do wish to add the following comment: if and when it's implemented, I know
I and you (yes, you too), and a lot of people will use it more than most
features of euphoria. As to consistency, it does make sense in line that
every aspect of a sequence is not considered to be an expression.
Which is also true, its not an expression. Its a shape for an expression, a
structure, but on itself, it does not contain a value. Sequences are
shelves, that can hold values, but are not the values themselves. Do you
consider these to be expressions ?
data[x]
pizza[x..y]
The fact is, these are allowed on the left side (as pointed out by David).
Does it matter to Euphoria if a value is a sequence, an atom or an object.
It doesn't. It doesn't work with sequences, it works with the values within
a sequence. Its almost as if, the whole sequence thing, is above the
expression. Its part of the assignment, rather than the expression,
irregardless of which side.
And do we need it ("dont fix some .. ") ? ... Well, lets see, you can make a
turing machine, so you don't need it.
Then again, this also goes for about half of the features of a programming
language.
Let compare this again to language. What if we were still (this was the
point I was trying to make) using our hands and drawings to make a point ?
What if we hadn't created any shortcuts, assing any terms or created any
kind of (useless) syntactic construct ? Then you would need to explain
everything, really eveything, using the bare things that you do have. Its
like explaining why hacking is wrong (i'm not a hacker, nor a hacker-fan or
whatever, just a random example) all the way back to the basic prinicples of
right and wrong. It would take some while to track down the whole line.
Let's face, language is the way we share knowledge. Its the way we share
knowledge fast, without language we would still be as dumb as sheeps. (or
are we are as .. .. nevermind
How many of our thought are our own ?
We're still using thoughts by pytagoras. We're still using the basic
thoughts, about democracy, about what the world is, what god is or isn't
real, who we are, upto how a man should walk, of other people. Sometimes
they died long ago, something not. What if everything you knew, had to be
figured out by yourself. How much would you understand of the world then ?
This whole society is based on communication, so we can share our knowledge.
Combined mental power or whatever. I mean, don't take this part too
seriously. I just want to use this to illustrate that language should be
developping, rather than be consistent and fixed. It should as our idea of
the world moves. It should adapt to the context to help us get to the point
faster. (Or at least faster than I am getting to the point
The power and
elegance, the more you can say with the less, the better the construct in my
eyes. A construct so powerfull, so often used (when added) and so more
appropiate, should even be a discussion. I mean, its an adaption towards the
context of things. Its what we want to say, how we want to say it. I feel,
when I write something like this:
junk = get (0)
if junk[1] then
ouput (junk[2])
end if
That i'm translating my thought to a different language. I mean how would
one explain the above to a human ? (great test for new construct, ..)
"the value returned by the get() function contains both a status value as a
the result of the operation. Based on the status value, you decide wether or
not you want to output the result."
The above explenation would be one of the most common explenations within an
euphoria program, for the simple fact, that all other type of constructs are
not so directly related to the algorithm, except problely the
loop-constructs (the by far most used explenation) .,. but guess what, the
for-loops are already an integral part of the language, in the way we see
them, not how the interpreter sees them. I mean, you don't really _need_ a
for loop, do you ?
10: x = 0
20: x = x + 1
30: print x
40: if x < 10 then goto 20
For your machine its seen as a goto, bound to a decision. For us humans, it
are looping construcuts. That's how we see them. The very same thing applies
to the {}= assignment ..
And people that scope through most my code, may have noticed, with any kind
of data management, I'm always using sequences to store all instance-related
data. (don't think oop though.) Others choose to supply an integer handle
and manage the data themselves.
Either way, shows we're developping weird systems, always using handles and
constants, to cope with something, that can be dealed with much more
elegantly. The impact is huge, and the impact is good.
Any one up to writing _the_ preproccesor to prove my point ?
> be legal is the wrong choice, especially when disallowing it is done
> for implementational reasons? Similarly, making
>
> {a[x], a[y]} = {a[y], a[x]}
>
> illegal when x and y are equal will prevent the use of a number of
> algorithms with the construct, algorithms that infrequently perform
> redundant computations, but are relatively simple, fast and efficient.
There will be algorithms were it would be used, but when x and y can become
equal, you would have a weird type of algorithm. Actually, the above should
be legal, because you are swapping. (an exception)
But another exception ? Chill, its like the elegant thingie that happens
when you slice: x[1..length(x)] for example, will not cause an error
when x is {} (zero length) .. why ? Because in this case, its the wanted
answer to the algorithm.
The same applies to the:
{ a[x], a[y] } = { a[y], a[x] }
Within in the algorithm, its always the wanted behaviour, when this does
exactly _nothing_. (when x and y are equal, that is)
However when:
{ a[x], a[y] } = { 2, 3}
And x and y are equal, then there should be an error warrented. I can't come
up with any trivial algorithm, that would even want to try to do this. So,
when there is no reason to do such a thing, the interpreter can know you
made a mistake, and that it was not intented this way at all.
Ralf N.