Hi<br>
<br>
I think these are problems for the Chuck compiler, there are things that I think that makes no sense.<br>
<div id="result_box" dir="ltr">Perhaps what I like to me is a compiler that will not allow me to do mistakes<br>
<br>
</div>
// printf: print float :_)<br>
public float printf( float n ) {<br>
<<< n >>>;<br>
//return void;<br>
}<br>
<br>
printf( float n ) => float num;<br>
<<< num >>>;<br>
<br>
Uncomment the line return void, there is a wrong message syntax.<br>
<br>
<div id="result_box" dir="ltr">Greetings</div>
Lucas<br><br>
<br><div><span class="gmail_quote">2008/6/7, Kassen <<a href="mailto:signal.automatique@gmail.com">signal.automatique@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Kas,<br></blockquote><div><br>Hey, Peter,<br> <br></div><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>I don't see what the problem is. </blockquote></span><div><br>There
is no real problem, there is just some strange behaviour and a lack of
documentation. The word "public" as far as I know isn't defined at all
aside from how it affects classes. I'm really quite sure it's not
defined for functions in ChucK.<br>
<br></div><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> You're not sporking 'a public'; surely public is an access modifier that can apply to functions perfectly viably. </blockquote>
</span><div><br>Well, clearly it's a function but I defined it by calling it a "public".<br><br>if <br><br>fun void foo() {}<br><br>is a "function"<br><br>then by my logic<br><br>public void bar() { }<br>
<br>is a "public". I suppose this is pushing some linguistic envelopes but you have to admit there is some logic to it, right? ;¬)<br><br> </div><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I wouldn't expect the code you posted to be illegal, although there may be some slight redundancy. </blockquote></span><div><br>I
agree. I have no issue beyond a lack of documentation and being
surprised I can use the word there at all and that it works exactly
like "fun".<br>
</div><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I haven't chucked for a while, so this could be inaccurate but I think
that 'public' there will just mean that you could run (perhaps by
sporking, or not, it's somewhat irrelevant) that function from other
files once that one had been loaded (and also that you couldn't
redefine the function foo() until you restart the VM). </blockquote>
</span><div><br>I just tried that and you can't. You can't run a
"public" from another file, I think you are confused with "public" as
it applies to classes. This;<br><br>public class foo { static int bar; }<br>
<br>can be instantiated from other files and can't be redefined until
you restart the VM. That's fine... well it's at least documented, it's
useful too.<br><br>What "public functions" ought to be and how -if in
any way- they are different from normal functions isn't at all clear
and even after trying everything I could think of I can't find a single
difference.<br>
<br>At the risk of repeating myself; there is no issue with that at all
(yet....) but it's not documented and I don't see the logic to having a
second word, which is why I asked. I would imagine it's there as a
place-holder for future usage but it can't hurt to ask and be sure.<br>
<br>I'd be really happy if I *could* run them from different files,
especially if I could also change them later, presumably on the
condition that I'd keep the return type the same.<br><br> </div><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Also, can you not spork a function that returns something, just not access the returned value? I don't see why not.<br>
</blockquote></span><div><br>No, I fear you can't. I'd explain why but
as luck would have it there was a topic on this list on this exact
subject just yesterday called "return values of sporked functions"
where Mike & me covered this very subject. I recommend you look
that one up in your inbox. <br>
</div></div><br>Yours,<br>Kas.<br>
<br>_______________________________________________<br>
chuck-users mailing list<br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br>