[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Odd behaviour with multiple return values and varargs
- From: "Tom Miles" <Tom@...>
- Date: Thu, 13 Sep 2007 14:19:14 +0100
>
> Huh? We are not talking about "unexpected values", but "an
> unexpected number of values" in a hypothetical non-Lua
> language that then consequently thwarts the list/value relationship.
>
> I am saying that this non-Lua language is not a good idea,
> and Tom Miles demands that I should write code as if I had to
> deal with this non-Lua language, and now you call my code "at
> fault" for not working under this hypothetical non-Lua language?
>
Sorry if I've offended you, but I'm not *demanding* anything. I'm also
not talking about a hypothetical non-lua language, I'm trying to
understand a justification for something that I see as counter intuitive
within the language am I trying to use.
> Why would I know that? Why should I need to know?
I would have thought if you were calling a function you would want to
know what it does!
> I am sure we can get even more absurd if we really try, but I
> don't think it worth doing.
>
> >> Anyway, there is no reasonably elegant way to rewrite
> something like
> >>
> >> a, i = f(a+1,i), f(i,a)
> >>
The same argument can be used for what I am trying to do, only I *have*
to use temporary variables. What I was trying to do is:
function Position()
return x,y
end
function Dimensions()
return w,h
end
function push_clip(x,y,w,h)
-- Do stuff
end
push_clip(Position(), Dimensions())
As it is, I have to do:
local x,y = Position()
push_clip(x,y, Dimensions())
This is hardly a hardship, but as I keep saying it *seems* counter
intuitive.
Oh, and just to throw a bit of petrol on the fire, if I saw code like
"a, i = f(a+1,i), f(i,a)" I wouldn't have a clue what it was supposed
to do!
(It's so hard to leave interesting discussions)
DISCLAIMER
This email is sent by The Creative Assembly Limited company No. 03425917, registered in England &Wales registered office 27 Great West Road, Middlesex, TW8 9BW, England. The contents of this e-mail and any attachments are confidential to the intended recipient and may also be legally privileged. Unless you are the named addressee (or authorised to receive for the addressee) of this email you may not copy, disclose or distribute it to anyone else. If you have received this email in error, please notify us immediately by e-mail on postmaster@creative-assembly.co.uk and then delete the email and any copies. The Creative Assembly Limited have made all reasonable efforts to ensure that this e-mail and any attached documents or software are free from software viruses, but it is the recipient's responsibility to confirm this.