Log of the #nice channel on irc.freenode.net

Using timezone: Central European Time
<arjanb>i was busy with other things01:45
good night
<CIA-3>03bonniot * 10Nice/ (4 files in 4 dirs):
Do not allow overriding involving specialization of type parameters, as this is
unsafe since dispatch does not consider type parameters.
* arjanb leaves01:46
* CIA-3 leaves03:14
* CIA-3 joins
* bonniot leaves03:18
* arjanb joins11:11
* bonniot joins12:56
* CIA-3 leaves13:18
* CIA-3 joins
* CIA-3 leaves
* CIA-3 joins13:19
<bonniot>so, the problem with overriding should be solved now14:10
thanks for discovering the problem!
i have to go now cu tomorrow
* arjanb leaves
* CIA-3 leaves14:57
* MrAvik joins16:10
* MrAvik leaves16:11
* bonniot leaves17:19
* Bluelive leaves
* ChanServ leaves
* ChanServ joins
* bonniot joins
* Bluelive joins
* CIA-3 joins18:53
<Bluelive>functions with yield's instead of a return, does nice support it ?19:48
<bonniot>no, but you can often use anonymous functions instead19:52
<Bluelive>im thinking about implementing them but i keep tripping over variables19:54
parameters to these functions seem weird, and local variables you have the problem if you push them into the class instance the generator is a memeber of or resetting them for every call19:55
* Bluelive_ joins20:12
* Bluelive_ leaves
<bonniot>i think the variables are not supposed to be reset22:36
did you check the semantics in languages that support them?
do you have a canonical example?22:37
not resetting the variables would move them into the class instance, pretty expensive,23:32
<bonniot>how is it usually implemented?23:42
<Bluelive>ive only seen it used in functional languages and i have no idea how they go about their memory ;)23:43
guess ive hooked my first user23:47
<bonniot>how? :-)23:50
<Bluelive>i used to go to all these hacker irc channels, and ive just been spamming them a bit, and a few picked it up, seems they like the 'safe c++' aspect23:51
but as far as i know them it could either go quiet or takeof, not very predicatable people23:54
<bonniot>quit or double!00:01
<Bluelive>quit ? never !00:04
<Bluelive>well they are the sort that believe in perl so i can convince them of anything ;p
it's possible to implement yields using a thread in pure Nice...00:07
<Bluelive>using a thread to implement yield, thats far more expensive then what i was thinking about :)00:10
<bonniot>depends how expensive a thread is :-)00:11
<Bluelive>well anyways alpha doesnt have threads, or a gc that could correctly handle them00:14
i was thinking more along the lines of just jumping to just after a yield with an goto or something
<bonniot>but goto is intraprocecedure, no?00:16
wht about setlongjump?
longjmp doesnt let you reenter
<bonniot>the function should only start running when the first value is needed, right?00:17
<Bluelive>im not sure what you mean by need ?00:19
<bonniot>when the context asks for a value00:24
yield produces a value, which is consumed somewhere
<Bluelive>guess im thinking a little too much like a c coder i guess00:25
i was thinking about yield functions like a normal function which has yield as return, but when called again continues just after the yield
<Bluelive>one place where this could be handy is code which mimicks blocking io by returning to the main message loop when io blocks
<bonniot>this is python code:00:28
def fib():
a, b = 0, 1
while 1:
yield b
a, b = b, a + b
fibber = fib()
for i in range(10):
print fibber.next() # prints 1, 1, 2, 3, 5, 8, 13, 21, 34, 55
a generator as a type on itself00:29
<Bluelive>well fib() has fields, like .next()
so i figure its a type
has a
<bonniot>yes, i think those two stages are important00:30
otherwise you could only get the list of numbers once in the whole program
<Bluelive>well this could simply be rewritten into some type of class00:31
variables into class instance
methods for the sections between yields, and a dispatch method so that the right section gets executed
it's a non-trivial rewrite though
<Bluelive>though yields at different depths could be troublesome
<bonniot>i.e. it seems hard to write that as a library
depth of what?
<Bluelive>nested statements00:33
<bonniot>can't you simply keep the structure of the method and add gotos?00:35
<bonniot>simpler :-)
<Bluelive>ah the wonder of goto's
generator as something on itself or a method an a class ?00:36
questions questions00:37
<bonniot>you mean with or without next?00:39
and as a type on itself or just another flavor of method
of it can be a method its also a delegate, so that would be a good thing
<bonniot>having several "instances" is desirable, no?00:42
delegates can have multiple instances00:44
because they are a pair of object instance and method pointer
<bonniot>i know00:46
but so what are the different options?00:47
<Bluelive>a 'generator' type, a generator method, a generator collection like class
<bonniot>is that only a question of syntax?00:49
<Bluelive>and implementation00:50
<bonniot>now i can do:01:07
void fib(int->void yield)
int a = 1, b = 1;
while (true) {
(a, b) = (b, a + b);
void main(String[] args) {
let f = generator(fib);
println("0 " f());
println("1 " f());
println("2 " f());
class Something
generator int fib()01:21
int a:=1;
int b:=1;
while (true)
yield b;
int t:=b;01:22
or somethign
should have typed it out before trying it on irc :)
<bonniot>yes, only that will need compiler support01:24
i was just doing a quick try at a pure Nice solution
(generator is a user function)
<Bluelive>so that works directly in nice at the moment ?
using a thread ;-?
<Bluelive>im not sure how your going to fix the stack in this example
ah your not :)
java is going to throw an exception after only a few hundred, maybe thousand calls01:26
no its not
<bonniot>no, the stack is not growing
<Bluelive>your going to return from the yield
im not awake
<Bluelive>the alarm clock goes in 5.5 houres01:27
<Bluelive>yeah i know :)
well at least the cat is having a great time, hes been hunting the same mouse for over an houre now, and it still lives...01:28
well time to log off
thanks for the example
<bonniot>no pb
<Bluelive>i could do the same with a delegate i presume, if i had threads
<Bluelive>hmz, what if i dont use a thread, but place the call on a secundary stack...01:29
so that enetering the yield function actaully lets the alpha stack go back to calling the next()
ideas :)
<bonniot>don't you use normal C calls?01:30
<Bluelive>yes but i dont use the c stack for alpha data
returning to main from the yield is easy with a longjmp, but going back to where the yield reenters01:32
im not sure if thats possible

Generated by Sualtam