<< 07-11-2014 >>

00:00:57Jehan_On the other hand, my diagnosis of the deadlock seems to be wrong, the wait should release the lock.
00:07:23Jehan_Hmm, the deadlock situation is really puzzling.
00:07:48Jehan_Even if I explicitly release the lock and sleep forever, the other thread can't seem to acquire it.
00:12:47*flaviu quit (Remote host closed the connection)
00:15:02Araqwell it works fine when I uncomment the GC_unref here
00:15:07Araqno deadlock
00:16:13onionhammerdom96_ it looks like you use them for both request and respnse
00:16:38Jehan_Araq: Yeah, I'm using a different example, and the deadlock actually may be due to the GC_unref, too.
00:16:49Jehan_I still get a crash with it being commented out, I think.
00:16:51onionhammerdom96_ look at :649
00:17:11AraqJehan_: well it's not safe to simply remove it either
00:17:17AraqI'm fixing the codegen
00:17:42dom96_onionhammer: perhaps, but if the user adds their own they should only add them once.
00:17:45onionhammerdom96_ then on line 211 you assign a diff one
00:17:56onionhammeryeah i dont disagree..
00:18:03dom96_so we need another field
00:18:18onionhammeryou just shouldnt modify the httpclient object with the request
00:18:24onionhammeryou should return a new object
00:18:33dom96_huh?
00:18:56dom96_the request proc shouldn't have the extraHeaders param
00:19:07onionhammeryou're muddling httprequests and httpresponses
00:19:09onionhammerblurring the lines
00:19:58dom96_oh, I see what you mean
00:20:08onionhammeryou shouldnt modify the httpclient when you do a request, you should just return a Response object
00:20:20Jehan_Ah, works now. I had an echo of an int in a finalizer, which was a bad idea.
00:20:22dom96_request() already returns a Response obj
00:20:30onionhammeri kno
00:20:35onionhammerbut why modify the httpclient
00:20:50Araqonionhammer: for performance.
00:20:56Jehan_Araq: I still think you can discard the release/acquire around the wakeupWorkerToProcessQueue call.
00:21:07Jehan_wait() will do a release implicitly.
00:21:13onionhammerAraq how does that improve performance
00:21:15Araqhow so?
00:21:28Araqonionhammer: keeps GC pressure lower
00:21:38onionhammerresult.headers = newStringTable(modeCaseInsensitive)
00:21:49onionhammeractually that is modifying the Response
00:21:53onionhammernot the client
00:22:07Araqonionhammer: note that I don't know the code at all
00:22:41AraqJehan_: how does that help with the first loop iteration?
00:22:53Araqwakeup is called before wait
00:23:20*rpag joined #nimrod
00:23:24Jehan_Araq: Yes, but what's the point of it? The reacquire will likely happen before the other thread has a chance to acquire the lock.
00:23:42Jehan_So it'll block until the wait() call anyway.
00:23:55onionhammerdom96_ the more i look at it, the more i think that the headers field just needs to be public...
00:24:32Jehan_It's essentially a pair of expensive noops. Granted, should be a path that's rarely ever taken, but then it's just noise.
00:24:43onionhammerthe client header table isnt used in the respnse anywhere i can see
00:24:46AraqJehan_: I still don't get wait, lol
00:24:58Araqit's simply to weird with that explicit lock
00:25:10Jehan_wait atomically unlocks the mutex and suspends execution until it receives the signal.
00:25:25Jehan_Then it atomically reacquires the mutex and resumes execution.
00:25:58Jehan_The atomic unlock is important to avoid race conditions.
00:26:17*flaviu joined #nimrod
00:29:06Araqnah, it's totally weird. signal(foo); await(foo) is the intuitive way to do it.
00:29:27Araqthe locking is an implementation detail
00:29:46Jehan_Not when operating on shared state (well, not always).
00:30:30Araqthe spurious wakeups too btw are an implementation detail
00:30:42Araqbut we discussed this before
00:30:52Jehan_Yup, they are, and an annoying one.
00:31:11Jehan_But they greatly simplify the implementation, so it's become part of the spec.
00:32:39Araqso again, the acquire before the wait is redundant, right?
00:32:57dom96_onionhammer: Hrm, I think you're correct. I thought `result.headers` referred to AsyncHttpClient.headers now Response.headers. Silly me.
00:34:19Jehan_The pair of release + acquire.
00:34:30dom96_onionhammer: So yeah, PR please if you can.
00:34:35Jehan_That surround the wakeup call.
00:34:42Araqwhich release?
00:34:46Araqwhat? why?
00:34:59Araqoh
00:35:01Araqnow I get it
00:35:03Araqok
00:36:11*saml_ joined #nimrod
00:36:18*Joe_knock left #nimrod ("Leaving")
00:38:45Jehan_Oh, and here's a good explanation for why a mutex is needed: http://stackoverflow.com/questions/2763714/why-do-pthreads-condition-variable-functions-require-a-mutex/2764003#2764003
00:42:46onionhammerdom96_ you're gonna hate me
00:43:08onionhammerdom96_ i stripped all the extra whitespace after line endings :P
00:44:17Araqthat's nice. but I still think if 'diff' somehow manages to treat my file as plaintext with line endings and stuff, it should be able to also ignore trailing whitespace.
00:44:44dom96_onionhammer: that's fine. Github can diff without showing those I think
00:45:04dom96_Aporia needs a "don't add extra whitespace" feature
00:45:26Araqbut yeah yeah yeah, let's instead pretend it's 1960 and blame the programmer for not caring about it.
00:46:33onionhammerk
00:49:38Araqhttp://www.dinduks.com/why-are-trailing-whitespaces-bad/
00:50:18*darkf joined #nimrod
00:55:01NimBotAraq/Nimrod devel 06e9932 Araq [+0 ±2 -0]: fixes exhaustion bug and missing GC_ref code generation
00:55:12AraqJehan_: please review
00:56:14Jehan_Araq: Okay, give me a second.
00:56:23Araqnah, take your time
00:56:33AraqI have to sleep now anyway
00:56:47Araqalso somebody should really test awaitAny
00:57:47Jehan_It's still sometimes hanging for me.
00:58:24Jehan_On this code: https://gist.github.com/rbehrends/95b8b91275e3c97709c1
00:58:28Jehan_Only hangs sometimes.
01:00:04Jehan_Not really sure yet what's causing it, but the changes that I'm seeing seem to make sense.
01:00:12Jehan_So there's not an obvious bug here.
01:00:43*BitPuffin quit (Ping timeout: 244 seconds)
01:04:30Araq # wakeup other potentially waiting threads:
01:04:32Araq if waited: signal(q.empty)
01:04:38Araqis that even correct now?
01:04:59Jehan_You mean, necessary?
01:05:10Araqthat too
01:05:40Jehan_Well, most likely it's going to be discarded.
01:07:26Jehan_So, at most it's going to be a waste of clock cycles. :)
01:07:26*shodan45 joined #nimrod
01:08:13Araqwell I confirm
01:08:20Araqhangs quite often in fact
01:08:54Araqbut I think you need QueueSize >= #WorkerThreads
01:09:00Jehan_Looking at it in gdb right now.
01:09:10Araqand the QueueSize is 2 to stress test it
01:10:12Jehan_Hmm, I wonder if it has to do with the fact that main() is also a spawned task.
01:10:46Araqwell it also hangs when I do: setMaxPoolSize 2
01:10:55Araqso that's not the problem
01:11:57Jehan_It's hanging in finished, for what it's worth.
01:12:09Jehan_With all the other worker threads waiting for an incoming task.
01:12:23Jehan_Anyhow, I need sleep. Will have to look at it tomorrow.
01:12:30Jehan_Night!
01:12:36*Jehan_ quit (Quit: Leaving)
01:12:42Araqok, same here, good night
01:34:22*brson quit (Ping timeout: 256 seconds)
01:35:32*fowl quit (Quit: Leaving)
01:36:25*clone1018__ quit (Ping timeout: 255 seconds)
01:39:04*brson joined #nimrod
01:40:03*clone1018_ joined #nimrod
01:44:06*superfunc joined #nimrod
01:58:34*AMorpork is now known as AFKMorpork
02:12:19*mko quit (Ping timeout: 245 seconds)
02:36:42*brson quit (Ping timeout: 265 seconds)
02:47:46*q66[lap] quit (Read error: Connection reset by peer)
02:50:10*q66[lap] joined #nimrod
03:16:29*q66 quit (Quit: Leaving)
03:21:28*flaviu quit (Ping timeout: 256 seconds)
03:31:36*boydgreenfield joined #nimrod
03:31:38boydgreenfieldIs it possible to have a function in nim take a conditional branch based on the type of an argument? E.g., coerce a string into a cstring to pass to a C library, but coerce a cint into a pointer to pass to the same C function?
03:32:21boydgreenfield(Specifically trying to get a general wrapper for the setsockopt in the zero-mq nimrod wrapper, which treats everything as a string despite zeromq requiring that some option values be passed as integers: https://github.com/nimrod-code/nim-zmq/blob/master/zmq.nim)
03:32:43*boydgreenfield quit (Client Quit)
03:34:10*brson joined #nimrod
03:35:17*brson quit (Client Quit)
03:35:35*brson joined #nimrod
03:43:40*boydgreenfield joined #nimrod
03:52:38*superfunc quit (Quit: Connection closed for inactivity)
03:57:14*BitPuffin joined #nimrod
04:01:15onionhammerboydgreenfield i'd look at http://nimrod-lang.org/manual.html#typedesc
04:01:22*BitPuffin quit (Ping timeout: 240 seconds)
04:02:51boydgreenfieldonionhammer: Ya, I’m looking at that. But can one if/else or case on a typdesc?
04:03:00boydgreenfieldonionhammer: I may just be getting the syntax wrong..
04:04:40onionhammerhttp://nimrod-lang.org/manual.html#type-operator
04:07:17onionhammeri believe i've seen what ur trying to do somewhere but cant find an example..
04:08:13boydgreenfieldonionhammer: Ok thanks. I’m basically trying to do: `if T is string: call_c_function_that_requires_a_string; elif T is cint: call_c_function_that_takes_a_pointer; else fail`
04:08:17onionhammerwithin a macro it's definitely possible
04:08:34onionhammerright, you can use the "is" operato
04:08:35onionhammerr
04:24:13*boydgreenfield quit (Quit: boydgreenfield)
04:40:57*tillzy joined #nimrod
05:04:11*boydgreenfield joined #nimrod
05:16:36*saml_ quit (Quit: Leaving)
05:19:48boydgreenfieldonionhammer: Got it. Will try that.
05:22:00*brson quit (Ping timeout: 265 seconds)
05:27:00*johnsoft quit (Ping timeout: 250 seconds)
05:27:38*tillzy quit (Quit: tillzy)
05:27:39*johnsoft joined #nimrod
05:29:17*boydgreenfield quit (Quit: boydgreenfield)
05:46:29*Fran__ quit (Ping timeout: 245 seconds)
05:50:41*nande quit (Remote host closed the connection)
06:04:01*bjz joined #nimrod
06:37:00*kemet joined #nimrod
06:39:14*Fr4n joined #nimrod
06:46:46*xtagon quit (Quit: Leaving)
06:47:18*q66[lap] quit (Read error: Connection reset by peer)
06:49:15*q66[lap] joined #nimrod
07:06:49*kemet quit (Ping timeout: 265 seconds)
07:54:45*Trustable joined #nimrod
08:09:10Araqboydgreenfield: use 'when' instead of 'if'. 'when T is string'
08:25:01*rpag quit (Ping timeout: 272 seconds)
08:34:47gokrGood morning!
08:46:53*rpag joined #nimrod
08:57:32*q66 joined #nimrod
09:44:37*khmm joined #nimrod
09:47:50*BlaXpirit joined #nimrod
09:48:25*BlaXpirit quit (Client Quit)
09:57:06*q66[lap] quit (Read error: Connection reset by peer)
09:57:50*q66[lap] joined #nimrod
10:10:11*bjz quit (Read error: Connection reset by peer)
10:10:27*bjz joined #nimrod
10:40:39*khmm quit (Ping timeout: 245 seconds)
10:43:55*khmm joined #nimrod
10:48:09*khmm quit (Ping timeout: 245 seconds)
10:54:02*khmm joined #nimrod
11:04:52*Fr4n left #nimrod ("Leaving")
11:24:07*khmm quit (Ping timeout: 244 seconds)
11:29:37*khmm joined #nimrod
11:36:46*BitPuffin joined #nimrod
11:38:38gokrBtw, drone.io seems... quite easy to get started with - and its free for public projects it seems.
11:39:16gokrAlso, drone is open source, I am going to try it I think.
11:44:54NimBotAraq/Nimrod devel f31c623 Erik O'Leary [+0 ±1 -0]: Made 'headers' public
11:44:54NimBotAraq/Nimrod devel 96d1543 Dominik Picheta [+0 ±1 -0]: Merge pull request #1639 from onionhammer/devel... 2 more lines
11:55:11*khmm_ joined #nimrod
12:24:17woodgiraffeHow do you initialize an array[uint8, int] - i.e. an array holding int-values with uint8-index-type?
12:27:50*AFKMorpork is now known as AMorpork
12:29:13*Jehan_ joined #nimrod
12:31:07*khmm_ quit (Ping timeout: 245 seconds)
12:31:41*khmm quit (Ping timeout: 255 seconds)
12:33:45*Jehan_ quit (Ping timeout: 250 seconds)
12:37:24*BlaXpirit joined #nimrod
12:44:08*Jehan_ joined #nimrod
12:44:41*dom96_ quit (Ping timeout: 272 seconds)
12:58:15*q66[lap] quit (Read error: Connection reset by peer)
12:59:20Araqwoodgiraffe: const|let|var foo: array[uint8, int] = [1, 2, 3 ... ]
12:59:34Araqfollowed by 256 elements, so good luck with that
12:59:48Araqhowever, you can use a macro to construct it
13:00:20*q66[lap] joined #nimrod
13:00:25Araqplus it's 0 initialized for you so if 0 is the value you need you don't need any initializer
13:02:43woodgiraffeAraq: ahhhh I get it, thanks
13:04:16*q66[lap] quit (Read error: Connection reset by peer)
13:05:06*khmm joined #nimrod
13:05:40*khmm_ joined #nimrod
13:05:43*q66[lap] joined #nimrod
13:06:51*khmm_ quit (Read error: Connection reset by peer)
13:07:07*BitPuffin quit (Ping timeout: 250 seconds)
13:08:00*Jehan_ quit (Quit: Leaving)
13:09:06*Jehan_ joined #nimrod
13:10:37*JehanII joined #nimrod
13:10:37*Jehan_ quit (Read error: Connection reset by peer)
13:15:29*JehanII quit (Ping timeout: 260 seconds)
13:25:20*saml_ joined #nimrod
13:37:41*Etheco joined #nimrod
13:42:03*kemet joined #nimrod
13:44:27gokrI noticed eventually that `..`in a for loop is actually not a Slice creation, but an alias for countup. So... is there any reason we don't have items() for Slices?
13:44:59gokr(after trying to play with woodgiraffe's uint8 miseries)
13:50:56AraqI never needed it
13:51:57gokrit would feel a bit more symmetrical. Like "var r = 0..255" and then later "for i in r: blabla"
13:52:31Araqyeah but then who writes var r = 0..255
13:52:44gokr(and Smalltalk treats Intervals like iterables)
13:54:30gokrWell, I am not really certain how Slices are used. Perhaps they aren't "Intervals" but they seem to be.
13:58:08Araqyeah but they only exist because there are no ternary operators that can look like x in a..b
13:58:24Araqso we need to construct a..b separately
13:58:35Araqto get this nicely looking syntax
13:59:29Araqif you need more interval ops I think we should create an intervals module
13:59:40Araqas system.nim is already bloated
14:00:46gokrIn Smalltalk Interval is actually a subclass of the abstract SequencableCollection - so they behave just like they do. Yeah.
14:16:33*gokr_ quit (Ping timeout: 258 seconds)
14:20:23*saml_ quit (Ping timeout: 240 seconds)
14:28:01woodgiraffeSo > let si:int = 8'u < isn't covered by implicit conversions, how do I convert this explicitly?
14:29:28woodgiraffeStupid question, toInt
14:31:54woodgiraffeExcuse me, toInt is only declared for float-parameters.
14:33:36woodgiraffeI guess casting here is fine?
14:37:26gokrlet si:int = int(8'u)
14:37:58gokrIt seems to me that... unsigned ints are... a bit of paria in Nim land.
14:39:35woodgiraffegork: thanks
14:39:37woodgiraffeis int() a proc?
14:39:49gokrNo, its a type conversion.
14:40:26woodgiraffeI see, it's part of random examples in the manual but never mentioned as such
14:40:44gokrhttp://nimrod-lang.org/manual.html#type-conversions
14:41:19woodgiraffeI already opened a ticket proposing enhancing that section
14:41:38woodgiraffeWhat's the idea behind not letting implicit conversion take care of unsigned <-> signed?
14:42:49woodgiraffeI suspect you won't notice by seeing a variables usage if it's signed?
14:43:06woodgiraffeint() seems fine, not too verbose
14:45:31*dom96_ joined #nimrod
14:48:28NimBotAraq/Nimrod devel 13e3c0d Dominik Picheta [+0 ±3 -0]: Implement SO_REUSEADDR for asyncnet and asynchttpserver.
15:01:39woodgiraffeI seem to fail to add two unsigned ints: http://ix.io/f5t
15:04:48dom96_import unsigned
15:04:49*BitPuffin joined #nimrod
15:05:11woodgiraffedom96_: much obliged
15:05:55dom96_:)
15:07:44*khmm quit (Ping timeout: 265 seconds)
15:11:54*darkf quit (Quit: Leaving)
15:20:58*khmm joined #nimrod
15:23:12woodgiraffeMight help mentioning that in the manual, it currently isn't.
15:25:21woodgiraffeHow is the policy on contributing to documentation anyway? - Can I just write a barely comprehensible small paragraph and create a PR for it? - Should I just create an issue? - Should I just mention it here?
15:33:46dom96_If you only mention it here it may be ignored.
15:33:59dom96_So create an issue.
15:34:10dom96_I think the plan is to get rid of this unsigned module anyway.
15:35:41woodgiraffeWill do
15:39:16*kemet quit (Ping timeout: 256 seconds)
15:41:18*Jehan_ joined #nimrod
15:57:39*gokr_ joined #nimrod
16:01:22*untitaker quit (Ping timeout: 256 seconds)
16:03:07*khmm quit (Ping timeout: 255 seconds)
16:06:25*untitaker joined #nimrod
16:16:15*mko joined #nimrod
16:29:03*q66[lap] quit (Read error: Connection reset by peer)
16:30:06*q66[lap] joined #nimrod
16:41:12*q66[lap] quit (Read error: Connection reset by peer)
16:41:53*q66[lap] joined #nimrod
16:47:37*dom96_ quit (Ping timeout: 246 seconds)
16:53:42*BlaXpirit-UA joined #nimrod
16:54:02*BlaXpirit quit (Ping timeout: 245 seconds)
17:17:59*Matthias247 joined #nimrod
17:20:12*kemet joined #nimrod
17:21:29*johnsoft quit (Ping timeout: 250 seconds)
17:22:05*kemet quit (Client Quit)
17:22:11*johnsoft joined #nimrod
17:23:45*gokr_ quit (Ping timeout: 260 seconds)
17:26:49*dom96_ joined #nimrod
17:29:48onionhammerhmm
17:30:00onionhammerfilter(toSeq items(), (x: int) => x mod 2 == 1)
17:30:12onionhammerwhere items() has type int
17:30:28onionhammerim getting an error but expected one of:
17:30:30onionhammersystem.==(x: int, y: int): booly
17:30:39onionhammer-y
17:30:54onionhammerdo notation works
17:31:32dom96_gist the whole error
17:34:49onionhammerdom96_ https://gist.github.com/onionhammer/ac6c3d8cf06afd9b6354
17:35:18dom96Araq: have you updated the c sources correctly?
17:36:16dom96echo filter(toSeq items(), (x: int) => (x mod 2 == 1))
17:38:30onionhammerso just putting parens arond the x mod 2 == 1 part huh
17:39:41dom96does it work?
17:39:49onionhammeryeah
17:40:01onionhammerkinda hacky though
17:40:06dom96do you know why?
17:40:59onionhammerim guessing the == 1 part is left out of the right-hand expression passed to =>
17:41:13dom96yeah
17:41:26onionhammerbut it shouldnt be
17:41:29onionhammerideally
17:42:10onionhammer=> should be greedy, but it's just a macro right now i guess..
17:42:37dom96yes
17:42:53dom96something to talk to Araq about
17:43:13onionhammeryeah
17:43:18onionhammeralrght, next component
17:43:21onionhammerchaining a map after a filter
17:43:43onionhammersay that instead of "echo"ing the result of that filter
17:43:51onionhammerI save it to a variable
17:43:55onionhammervalues.map(x => $x)
17:43:58onionhammerthis gives another error
17:44:13onionhammerError: type mismatch: got (seq[int], proc (GenericParam): auto)
17:46:28dom96you probably need to specify the types explicitly
17:47:54onionhammerlike how
17:48:22onionhammeroh
17:48:39onionhammervalues.map((x: int) => $x)
17:48:41onionhammerthat works..
17:50:38onionhammerhttps://gist.github.com/onionhammer/8c4dd13e2f4a92ad8102
17:51:05onionhammerseems flimsy, not robust
17:51:25onionhammerone missing explicit type or parenthesis and it stops compiling
17:51:48onionhammerweird that map needs the explicit type but filter doesnt
17:52:42dom96Yeah. I'm not sure what we can do to improve that.
17:52:55dom96type inference can be improved I hope
17:53:07dom96and parenthesis should perhaps just be mandatory
17:53:49onionhammerthat would have far reaching consequences
17:54:23onionhammerimo it would be cool if nims compiler could back out during compilation if the assumed AST structure didnt work
17:54:26onionhammerand try things another way
17:54:31onionhammeridk if thats even remotely feasible
17:55:22onionhammeri.e. values(x => 4 == 5), the AST might say "oh, this is (x => 4) == 5, send it to the compiler, the compiler says "no, try again"
17:56:32dom96problem is that an `==` could be defined for those types
17:56:36dom96and then you get unwanted behaviour
17:57:51onionhammercould be
17:57:54onionhammerbut probably isnt
17:58:01onionhammertypically the compiler would just give up
17:58:06onionhammerand throw an error
17:58:25dom96typically isn't good enough :P
18:00:33onionhammeror maybe a way for macros to give hints to the AST
18:02:34onionhammeror space invocations looking for an expression get everything til the end of the paren block or comma or semicolon
18:02:58onionhammerspace invocation meaning.. "myProc arg1" vs. "myProc(arg1)"
18:05:13onionhammermeh idk, just speculation w/o araq to weigh in
18:05:17onionhammerafk
18:48:20Araqwhen dom96 introduced => we knew its precedence is wrong
18:48:38AraqI have no idea why that now means I should change operator precedences again
18:49:14Araq=> is simply a language showoff thing like everything in the "future" module
18:49:55Araqit's fine to use it but don't complain my spec doesn't give a shit about it
18:50:15dom96I disagree, it is NOT a showoff.
18:50:28dom96I have spent the last 4 years asking for a syntax IN THE LANGUAGE for this.
18:50:36dom96You said "Implement it as a macro, it'll be fine"
18:50:49dom96Then zahary implemented the do notation, and now you're saying you don't give a shit about this?
18:54:09Araqagain
18:54:16Araqthe do notation has a purpose
18:55:01Araq=> is just envy we're not haskell
18:57:29dom96what is its purpose?
18:59:44Araqit allows to pass multiple different blocks to a macro
18:59:46Araqit allows to pass multiple different blocks to a macro
18:59:48Araqit allows to pass multiple different blocks to a macro
18:59:49Araqit allows to pass multiple different blocks to a macro
18:59:51Araqit allows to pass multiple different blocks to a macro
18:59:52Araqit allows to pass multiple different blocks to a macro
19:00:07*Araq feels like a broken record
19:04:10dom96so it has multiple purposes.
19:04:48dom96IMO it fails at what should be its primary purpose
19:05:33dom96and should be replaced with =>
19:06:10dom96Implying that => has no purpose is just wrong.
19:20:03*brson joined #nimrod
19:31:20Araqok, fine
19:31:30AraqI think I have a solution that's acceptable
19:32:08onionhammeraraq not trying to fault anyone
19:32:14onionhammerjust think it's something worth supporting
19:45:14*johnsoft quit (Ping timeout: 245 seconds)
19:45:22*johnsoft joined #nimrod
19:50:03*johnsoft quit (Ping timeout: 258 seconds)
19:51:10*johnsoft joined #nimrod
19:53:53*milosn quit (Ping timeout: 258 seconds)
19:54:55*milosn joined #nimrod
20:03:02*dom96_ quit (Ping timeout: 255 seconds)
20:08:16*q66[lap] quit (Read error: Connection reset by peer)
20:08:54NimBotVarriount/NimLime master 4693df6 Erik O'Leary [+0 ±2 -0]: Updated support for 'case' indenting
20:08:59*q66[lap] joined #nimrod
20:28:50*johnsoft quit (Ping timeout: 256 seconds)
20:29:31*johnsoft joined #nimrod
20:36:20*gokr_ joined #nimrod
20:38:30gokr_I am with Dominik regarding importance of a good lightweight syntax for closures.
20:38:56*q66[lap] quit (Read error: Connection reset by peer)
20:39:38*q66[lap] joined #nimrod
20:39:51*johnsoft quit (Ping timeout: 265 seconds)
20:39:59Jehan_Why is it that the compiler can't infer the result type of a procedure if the type is "void"?
20:40:15*johnsoft joined #nimrod
20:42:11*flaviu joined #nimrod
20:45:07gokr_silly question, why not a less naked lambda syntax?
20:48:35Jehan_gokr_: Honestly, my problem right now is that with the existing lambda syntax(es) I keep running into compiler errors.
20:50:16Jehan_Rather than fiddling with a new syntax, I'd prioritize fixing the existing ones.
20:51:19gokr_Personally I feel the do syntax is less appealing (smalltalker in me) and the one in future - I also noticed it has precedence issues.
20:52:18Jehan_gokr_: I don't necessarily disagree, but having it work in the first place should take precedence over prettying it up.
20:52:39gokr_I just know a good fluid short lambda syntax is important to me, and I suspect i am not alone.
20:53:12*mat3 joined #nimrod
20:53:18mat3hello
20:54:12Jehan_gokr_: No, you're not alone. But I see it as a cart before horse issue.
20:59:20Jehan_If the compiler blows up, all the pretty syntax in the world doesn't fix that.
20:59:53*brson quit (Ping timeout: 250 seconds)
21:04:35*hopla joined #nimrod
21:05:08hoplahello all, is there any example of config/nimrod.cfg to use msvc on windows?
21:05:39hoplaI would like to test my simd crap on windows + msvc
21:08:44*dom96 quit (Excess Flood)
21:10:45*dom96 joined #nimrod
21:11:12hoplaI was going to only set cl as a compiler and use vsvars32.bat. Is that the usual way to use nimrod with msvc?
21:12:09Jehan_hopla: No idea, I don't use Windows at all, let alone msvc.
21:15:31mat3Sorry, I have not used MSVC since Windows 3.1. Probably Araq or other Windows users here can answer your question. By the way: What 'SIMD' crap have you done ?
21:16:44hoplamat3: It is just porting sse and the rest to nim. I would like to add decent support also for cpuid (if not done yet) and other useful x86 stuff
21:17:44NimBotVarriount/NimLime master 1f9e606 Erik O'Leary [+0 ±1 -0]: Fixed indent support for proc/type
21:18:21hoplaOK.
21:18:25mat3reads nice
21:18:53hoplajust works with amd64 and vcvarall amd64. However, nimbase.h does not seem to like compilation to 32 bits target on a 64 bits win7
21:20:18mat3ok, I interpret 'crap' here in terms of Intel's SSE ISA
21:22:10Jehan_hopla: You will need --cpu:i386 for that.
21:22:35hoplaJehan_: thanks
21:23:59*Ven joined #nimrod
21:24:13hoplamat3: not SPU ISA or altivec for sure but still useful :-)
21:24:43Jehan_gokr_: With respect to lambda syntax, I think the => is mostly fine, it's just annoying that you have to write "-> void" because the compiler can't infer a void result.
21:26:16gokr_and parens needed sometimes, and sometimes not.
21:26:39Jehan_gokr_: I don't honestly the problem with using them everywhere.
21:28:19mat3can someone give me an example of the lambda syntax ?
21:28:53*flaviu quit (Remote host closed the connection)
21:30:22onionhammermat3 values.filter(x => x == 5) would fail to compile
21:30:33Jehan_mat3: (x: int) => x +1; x => x + 1; x -> void => echo(x)
21:30:34onionhammerwhereas values.filter(x => (x == 5)) would succeed
21:30:46*hopla quit (Ping timeout: 246 seconds)
21:34:14mat3 hmm, probably a problem because of operator equivalence
21:37:11Jehan_mat3: Yeah, == and => have equal precedence.
21:38:36Jehan_As I said, it's not a big deal in my book.
21:44:06gokrThe reason I feel strongly on the subject is that closures are *everywhere* in Smalltalk code, and without a clean nice syntax it would not have been the success it is.
21:46:02gokrThe syntax Dominik made is "naked" as it doesn't have any delimiters around it. Smalltalk has [:x :y | x+y ]
21:46:52Jehan_gokr: I fully agree that syntactically lightweight inline closures are important.
21:46:54gokrSince Nim generally has () for calls - a naked syntax is of course perhaps more fitting.
21:47:36gokrAs libraries grow - more and more would use closures, especially since this style is getting more and more popular given the explosion of Javascript, Clojure and whatnot.
21:47:39Jehan_For what it's worth, there IS already the do syntax.
21:48:07gokrAnd... the do syntax. I personally don't really get it. I need to read up on what's so neat with it. :)
21:48:30Jehan_Well, mostly the -> part is annoying. The rest is nice, though.
21:49:08gokrWell... what does it buy? Is it just not having to have a parenthesis at the end? Araq said something about macros and multiple closures.
21:49:10Jehan_indentation is Nim's equivalent to "begin … end" in Pascal and "[…]" in Smalltalk.
21:49:28Jehan_First of all, do: allows you to start an indented block.
21:49:31gokrI know, I get it. But ... it still feels to me like a bit of a hack.
21:49:38Jehan_Which gets interpreted as a closure.
21:49:43gokrJust like it did in Ruby. But again, Smalltalker in me talking.
21:50:14gokrAnd yes, the -> etc in do-syntax... I will mix that up 1000 times until I learn it.
21:50:28ldleworkAre we talking about Rust?
21:50:31Jehan_I think the -> part needs to be fixed.
21:50:35Jehan_ldlework: No, Nim.
21:50:39ldleworkOh
21:50:51Jehan_Mostly, it's just something that can be inferred, so should really be optional.
21:51:19gokrJehan_: I think I understand why it was made like it is - we want a ":" at the end - and then... having a ":" before return type looks odd. So then "->" was stuffed in there.
21:51:28gokrBut... the result is IMHO confusing vs procs.
21:51:32Jehan_gokr: Yeah.
21:51:50gokrAnd even more confusing with lambdas now having "->" also in the type signature.
21:52:17gokrNow... what was the thing with macros and do?
21:52:28Jehan_gokr: Yeah, the problem is really having three different types of lambda syntax.
21:52:38Jehan_Rather than settling on one and making it really convenient.
21:52:56Jehan_Macros can use the do syntax for stmt parameters, too.
21:54:08gokrThing is... we can't nest the "do-syntax" reasonably, or?
21:54:25mat3I want to remark that both the syntax and semantic of Nim(rod) stands in tradition to Algol which philosophy forced structure by syntactical differentiation. Because of this implementing lambda operators as suggested can lead to more complexity and as such unexpected errors
21:54:49mat3(at least in langauges as Nim)
21:54:50Jehan_gokr: What do you mean by nesting it?
21:54:51gokrPerhaps you can, its just... it doesn't fly with my brain. I always felt it looked really odd in Ruby too when Ruby came about.
21:55:22gokrWell, in Smalltalk I can easily nest blocks. They are just expressions. Everything is.
21:56:27gokrI will have to experiment with do-syntax to grok it I guess. It just feels so ... is it just me feeling that you lose sight of what is what?
21:57:54Jehan_gokr: Well, but you don't just nest them. You pretty much always pass them as an argument to a method.
21:58:13mat3gokr: except in Smalltalk everything is an (at runtime modifiable) object so this language require only a minimal set of syntactical rules
21:59:12gokrSure, I am not saying Nim needs to be like Smalltalk - just pointing at my experience of how it works there.
21:59:24gokrAnd that particular part in Smalltalk is very nice.
22:00:17gokrFor the record, I really like the indentation style of Nim too. But perhaps its hard to combine it with very clean lambdas.
22:00:21Jehan_gokr: But the thing is, you don't really nest blocks directly. You have a method call inside a block that has a block as an argument.
22:01:14gokrSure, well, there are some variants on that, but I mean more ... syntactically.
22:01:57gokrx foo: [:x | x bar: [ hey ]]
22:02:40gokrOr even: x foo: [:x | [ x + 1]]
22:02:50Jehan_x.foo do(x): x.bar do: hey()
22:03:16Jehan_x.foo do(x): x + 1
22:03:27gokrWhat?
22:03:27Jehan_Well, except for the -> annoyance that I omitted.
22:03:32gokrThat last one looks wrong
22:04:10gokrThe block sent in to foo is a block that will return a block when called.
22:04:28Jehan_Oops, didn't look at it closely.
22:04:59gokrIt's not the same as: x foo: [:x | x + 1]
22:05:10Jehan_Yeah, I skimmed over it.
22:05:26gokrAnd.... Are you sure that first code you wrote is correct?
22:05:59Jehan_gokr: What would be wrong with it?
22:06:17*gokr checking language manual...
22:07:23gokrJust curious about the "do: hey()" - is that not actually a second closure argument to foo?
22:07:54mat3gokr: because my Smalltalk knowledge is quite non existent (beside theory, and studying the sources of Little Smalltalk) can you please describe what your code example compute ?
22:07:55Jehan_For that, the indentation would have to line up.
22:08:27gokrWell, its just "silly code".
22:09:46gokrThe first one "x foo: [:x | x bar: [ hey ]]" means "call method foo on object x, with one lambda argument".
22:10:29gokrThat lambda argument takes one param, and after "|" is the code, where it calls "bar" on the argument with another lambda as argument: "[ hey ]"
22:11:33Jehan_For what it's worth, I tried it and the compiler accepts it, though there's a bug in the generated C code.
22:12:12gokrNow, having naked lambdas, or having do-syntax - IMHO they may be harder to use "pervasively" in nested levels.
22:12:21gokrSimply because its harder to see where they end and start.
22:12:43mat3I see
22:12:44gokrNaked ones don't really fly that well unless inside a call.
22:13:19gokrAnd the do-syntax... well, I feel that the lambda being passed "fell out" of the parenthesis that delimits the arguments of the call.
22:13:32gokrSo nesting them etc, hurts my eyes.
22:13:57gokrAs I said - I am just trying to give some input from someone used to nest closures a LOT (Smalltalk).
22:14:12gokrA Lisper would probably have similar thoughts.
22:14:32Jehan_That's fine, Lisp hurts my eyes. :)
22:14:38gokrWell, it hurts mine too.
22:14:47Jehan_That said, I'm fine with Smalltalk, too, and don't really see the issues.
22:14:51gokrBecause Lisp has IMHO too few syntactical elements.
22:15:29gokrAnother silly example then
22:16:05*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:16:20gokrHmmm.
22:18:14gokrBah, I will experiment a bit myself - and gotta get to bed anyway :)
22:18:17gokrgnite
22:18:52*bjz quit (Ping timeout: 265 seconds)
22:19:38mat3in a concatenative language that example would simply be something like: [hey] bar x foo
22:20:59mat3however, I do not think this would be readable for someone with background in languages like C
22:23:40AraqJehan_: any idea where the deadlock comes from?
22:23:53Jehan_Araq: Haven't had an opportunity to look at it yet.
22:24:12Araqwell I think what I wrote might be wrong:
22:24:17Jehan_I'll give it a closer look in a minute.
22:24:23Araq # Note that if this fails somebody else already woke up the thread so it's
22:24:24Araq # perfectly fine to do nothing.
22:29:10Jehan_For what it's worth, the dirty read of w.q.len may also be wrong, though unlikely to trigger this bug.
22:29:38Araqwell
22:29:52Araqif I echo "failed" when the CAS fails
22:30:01Araqthat indeed only shows up when it deadlocks
22:30:43Araqhrm nope
22:30:55Araqsometimes it fails and doesn't deadlock
22:33:23onionhammerJehan_ gokr, can you chain the "do" syntax cleanly though?
22:34:21Jehan_onionhammer: Don't see a problem, other than the limitations with multiple do: parts in a call.
22:36:39Jehan_Araq: There's a gap after the w.q.len check where the cas will fail, but the slave will already be past cleanFlowVars.
22:36:56Jehan_Mostly, however, the whole communication logic is full of race conditions.
22:37:29Jehan_You do a dirty write of w.ready and then it's anybody's guess whether cas will succeed or fail.
22:37:53Jehan_Honestly, this is precisely what mutexes and condition variables are for.
22:38:05Jehan_And trying to avoid them is just going to give you more bugs.
22:39:13onionhammerJehan_ i'd be curious to see how you would write this https://gist.github.com/onionhammer/8c4dd13e2f4a92ad8102
22:46:40Jehan_let values = ((toSeq items())
22:46:40Jehan_ .filter do (x) -> bool: x mod 2 == 1)
22:46:40Jehan_ .map do(x) -> string: "Num " & $x
22:50:16onionhammerdoesnt copile
22:50:17onionhammercompile*
22:50:28onionhammeroh sorry, it does nm
22:50:34onionhammerhad the wrong iterator name
22:51:13*dom96_ joined #nimrod
22:51:34onionhammerthe only issue w/ that is the weird open and close parent
22:51:36onionhammerparen*
22:51:45*Matthias247 quit (Read error: Connection reset by peer)
22:52:49onionhammerJehan_ for each level of chaining you need another () wrapper
22:52:57onionhammerwhich would look ugly as hell
22:53:03Jehan_onionhammer: Yes.
22:53:15Jehan_Or a let tmp = ...
22:53:19mat3Araq: In (de facto standard) C you can get the address of a label and branch to it thought the 'goto' statement. Is this usage implementable in Nim ?
22:56:34Araqmat3: not really, we don't even have goto. but we do have .computedGoto
22:56:58AraqJehan_: no, the 'cas' is much easier to understand than a condition variable
22:57:07*BitPuffin quit (Ping timeout: 272 seconds)
22:57:09Araqand I'm aware of the dirty ready writing
22:57:21Araqdidn't wrap "atomicWrite" yet
22:59:20mat3Araq: ok, how can I get the address of a procedure ?
22:59:33Araqyou simple use the proc's name without ()
23:01:14mat3proc test (): ... var pTest : pointer = test <- this way ?
23:01:38Araqvar pTest = test # let the compiler infere the type
23:02:05Araqvar pTest = pointer(test) # if you really want 'pointer'
23:02:46mat3that is nice, this way I can define an array of procedure pointers
23:03:14Araqyes, but take a look at .computedGoto
23:03:35Araqthat's been designed for interpreter loops
23:03:50Araqand yes it duplicates the dispatching
23:04:08*saml quit (Quit: Leaving)
23:04:33Araqso unless the C compiler folds it back into a single dispatch, it's as good as it can be
23:08:29mat3I want to implement dynamic super instructions, a transformation of bytecode into a stream of calls either subroutine-threaded or direct threaded. This requires knowing at least the address of the primitive routines and a way to execute it
23:10:18mat3the last requirement is easy implementable in Nim by an external assembler routine (which would be the only CPU related dependence)
23:10:40Araqok, I see
23:11:00Araqhow do you handle the problem of keeping interesting stuff in registers then?
23:11:54*brson joined #nimrod
23:12:24mat3the call routine backup registers (AMD64 conform CPU's have 16 of them for example)
23:13:45mat3(one can misuse SSE registers for that purpose)
23:14:10mat3or better the FPU registers (via MMX)
23:14:57Varriountgokr: One thing about drone.io - it doesn't appear to have windows builders.
23:15:09mat3otherwise the call routine can create a temporary call frame, there are plenty possibilities
23:16:46onionhammerVarriount any idea how to get the de-indent pattern in nimlime to deindent after 2 empty lines?
23:17:15Varriountonionhammer: Can the pattern search previous lines?
23:18:10onionhammerdunno.
23:18:18onionhammerhard to find any documentation on it
23:18:29onionhammermight have to be done in python
23:18:37Varriountonionhammer: Look at textmate - that's what this stuff is based one.
23:18:39Varriount*on
23:18:46onionhammerat least to experiment w/ it and see if its worth having
23:18:47*Jehan_ quit (Quit: Leaving)
23:18:52onionhammerright, i know
23:19:10mat3let's see: SPARC features register windows (no problem here), PPC features 32 registers (also no problem), MIPS (no problem), ARM (well, possible), 6502 (no problem because of zero-page addressing), Z80 (ok, because of a second register set)
23:19:29*mat3 thinks this would work well
23:20:13Varriountonionhammer: A regex to find two lines with equal whitespace would be something like... "(\s*)\n$1"
23:20:57VarriountOr wait, it would be "(\s*)\n$1\n"
23:21:29onionhammerjust ^(\s*\n){2,} is what i was thinking
23:22:00onionhammerbut that wont search the previous line
23:22:34Varriountonionhammer: Dedenting via python is a good fallback. The comment continuation code can be modified to do that.
23:26:01onionhammeri'll take a look at your code there and see how much it would be to implement
23:26:16onionhammeri really wish there were a better way to reload plugins
23:28:27onionhammerVarriount actually the double comment python stuff might be broken :\
23:29:00onionhammerit seems to only insert a single-comment (#) on the next line
23:29:14AraqVarriount: what's the status of the buildbot?
23:31:10*BlaXpirit-UA quit (Quit: Quit Konversation)
23:34:16*Demos joined #nimrod
23:35:49VarriountAraq: I have the main build config 99% done, the other build configs aren't done yet though.
23:40:09Araqok nice. when/where can I see the test results?
23:41:46*Jesin quit (Quit: Leaving)
23:41:49onionhammerVarriount im getting Stage 1 failure - 1 on line 83, command == "insert_snippet" instead of "insert" which your check is looking fo
23:41:51onionhammerr
23:44:22*Jesin joined #nimrod
23:47:25VarriountAraq: Well, I can install the buildbot master tonight, if you want me to install it on the vps
23:48:02Varriountonionhammer: The stages are the checks the plugin uses to determine if it needs to insert a line
23:48:05*mat3 left #nimrod (#nimrod)
23:48:26Varriountonionhammer: It looks in the undo/redo buffer at what the user has just done.
23:49:02onionhammerhm
23:49:07onionhammerwell i cant get it to work right now
23:49:12onionhammercan you?
23:49:29Varriountonionhammer: Which version of sublime text are you using?
23:49:55AraqVarriount: yeah, please do that
23:50:09Varriountonionhammer: By the way, just checking something: When editing a python file, and pressing enter after a line with a comment, does a new comment appear for you?
23:50:39Varriountonionhammer: At the moment, getting the new buildbot up is my priority. After that I'll be happy to fix and expand the plugin.
23:57:35*q66[lap] quit (Read error: Connection reset by peer)
23:58:17*q66[lap] joined #nimrod