Re: we need official libs : Swap
Boehme, Gabriel wrote:
[...]
>>I'd think we're better off keeping things pretty much the way they are,
>>adding functions as necessary rather than new syntax.
>
>+= -= *= /= &=
AAAAH! Back, you!
Seriously, I realize those were added, but I was one of the few who saw it
as being an unnecessary degradation of the language. (I know, I know,
"efficiency first". But really, if I was concerned enough about Euphoria's
efficiency to worry about the speed gains in a statement like "x = x + 1"
over "x += 1" (if any), I doubt I'd be using it.)
>>(And incidentally, since a swap function is clearly un-Euphoric, I'd say
>>we're probably better off without it...)
>
>If you're merely referring to code like "swap(a,b)", then I'd agree with
>you. But I'd certainly rather code "{a,b}={b,a}" than "junk=a a=b b=junk",
>wouldn't you?
Yes, I had been referring to it as a function ("swap(a,b)").
I'll admit though, the latter example of the alternatives does look junky
(pardon the pun.) But honestly, I haven't decided. "{a,b}={b,a}" looks almost
alluring, but some part of my being cries out at the apparent placement of a
sequence on the left side of an assignment. Multiple assignment of some sort
("a,b,c = 1" or "a,b,c = 1,2,3") might be desireable, but I think whatever
construct embodies the idea should NOT make use of the sequence brackets for
delimiters.
Rod
|
Not Categorized, Please Help
|
|