|Newbie questions about Pliant
|Message posted by maybe Willer Alves on 2001/06/04 20:28:44
|Is there a way of calling a method inside itself? I want to create a kind of "recursive method" by I'm not having success...
P. S. What does the flush method do?
|Message posted by maybe Hubert Tonneau on 2001/06/04 20:53:47
|There is no problem to call a method from inside itself.
'flush' method in 'Stream' data type means flush the Pliant stream internal
buffer, I mean send the datas to the file.
|Message posted by maybe Willer Alves on 2001/06/05 18:04:45
|Well, the page doesn't return an error anymore, but I don't know what is wrong.
I want to create a repeat action on a html page.
I did a method like this:
method page recursive arg1 arg2 arg3 ...
arg_rw HtmlPage page ; arg_rw Data:DataDefinition arg1...
.. actions ..
x:y create id
recursive arg1 arg2 new_arg3 ...
This doens't return an error, but when I press "Again", the screen is blank.
What could be wrong?
|Message posted by maybe Hubert Tonneau on 2001/06/05 20:19:30
|Looks like it's a new Pliant bug.
The full explaination is that you really have two functions:
. the 'recursive' method
. the code under the button (that I will call 'recursive_button' here)
Now what appends is that Pliant starts compiling 'recursive'
then it finds the 'button' instruction so it starts compiling
Now the 'recursive_button' contains a call to 'recursive', which already
exists as a Pliant object (the Pliant object of a function is created
when entering the function definition), but does not have some code yet
(since the code is bind to the function object when leaving the function
definition), so the 'recursive' instruction in the 'recursive_button'
fonction simply calls an empty function.
This would not append with a standard functions because they are usually
compiled one after the other. Here, the HTTP server machinery makes
two functions compile at the same time, and it breaks Pliant compiler
|Message posted by maybe Willer Alves on 2001/06/06 14:32:48
|So, could you give me any idea about how can i do the recursive action?
I've also tried something like this:
.. body ..
but this doesn't work, too.
I want to create a kind of list of exercises. I create an exercise and after, I choose if I want to finish or add another. If I want to add another exercise, it is needed to repeat the first action.
Thanks a lot!!
|Message posted by hubert.tonneau on 2001/06/14 09:18:22
|You're initial code works in release 59 because Pliant compiler engine
has been enhanced to better carry interlaced functions definitions (when
a function is defined in the middle of another one)
On the other hand, using 'part' will probably never work because there
are two functions (you can see 'button' as an alias of 'function').
|Message posted by pom on 2001/06/14 12:21:49
|Another possibilty could be to allow 'Button' to return a value.
|Message posted by pom on 2001/06/14 12:25:38
|Sorry, this is stupid as button call is not at all a function call.
The code under 'button' has no way to return to the caller.