Re: [Jolie-devel] Jolie code example in documentation
A service-oriented programming language.
Brought to you by:
fmontesi
From: Matthias D. W. <mwa...@ya...> - 2013-10-22 17:02:09
|
Dear Fabrizio, Fabrizio Montesi schrieb: > Dear Matthias, > thanks for your contribution! > That example is indeed wrong, since variable paths cannot start with a > dynamic lookup. > > What I mean is that > > global.(exam.studentId).(exam.examId) > > is not fine because the first variable name after the global keyword, > which acts just as a keyword and is not a variable, i.e., > (exam.studentId), is dynamic and Jolie does not allow for that. The > reason is that otherwise many static analyses of code would become > impossible. > > A way to fix the example could be to use something like: > > global.exams.(exam.studentId).(exam.examId) > > This way, the variable path would start with exams, which is static > and therefore OK. ah okay - I think this is not explained in the docs and the error message is misleading. > I'm adding Claudio and Saverio in CC since they may be interested in > following up. > > I'm attaching a modified version of server.ol that runs for me. I also > had to change the usage of join, since it's a one-way operation and > not a request-response as used in your zip. Let me know! But the interface changes which I made are correct? Since my interface definition diverges significantly from the original one. > @Saverio: we should update the website with the fixed version when we > finish sorting this out. In the meantime I gave a look at another example, namely http://www.jolie-lang.org/?top_menu=documentation&sideMenuAction=architectural_composition/dynamic_embedding (Dynamic_Embedding_Counter). Btw: the link should be called "Dynamic_Embedding_Counter Example" not "Processes Code Example <http://www.jolie-lang.org/content/documentation/architectural_composition/code/dynamic_embedding_code.zip>". This example would be nice to test with multiple clients running concurrently. But Client.ol contains a hard-coded callback port which prevents this: > inputPort CounterClient{ > // Location: "socket://localhost:4003" > Protocol: sodep > Interfaces: CounterClientInterface > } Does Jolie support a method to allocate a free port number dynamically (for instance port 4000 + something)? Cheers, Matthias > > Cheers, > Fabrizio. > > On Tue, Oct 22, 2013 at 11:07 AM, Matthias Dieter Wallnöfer > <mwa...@ya...> wrote: >> Dear Jolie devs, >> >> the documentation at >> http://www.jolie-lang.org/?top_menu=documentation&sideMenuAction=basics/sessions >> section "Multiple correlation variables" provides an example about exams, >> students and professors. >> >> I would be glad to try it out but it seems incomplete (and also not >> downloadable). I attempted to fix it up but now I am stuck. >> >> For instance the line: >> >> global.(exam.studentId).(exam.examId) << exam; >> >> yields to >> >> java.lang.ClassCastException: >> jolie.lang.parse.ast.expression.VariableExpressionNode cannot be cast to >> jolie.lang.parse.ast.expression.ConstantStringExpression >> >> I have no idea how to change that. >> >> Please find attached my WIP. It would be nice to have at least the server >> side working. >> >> Regards, >> Matthias Wallnöfer >> >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >> from >> the latest Intel processors and coprocessors. See abstracts and register > >> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk >> _______________________________________________ >> Jolie-devel mailing list >> Jol...@li... >> https://lists.sourceforge.net/lists/listinfo/jolie-devel >> |