Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

LSL Compiler: Forward references

Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
03-28-2004 06:19
first(integer n) {
    second(n);
}

second(integer n) {
    llSay(0, (string)n);
}

Doesn't compile. Gives an erroneous error message about the number of args being wrong! The LSL compiler should either figure out forward references automatically or allow us to prototype our functions a la C/C++:

// prototype
second(integer n);

// now this works
first(integer n) {
    second(n);
}

second(integer n) {
    llSay(0, (string)n);
}
Abraham Stonehill
Junior Member
Join date: 14 Nov 2003
Posts: 5
03-28-2004 08:50
I endorse this suggestion.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
03-28-2004 14:50
I endorce this fully. Perhaps make it transparent to the user, to follow java's example.

It is currently transparent for void-arg functions, why not make it for all?
Oz Spade
ReadsNoPostLongerThanHand
Join date: 23 Sep 2003
Posts: 2,708
03-28-2004 18:44
I endorse this idea/feature.
_____________________
"Don't anticipate outcome," the man said. "Await the unfolding of events. Remain in the moment." - Konrad
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
03-29-2004 00:05
Implementing this would allow for co-recursive functions. Not a common technique, but a useful one sometimes.
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'