<< 12-09-2013 >>

00:03:22*mac01021 joined #nimrod
00:31:16*ltbarcly joined #nimrod
00:35:51*ltbarcly quit (Ping timeout: 245 seconds)
00:38:16*ltbarcly joined #nimrod
00:42:56*ltbarcly quit (Ping timeout: 245 seconds)
00:44:17*ltbarcly joined #nimrod
00:49:05*ltbarcly quit (Ping timeout: 268 seconds)
00:49:49*ltbarcly joined #nimrod
00:56:41*mac01021 quit (Ping timeout: 245 seconds)
00:58:46*ltbarcly quit (Ping timeout: 245 seconds)
00:59:48*ltbarcly joined #nimrod
00:59:56*brson quit (Quit: leaving)
01:00:28*DAddYE quit (Remote host closed the connection)
01:02:43*ltbarcly quit (Client Quit)
01:12:00*mac01021 joined #nimrod
02:22:33*q66 quit (Quit: Leaving)
02:45:24*ltbarcly joined #nimrod
02:52:46*ltbarcly quit (Ping timeout: 256 seconds)
02:53:14*XAMPP joined #nimrod
02:53:24*XAMPP quit (Changing host)
02:53:24*XAMPP joined #nimrod
03:02:09*DAddYE joined #nimrod
03:08:20*DAddYE quit (Ping timeout: 245 seconds)
03:39:13*brson joined #nimrod
03:44:04*ltbarcly joined #nimrod
03:47:59*ltbarcly quit (Client Quit)
03:52:05*mac01021 quit (Ping timeout: 248 seconds)
03:55:41*ltbarcly joined #nimrod
04:00:35*OrionPK quit (Quit: Leaving)
04:05:24*DAddYE joined #nimrod
04:07:45*ltbarcly quit (Ping timeout: 276 seconds)
04:09:44*ltbarcly joined #nimrod
04:11:40*DAddYE quit (Ping timeout: 245 seconds)
04:14:54*ltbarcly quit (Ping timeout: 276 seconds)
04:17:22*ltbarcly joined #nimrod
04:22:19*ltbarcly quit (Ping timeout: 256 seconds)
04:23:24*ltbarcly joined #nimrod
04:28:31*ltbarcly quit (Quit: Computer has gone to sleep.)
04:40:04*ltbarcly joined #nimrod
04:44:35*ltbarcly quit (Ping timeout: 240 seconds)
04:46:35*ltbarcly joined #nimrod
04:50:53*ltbarcly quit (Client Quit)
04:56:28*DAddYE joined #nimrod
04:58:55*Associat0r joined #nimrod
05:01:04*Associ8or quit (Ping timeout: 264 seconds)
05:46:55*DAddYE quit (Remote host closed the connection)
05:56:13*brson quit (Quit: leaving)
06:01:08*MFlamer joined #nimrod
06:01:25MFlamerHey Araq, you around?
06:11:32*comex quit (Ping timeout: 260 seconds)
06:11:39*comex joined #nimrod
06:12:21*MFlamer quit (Ping timeout: 250 seconds)
06:15:55*DAddYE joined #nimrod
07:02:09*ltbarcly joined #nimrod
07:28:22*DAddYE quit (Remote host closed the connection)
07:28:54*DAddYE joined #nimrod
07:33:20*DAddYE quit (Ping timeout: 245 seconds)
08:29:31*DAddYE joined #nimrod
08:35:51*DAddYE quit (Ping timeout: 245 seconds)
08:56:28*Araq_ joined #nimrod
09:00:52*Araq__ joined #nimrod
09:04:35*Araq_ quit (Ping timeout: 245 seconds)
09:24:27*Araq__ quit (Quit: ChatZilla 0.9.90.1 [Firefox 23.0.1/20130814063812])
09:32:40*DAddYE joined #nimrod
09:38:45*DAddYE quit (Ping timeout: 245 seconds)
09:45:24*q66 joined #nimrod
10:08:24*Araq_ joined #nimrod
10:35:44*DAddYE joined #nimrod
10:42:05*DAddYE quit (Ping timeout: 245 seconds)
10:49:35*Araq_ quit (Ping timeout: 245 seconds)
11:09:06*Araq_ joined #nimrod
11:38:48*DAddYE joined #nimrod
11:45:01*DAddYE quit (Ping timeout: 245 seconds)
12:03:42*shevy joined #nimrod
12:32:01*Araq_ quit (Quit: ChatZilla 0.9.90.1 [Firefox 23.0.1/20130814063812])
12:41:48*DAddYE joined #nimrod
12:48:20*DAddYE quit (Ping timeout: 245 seconds)
13:10:52*faassen joined #nimrod
13:44:57*DAddYE joined #nimrod
13:52:06*DAddYE quit (Ping timeout: 276 seconds)
14:06:50*noam_ quit (Read error: Connection reset by peer)
14:10:05*noam_ joined #nimrod
14:30:24*faassen quit (Quit: Leaving.)
14:44:51*Hannibal_Smith joined #nimrod
14:48:17*DAddYE joined #nimrod
14:54:14*shodan45 joined #nimrod
14:54:35*DAddYE quit (Ping timeout: 245 seconds)
14:57:26*ltbarcly_ joined #nimrod
14:59:06*ltbarcly_ quit (Client Quit)
15:44:17*Mat2 joined #nimrod
15:44:20Mat2hi all7
15:44:25Mat2eh hi all
15:51:29*DAddYE joined #nimrod
15:52:11*Mat2 is now known as Mat2-coding
15:57:30*DAddYE quit (Ping timeout: 245 seconds)
16:07:10*brson joined #nimrod
16:32:09*Araq_ joined #nimrod
16:57:40*DAddYE joined #nimrod
16:59:11*MFlamer joined #nimrod
16:59:29Araq_hi MFlamer, now I'm around
16:59:49Mat2-codinghi Araq_
17:00:11Araq_servus Mat2-coding
17:01:10MFlamercool, I wanted to ask what types you see being stored in our lock free table? We can easily store 32 or 64bit types and pointers. But any use of a pointer after is not going to be atomic
17:03:06Araq_not sure what you mean. do you mean the table takes over the ownership of some pointer I pass to it?
17:09:02Araq_well in any way the table should support for keys every type that has a 'hash' implementation and for values every type
17:09:45MFlamerNo, I guess I'm having trouble wrapping my head around how atomically getting a pointer to shared memory is useful. What can a thread do with it? One you have multiple threads stomping on an object in shared memory, things are screwed anyway, correct?
17:11:35Araq_well no
17:11:55Araq_a shared hash table is very useful for lots of things
17:12:15Araq_that it is "lock free" is only an implementation detail to make it faster
17:12:42MFlamerThe lock free table can only store 32 or 64 bit types as values, due to the underlying need for atomic load, store and CAS operations. Is that useful enough?
17:12:53Araq_look at the profiler's code for a good use case
17:14:00Araq_I'm not sure of the details but you should be able to reserve a slot with these atomic operations
17:14:27Araq_and once you have a slot you can copy the values into it with no syncronisation
17:17:08Araq_I guess you need a "version number" for the table or a stride of it and if the version changed, you need to retry
17:17:54Araq_essentially implementing a special cased STM
17:22:03MFlamerI think the idea is that using atomic ops you can get a pointer from the table, then use acquire and release semantics to safely modify the object. Something like that. I have a simple prototype now I need to get the dynamic resizing implemented.
17:24:27Araq_yeah but you may be right that the Java implementation relies on the fact it only stores two pointers
17:24:43Araq_for the (key, value) pair
17:24:55MFlamerYes
17:25:26Araq_well for a first implementation that would be fine too
17:26:20MFlamerAnyway, I'm make good progress and it's an interesting subject. I just wanted to be clear on your opinion. I'll keep you posted on my progress.
17:27:01Araq_excellent
17:27:36Araq_btw that is one of my
17:29:36Araq_points really: the complexity of STM seems to come from the fact that STM needs to be able to deal with an arbitrary number of store operations. For special cases like a hash table that is not necessary and should be much simpler to implement
17:32:12MFlamerYes, I agree. Good call. I think a good STM implementation will be good as a future project. Apparently the newer gcc has some features related specificly to stm, might be interseting to look at later
17:33:46Araq_yup
17:34:04Araq_and btw requiring gcc 4.8 or whatever for that to work is fine with me
17:34:17*ltbarcly_ joined #nimrod
17:34:20MFlamersweet. makes life easier
17:34:28Araq_we can always make somebody provide workarounds via inline assembler later
17:34:39MFlamergot it
17:34:58Araq_in fact you can do it
17:35:19Araq_just dissamble the asm and look how it works ;-)
17:35:59MFlamerI'm gonna be low level concurrent god by the time this is done
17:36:09MFlamer:-)
17:36:21*Mat2-coding fdbg is a nice tool wor this kind of work
17:36:36MFlamerI gotta get back to paying the bills in C++. catch you later
17:36:48Araq_alright, have fun
17:36:50MFlamerfdbg, ok
17:37:17*MFlamer quit (Quit: Page closed)
17:59:46*Araq_ quit (Quit: ChatZilla 0.9.90.1 [Firefox 23.0.1/20130814063812])
18:04:06*Araq_ joined #nimrod
18:09:29*Associat0r quit (Quit: Associat0r)
18:11:32*Araq_ quit (Quit: ChatZilla 0.9.90.1 [Firefox 23.0.1/20130814063812])
18:23:35*DAddYE quit ()
19:08:25*Hannibal_Smith quit (Quit: Sto andando via)
19:43:54reactormonkis there a sleep() in nimrod / JS?
19:45:15reactormonkhm, any setInterval?
19:52:16reactormonkno shift on seqs? Or next on iterators?
19:54:23Mat2-codingwhat do you mean with 'shift on seqs' ? You can access sequence elements indexed
19:54:40*zahary joined #nimrod
19:56:27reactormonkalways need the next element, so I try to find a way so I don't have to explicitly store the items ;-)
19:56:32reactormonks/items/contexts/
20:00:15Araqreactormonk: you wanted c++ support in c2nim, now use it ;-)
20:00:25reactormonkAraq, all in due time
20:00:38Araqwell I am not working on it any more
20:00:44AraqI will fix bugs of course
20:01:33Araqturned out that the parsing of C++ is actually quite boring and not the challenge that I hoped for :P
20:02:43reactormonkAraq, and also nasty?
20:03:04Araqnope
20:03:14Mat2-codingyou want an iterator just for accessing an element successor, is that right ?!??
20:03:29reactormonkyup
20:03:29Araqnot any nastier than C anyway
20:04:01reactormonkspiral(tilingArea(activeClient), 0.5, relevantclients()).items # nice try?
20:05:13reactormonkwhat's the best way to get an iterator I can iterate over?
20:06:20Araqarbitrary lookahead + back tracking is required by both; c++ only adds "ahead of time token stream injection" for the >> shift operator that can close 2 nested template parameter lists
20:07:57Araqwould make another nice blog post about how mutable state does simplify programming ;-)
20:08:54Araqor maybe I'm just too unimaginative how it can be done in FP
20:09:43reactormonkAraq, can you explain the problem >> solves?
20:10:00Araqreactormonk: iterators are not first class so what you want is not easily doable in your way
20:10:07reactormonkkk
20:10:20Araquse seq + an index
20:10:25Mat2-codingyou would define a tail-recursive closure for example, which iterate over the sequence
20:10:58AraqMat2-coding: that is possible with first class iterators but these turned out to be VERY buggy
20:11:18Mat2-codingI agree
20:11:43Araqreactormonk: templateA<templateB<int>> is allowed in C++11
20:12:02Araqnote that >> is however the shift right operator in C++
20:12:33Araqso the parser needs to patch it into > >
20:13:59reactormonkAraq, btw, how do I use setInterval?
20:14:38Araqhow I am supposed to know? I only know about the JS backend, I don't know much about JS or its library in particular
20:15:01*XAMPP quit (Ping timeout: 248 seconds)
20:20:06reactormonkit wants a cstring function name
20:20:13reactormonkhow do I generate one from my proc?
20:22:36AraqastToStr(procname) ?
20:24:53dom96reactormonk: You sure the proc signature is not wrong?
20:33:41Araqping zahary, zahary_
20:35:01zaharypong Araq
20:35:06Araqhttps://pay.reddit.com/r/rust/comments/1d9rko/memory_safe_cc_time_to_flip_the_switch/c9p2aon
20:36:29zaharythis is not true. references extend the lifetime of temporaries
20:37:27zaharyThe second context is when a reference is bound to a temporary. The temporary to which the reference is bound or the temporary that is the complete object to a subobject of which the temporary is bound persists for the lifetime of the reference except as specified below. A temporary bound to a reference member in a constructor’s ctor-initializer (12.6.2) persists until the constructor exits. A temporary bound to a reference parameter in a function call (5.2.
20:39:40zaharyalthough I have to look at the definition of min to see the return type
20:43:50Araqwell it outputs 0 on my machine
20:44:00Araqit should output 3
20:46:13Araqwell if it's true, I think our destructors design is actually really good. It ensures it's bound to a variable so you know when the destructor is invoked (at the variable's scope ending)
20:46:22zaharystd::min indeed returns by reference and the problem is valid, because the "binding to temporary" is indirect here
20:48:22zaharytemporaries are nice for shorter code
20:48:41Araqnice you have the ansi c++ standard under your pillow btw ;-)
20:48:42zaharywe can also solve the issue by not destructing them "at the semicolon" as in C++
20:49:23zahary:) google found the quote for me
20:50:59Araqyeah we can do proper lifetime and escape analysis to deal with it
20:51:57Araqbut it makes me proud of the current design anyway :-)
20:52:39zaharyI meant a simpler solution.
20:52:39zaharybasically, with explicit variables you propose the code to be written like this
20:52:39zaharyvar a = string("foo")
20:52:39zaharyvar b = string("bar")
20:52:39zaharyvar c: var string = min(a, b)
20:52:40zahary
20:52:40zaharyc goes out of scope before a and b
20:53:21zaharyyou can assign the same lifetime to the temporary just as if there was a variable declared at the spot
20:54:22zaharystring here is something like the C++'s string (object with destructor)
20:54:42Araqsure but the 'var string' shouldn't invoke the destructor at scope exit
20:55:06Araqit's only an alias
20:55:12zaharyyes, it doesn't
20:55:27zaharythe lifetime of a and b is important here
20:55:52Araqyeah and it's obvious because we made the programmer name them explicitly
20:56:42zaharyyes, but I'm saying that the compiler can inject "faux variables" when seeing expressions such as min(string("foo"), string("bar"))
20:57:12Araqbut what is the (dynamic) scope of these faux variables?
20:57:18Araqhow do you compute the proper scope?
20:57:32zaharyexactly the same if you had written normal variables on the previous line
20:58:19Araqif a and (let temp = ...; ) # oops
20:58:59Araqyou must not do the 'let temp = f()' before 'if a' is true
21:00:28zaharyI'm not quite following. is "let temp" injected here or written by the user?
21:00:41reactormonkdom96, that's what dom.js is
21:00:47Araqok one step back:
21:00:58Araqif a and f() # original code
21:01:11Araqf returns a destructable type
21:01:21Araqthe compiler must not rewrite it to:
21:01:25Araqlet temp = f()
21:01:32Araqif a and temp: ...
21:02:04zaharywell, sure - you take my words too literally
21:02:42Araqit can rewrite it to: if a and (let temp = f()) but then you have:
21:02:51zaharythe problem with C++ is the early destruction - temporaries are destroyed on the nearest semicolon - basically you want to keep them alive in a scope greater than the newly introduced alias (that can be a return value from a function call involving the temporary)
21:03:58Araqif a and (let temp = f()) { ... } # destructor called at }
21:04:52Araqwhereas if the programmer writes it, it is: { let temp = f(); if a and temp ... { } } # destructor called at }
21:05:16Araqhmm makes me think if what we do here is actually sound wrt conditionals
21:06:12zaharywhat's wrong with the first example? the destructor is called when the if block finishes, which sounds right
21:07:03Mat2-codingzahary: How do you set the right position for invoking destructors ?
21:07:20zaharywe invoke destructors manually in the C code
21:08:17Araqoh but it's not
21:09:02Araqif a or (let temp = f()): ... # destruct temp here?
21:09:16Araqhowever the explicit 'temp' doesn't help us
21:09:26*shafire joined #nimrod
21:09:36shafireI knew, you were it ;)
21:09:39Mat2-codinghi shafire
21:09:43shafirehi Mat2-coding
21:10:01Araqin fact ... the scope doesn't reflect the conditional life-time, nor can it
21:10:58Araqthe explicit 'temp' helps a bit because you cannot access it in the body anyway and expect it too work
21:11:24Araqunless you do 'if not a: echo tmp' ... gah
21:11:29Araqin the body
21:12:20Araqmakes me wonder how C++ does that, I need to try it
21:13:02zaharyagain, C++ destroys temporaries at the nearest semicolon (whole expression)
21:13:03Mat2-codinginvoking destructors as soon as possible I suggest
21:13:23zaharyif(foo()) {} // the return value of foo will be destroyed before entering the if block
21:13:55Araqah yeah
21:14:11Araqso it can invoke the destructor unconditionally
21:14:31Araqwell hmm
21:15:09zaharyI'm still not completely grokking your previous argument. why cant I destroy the temporary only if it was created at the end of the if block?
21:15:37zaharybut anyway - even this is not a real problem, because only newly created aliases pose the risk we are discussing here
21:16:09zaharyis it valid to write if a and (b: var T = min(T(), T()):
21:16:36Araqwell one problem is that the constructor might be called in a condition
21:16:43zaharyif a and (let b: var T …
21:16:52Araqand the destructor needs the same condition
21:17:09Araqwe can't simply invoke it at some scope end
21:17:43Araqlook at my 'or' example
21:18:51Mat2-codingneed some sleep, ciao
21:19:00*Mat2-coding quit (Quit: Verlassend)
21:19:01Araqgood night Mat2-coding
21:19:42zaharyit seems to me that generating a code that calls the destructors in the reverse order the objects will potentially be constructed is enough - there should be labels in the code that allow me jump to execute a subset of the destruction sequence
21:21:46Araqwell you need to produce this:
21:22:12Araqif a or (let tmp = f(); f_constructed = true): ...
21:22:25Araq if f_constructed: destruct(tmp)
21:31:28zaharymy point is that you don't need this.
21:31:28zaharythere are number of conditionals before the if block is entered - these can be mapped to multiple if statements
21:31:28zaharyif condition1: goto after_if
21:31:28zaharycreate temp1
21:31:28zaharyif condition2: goto destroy_temp1
21:31:29zaharycreate temp2
21:31:29zaharyif condition3: goto destroy_temp2
21:31:30zaharynormal if block
21:31:31zahary
21:31:31zaharydestroy_temp2: destroy(temp2)
21:31:31zaharydestroy_temp1: destroy(temp1)
21:31:32zaharyafter_if:
21:32:14*shafire left #nimrod (#nimrod)
21:33:30*shafire joined #nimrod
21:35:46AraqI'm pretty sure this doesn't work
21:36:17Araqbut I can't come up with a counter example right now
21:36:22zaharyah, I figured the problem is the "or" operator
21:36:32zaharyok, thinking about it
21:53:17*BitPuffin joined #nimrod
22:21:15Araqhi BitPuffin, use my new c2nim
22:24:57BitPuffinhaha hey Araq, why?
22:56:27*shafire quit (Quit: Page closed)
22:58:49BitPuffinturning off irc to save resources
22:59:00*BitPuffin quit (Remote host closed the connection)
23:04:36*mac01021 joined #nimrod
23:04:56Araqhi mac01021 wb
23:05:38mac01021hi, Araq
23:05:55mac01021just checking out the channel to get a feel for how active it is
23:20:23Araqwell check out our logs then
23:36:47*Associat0r joined #nimrod
23:36:47*Associat0r quit (Changing host)
23:36:47*Associat0r joined #nimrod
23:50:48*ltbarcly_ quit (Read error: Operation timed out)