<< 02-03-2016 >>

00:00:17ldleworkand all you really want to do is distinguish between the rare (right, this *is* rare?) case when you have two generic procs named the same thing, with the same exact method utilization internally?
00:00:19*francisl joined #nim
00:00:50gmpreussneryeah, maybe. perhaps i am thinking too much static typing.
00:01:01ldleworkWell
00:01:15ldleworkIf Nim did not derrive automatic typeclasses from implementations, you would want concepts
00:01:32ldleworkso you could say, "Hey T has a .whatever so compile this function that does t.whatever()"
00:01:41ldleworkBut it already does all of that automatically....
00:02:12ldleworkBut maybe there is some other clever way to lean on the automatic typeclasses while also being able to disambiguate between overloaded procs
00:02:22Araqldlework: well 'concept' enables us to eventually perform real type checking in the generic, rather than its instantiation.
00:02:50ldleworkHmm, I can't quite fully grasp what that means
00:03:08Araqwhich would be cool too but is reserved for Nim v2
00:04:28ldleworkthis automatic typeclass thing is kind of like "compile-time ducktyping"
00:04:47Araqldlework: yes. and it has its downsides.
00:05:04ldleworkIts like, "sure I'll expand this generic proc out for this type, lets first see if it would work. Oh it would, bam, new impleentation for that type."
00:06:44ldleworkAraq: but is disambiguation between similar procs the only thing?
00:07:20ldleworkWhat if there is a silly novel way to specify which one you mean or some other way to disambiguate that no one has ever thought of before because they did not have this feature
00:07:28ldleworkAlso is Nim the only language with this or is it typical?
00:08:34ldleworkThat guy who was in here earlier who was working with Irdis and haskel was totally surprised that Nim did this
00:08:52Araqldlework: it's this way in C++ too
00:09:27Araqand it was chosen for implementation simplicity (misguided) and "duck typing similar to Python" (true)
00:09:30*PMunch quit (Ping timeout: 246 seconds)
00:09:39*mahasamoot quit (Ping timeout: 248 seconds)
00:10:59Araqtype theorists see it as a step in the wrong direction though.
00:11:16Araq;-)
00:12:13ldleworkI just wonder if there is a way to disambiguate. It seems like the concept is a round about way of avoiding overloading a process name
00:12:17ldleworkProc
00:12:49ldleworkInstead of just renaming the proc you create this whole construct just to differentiate them
00:13:20ldleworkBut I suppose it's more general than that because it then disambiguate for all such ambiguities
00:13:23ldleworkHmm
00:13:54gmpreussnerAraq: lol, i read 'type terrorists' at first
00:14:08gmpreussnerand was like 'yep, that's me'
00:14:13ldleworkHaha
00:14:50ldleworkgmpreussner what do you think about exceptions
00:15:36Araqdom96: speaking of which, can we remove the "exception hierarchy"?
00:15:59dom96why would we?
00:15:59ldleworkWat
00:16:05Araqthrows vs doesn't throw should be good enough for everybody...
00:16:24ldleworkIt's about capturing classes of exceptions
00:16:28dom96I disagree
00:16:33ldleworkRight?
00:16:46dom96so, no you can't :P
00:16:52dom96</discussion>
00:16:56ldleworkLol
00:17:17AraqI can write a guard on the error code if I care somewhat more about the error and re-raise
00:17:35Araqwhich is what the implementation does under the hood...
00:17:56gmpreussnerldlework: i don't know... that's a complicated topic. some days i think they're useful. other days i think that anything that can't be caught by the compiler should be properly handled in the calling code, i.e. with optional return types, or tuples that can contain errors
00:18:15Araqand then we have a single exception object type and don't need inheritance nor 'ref object' nor the GC :-)
00:19:28ldleworkAraq: is this your "control flow typing"?
00:19:33*derka quit (Ping timeout: 276 seconds)
00:19:40Araqldlework: no, it has nothing to do with it.
00:19:58ldleworkI thought that's what you meant by "guard on the error code"
00:20:04ldleworkbut I just realize you said "error code"
00:20:06*ldlework shudders
00:20:48Araqldlework: shudder as much as you want but the fact is that OSError contains the errno for further inspection
00:20:57*Trustable quit (Quit: Leaving)
00:21:03ldleworkSure because someone is too lazy to expand that out to types
00:21:03*francisl quit (Quit: francisl)
00:21:26ldleworkAlso types are allowed to carry data
00:21:51Araqwell 'too lazy' here equals 'omg, stop this proliferation of exception types!'
00:22:13ldleworkWhy? Do they have weight?
00:22:31Araqthey cause mental diseases
00:22:56ldleworkDunno why. We use the type system for distinguishing between types of data everywhere else.
00:23:29AraqI never turn an enum into an inheritance tree.
00:23:39Araqso much for "everywhere else" :P
00:23:39ldleworkWell I agree with that point
00:23:50ldleworkPerhaps an expanded OSError tree would have no fields of their own
00:23:56ldleworkWhich is why they are an enum
00:24:30ldleworkIf the difference between one OSError num and another carried disjoint additional data, you'd have no choice.
00:24:43ldleworkBut there is nothing inherently wrong with using the type system for mere distinguishing causes
00:24:48ldleworkThat's what distinct types are for.
00:25:25ldleworkobject variants one step removed from the pure distinguishing case
00:25:55Araqeither way. I have to think about 'concept'.
00:26:05ldleworkyeah its really fascinating subject :)
00:26:50Araqproc foo[T](x, y: T) =
00:26:51Araq for i in x:
00:26:51Araq echo i
00:26:53Araq echo x+y
00:26:54Araqproc p(x: foo[T]) =
00:26:56Araq foo(x)
00:27:08Araq--> just use the proc as a container type?
00:27:24Araqif it can be instantiated, it type checks.
00:27:37Araqno new syntax. no new surprises.
00:27:46Araq3 lines of code in the compiler.
00:27:54Araq(*cough*)
00:28:17ldleworkthis is your idea for predicates?
00:28:22Araqyes.
00:28:26ldleworkits really cool
00:28:31ldleworkAnd I think people really eat up the idea
00:28:50ldleworkhave you noticed that I routinely will omit one word from each sentence I type
00:29:00ldleworkits very strange and I only perceive it after the fact
00:30:09*boopsiesisaway quit (Ping timeout: 246 seconds)
00:30:37dom96you type too fast :)
00:30:45gmpreussnerhappens to me all the time, too!
00:30:54gmpreussnerthank god i'm not alone. i thought i'm getting alzheimer
00:31:03ldleworkAraq: heh would this be a "type predicate alias": proc bar[T](x, y: T) = foo(x, y)
00:31:26ldleworka distinct alias I guess
00:33:06Araqthis is so beautiful it has to be right.
00:33:35Araqit fits 100% syntactically.
00:35:07*dom96 wonders what that code does
00:36:03gmpreussnerthe lord's ways are mysterious
00:36:50*pregressive joined #nim
00:38:47Araqdom96: it turns a generic proc into a generic type predicate
00:39:53dom96Araq: hrm, maybe i'll understand it in the morning. Good night.
00:41:06def-Araq: I still don't understand where the y parameter to foo comes from
00:41:36ldleworkdef-: good point
00:41:47ldleworkI don't think it should change the nature of foo
00:41:56ldleworkif its going to be elegant you should just be able to use any ol proc this way
00:42:00ldleworkand still call the proc as normal
00:42:20ldleworkI don't want to look at a function and not know whether it is a proc or a predicate
00:43:03Araqdef-: that's a typo, in the implementation I need to pass two things to foo
00:43:15*boopsiesisaway joined #nim
00:43:52ldleworkwait
00:43:58ldleworkdo you have to call foo in the implementation
00:44:04ldleworkor could you call something totally different
00:44:05Araqno.
00:44:08Araqyes.
00:44:29ldleworkokay so foo does not appear in the implementation
00:44:33Araqusually you would just have some dummy implementation that checks the constraints you're after
00:44:40ldleworkso how does the compiler know that x param of p is the x param of foo
00:45:02ldleworkfrom just p(x: foo[T])
00:45:13Araqldlework: it doesn't matter. either [T] suffices to instantiate it or not.
00:45:35Araqand the type T is inferred like it would be for seq[T]
00:45:51Araqwhich could be a problem ... hmmm
00:46:05ldleworkWhat if it was proc foo[T](x: T, y: int)
00:46:14ldleworkor even
00:46:29ldleworkwell no that's enough
00:46:43Araqwhy should 'y: int' cause any problems?
00:46:51ldleworkbecause what if I'm passing an int to p?
00:48:09ldleworkI think this has the same ambiguity problem, but you moved it.
00:51:07*GangstaCat quit (Read error: Connection reset by peer)
00:51:49Araqhmm I don't understand concepts :-)
00:53:00*GangstaCat joined #nim
00:53:13Araqhow does it know that seq[T] is a Container[T].
00:53:37*mahasamoot joined #nim
00:54:18ldleworkBecause you pass one to a process expecting a Container and then the compiler checks the type against the concept
00:54:27Araqit doesn't resolve the T properly at all currently, I think
00:54:27ldleworkProc
00:54:56Araqarray[I, T] should match Container[T]
00:55:10Araqbut here T is the 2nd type parameter of 'array' not the first.
00:55:20ldleworkWhy should it match
00:55:42gmpreussnerdoesn't need to be the same T
00:55:54gmpreussnercould be array[X, Y] and should still match
00:56:11Araqgmpreussner: nevertheless I need to infer the T in
00:56:21gmpreussnerright, locally inside the concept
00:56:21Araqproc foo[T](x: Container[T])
00:56:29gmpreussneror your proc in this case
00:56:43Araqthat's the core of the problem, perhaps.
00:56:47gmpreussnerin concepts it works, because T becomes 'match any' in that case
00:56:50Araqthat's not implemented at all :P
00:57:08gmpreussnerthat's what zah said anyway
00:57:21Araqseems like we need him here.
00:57:39Araqbut he's offline.
00:57:46ldleworkwe should like
00:57:47gmpreussnerit's in the middle of the night there
00:57:52ldleworkcreate a Nim design lab
00:57:56ldleworkand advertise these ideas
00:58:01ldleworkin order to attract compiler hackers
00:58:05ldleworkso that you can get some help
00:58:08ldleworkserious suggestion
00:58:26*derka joined #nim
00:59:30ldleworkNim Enhancement Proposal #1
00:59:31Araqwell either way, my idea seems to have the same problems as 'concept' except it's easier for me to conceptualize (yay, bad puns)
00:59:43gmpreussnerhaha
00:59:49ldleworkwell done
01:04:08*darkf joined #nim
01:24:46*derka quit (Ping timeout: 248 seconds)
01:30:31gmpreussnerldlework: on the way home i thought some more about just using generic procs. i think that in principle you're right; we wouldn't need concepts at all. but one problem with that is that the constraints for what types are allowed are implicitly defined in the implementations of the algorithms, and might be spread out over a potentially very large surface of code
01:33:27*francisl joined #nim
01:37:43*brson quit (Ping timeout: 252 seconds)
01:49:46*AnonCat joined #nim
01:50:00*GangstaCat quit (Ping timeout: 250 seconds)
01:50:24*AnonCat is now known as GangstaCat
01:58:07*samdoran joined #nim
02:00:29*mahasamoot quit (Ping timeout: 248 seconds)
02:12:55*sarlalian quit (Ping timeout: 252 seconds)
02:16:16*sarlalian joined #nim
02:24:06*mahasamoot joined #nim
02:51:00*sorakun quit (Ping timeout: 276 seconds)
03:03:15*pregressive quit (Remote host closed the connection)
03:05:02*pregressive joined #nim
03:17:48*filwit quit (Quit: Leaving)
03:38:22*Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif)
03:38:26*Kingsqueee joined #nim
03:54:01*girvo joined #nim
04:25:47*endragor joined #nim
04:34:32*Demon_Fox joined #nim
04:50:08*sarlalian quit (Quit: ZNC 1.6.1 - http://znc.in)
04:50:58*pregressive quit (Remote host closed the connection)
04:52:22*sarlalia1 quit (Quit: WeeChat 0.4.2)
04:55:49*sarlalian joined #nim
04:55:50*sarlalia1 joined #nim
04:56:41*sarlalia1 quit (Client Quit)
05:17:54*Varriount joined #nim
05:20:03VarriountAraq: https://github.com/nim-lang/nimsuggest
05:20:14VarriountThere's a new pull request
05:20:54*CORDEA joined #nim
05:23:15*gunn joined #nim
05:25:50*gunn_ quit (Ping timeout: 248 seconds)
05:40:47*mwbrown joined #nim
05:56:27*mwbrown quit (Quit: Leaving)
06:07:49*francisl quit (Quit: francisl)
06:15:26*zepolen joined #nim
06:17:05*endragor_ joined #nim
06:19:48*zepolen quit (Ping timeout: 246 seconds)
06:20:22*endragor quit (Ping timeout: 260 seconds)
06:36:27*francisl joined #nim
06:39:40*endragor_ quit (Remote host closed the connection)
06:40:09*endragor joined #nim
06:42:42*francisl quit (Quit: francisl)
06:48:57*bjz joined #nim
06:50:44*samdoran quit (Ping timeout: 252 seconds)
06:54:55*girvo quit (Read error: Connection reset by peer)
06:56:18*girvo joined #nim
06:57:16*toaoMgeorge quit (Ping timeout: 252 seconds)
07:11:11*endragor quit (Remote host closed the connection)
07:24:14*bjz_ joined #nim
07:25:07*bjz quit (Ping timeout: 260 seconds)
07:26:52*Kingsqueee quit (Quit: https://i.imgur.com/qicT3GK.gif)
07:33:15cheatfatewhat the best way to define() for 64 bit platforms?
07:36:45Varriountcheatfate: I believe that there is a defined symbol for x64 platforms
07:42:39cheatfateonly variant i have found is "when sizeof(int) == 8" and even dont know is result is known in compile time
07:42:42Varriountcheatfate: Try "when defined(amd64)"
07:43:19*bjz joined #nim
07:44:12*sarlalia1 joined #nim
07:44:13cheatfateamd64 is only x86, what happens if somebody tries to compile on [arm64], or [powerpc64]
07:44:33Varriountcheatfate: Then you need to add handlers for those cases?
07:44:40*sarlalia1 quit (Client Quit)
07:44:46Varriountcheatfate: What are you trying to do?
07:44:49*bjz_ quit (Read error: Connection reset by peer)
07:45:04*sarlalia1 joined #nim
07:45:11*zepolen joined #nim
07:46:37cheatfateplease look lib/sys/kqueue.nim, there is KEvent structure where ident*: cuint and data*: cuint
07:47:22Varriountcheatfate: Are those incorrect?
07:47:23cheatfatebut on 64bit systems size of (uintptr_t and intptr_t is 64 bits)
07:47:27cheatfateyep
07:47:31cheatfateits incorrect
07:47:45Varriountcheatfate: Use the int or pointer type then.
07:47:49cheatfatei dont know how sizeof(KEvent) is still 32 bytes may be kind of alignment
07:48:57cheatfatewe cant patch kqueue.nim in such way because other code will be broken... i think compile define would be better solution
07:49:45Varriountcheatfate: That's really just plastering over the problem. Besides, the only code that is likely to be using the bare kqueue stuff is the async stuff in the standard library.
07:50:23cheatfatekqueue.nim used by selectors.nim used by async staff
07:50:26Varriountcheatfate: Besides, code that's using the kqueue is currently broken because of this anyway.
07:50:45cheatfateVarriount, its working... for some reason
07:51:02cheatfatei think because of alignment structure members by c compiler
07:51:06Varriountcheatfate: Yes, but only by accident.
07:52:11VarriountAgain, I'd change the types to either `int`, `pointer`, `ptr cuint` or `ptr cint`
07:52:52VarriountThe last two sound close to the original type definition.
07:53:34*girvo quit (Ping timeout: 250 seconds)
07:53:46*filcuc joined #nim
07:54:34*endragor joined #nim
07:58:28*zepolen quit (Remote host closed the connection)
07:59:06cheatfatein original this types looks like this https://gist.github.com/cheatfate/0c9e421bcd3b882daefb
07:59:21*zepolen joined #nim
08:02:50Varriountcheatfate: __uintfptr_t ?
08:03:01VarriountIs that a typo?
08:04:21cheatfatesorry not __uintfptr_t but __uintptr_t
08:04:50*endragor quit (Remote host closed the connection)
08:06:28cheatfatehttps://gist.github.com/cheatfate/418d8a21e8f0e653edf6 this is full version no my faulty extraction
08:07:00*CORDEA quit (Ping timeout: 252 seconds)
08:08:00VarriountBased of of that and the original man page, I'd make the ident member a uint, and the data member an int
08:08:43VarriountThe data member seems to be used far more as a number than as a pointer to something.
08:09:00cheatfateyeah, looks like the most easy way to patch kqueue.nim
08:11:44cheatfateouch, Varriount NimLime is your product! I have a small problem
08:12:27cheatfatei have a sublime text2 and when i'm starting new .nim file i have always problems with tabs
08:12:46cheatfateis it sublime text2 problem? or i need to add something to settings?
08:13:46cheatfatemy first tabs in this file, become tabs not 2spaces
08:14:16*mahasamoot quit (Ping timeout: 252 seconds)
08:18:22*yglukhov joined #nim
08:23:55*endragor joined #nim
08:27:06*zepolen quit (Remote host closed the connection)
08:33:23*Trustable joined #nim
08:53:38*Demon_Fox quit (Quit: Leaving)
08:53:55veganskAraq, hi! Please review https://github.com/nim-lang/Nim/pull/3921
08:54:19veganskAraq, It's about TLS problems with MinGW
08:56:14AraqVarriount: I don't like it ... I argued in the past this way of extensibility is against the point of Nim's "compiler as an API" idea
08:56:44AraqI will accept it eventually since you are keen on doing it this way.
08:56:59Araqvegansk: I love you :D
08:57:09Araqhow did you find this?
09:12:27veganskAraq, it was cool! First of all, I created similar test that uses threadvar. And stacktrace becomes more clear. And then I examined c sources and then *BINGO*! :-)
09:13:34Araqwhy does GCC allow __declspec(thread) and miscompiles it? after all these years. pretty sure it affects all GCC versions.
09:16:16veganskAraq, good question. Need to look deeper
09:21:57veganskAraq, here is the mention: https://bugs.freedesktop.org/show_bug.cgi?id=57591. "gcc ignores __declspec(thread) but does not throw an error".
09:39:49*endragor quit (Remote host closed the connection)
09:57:51*endragor joined #nim
09:59:21*darkf quit (Ping timeout: 276 seconds)
09:59:26*endragor quit (Read error: Connection reset by peer)
09:59:56*endragor joined #nim
10:02:11*endragor quit (Read error: Connection reset by peer)
10:02:17*endragor_ joined #nim
10:03:14*endragor_ quit (Read error: Connection reset by peer)
10:03:20*endragor joined #nim
10:04:38*darkf joined #nim
10:08:27*endragor quit (Ping timeout: 276 seconds)
10:09:48*endragor joined #nim
10:10:07*endragor quit (Read error: Connection reset by peer)
10:10:19*endragor joined #nim
10:12:14cheatfatehow properly define C's "void*" in nim? with "pointer" or "ptr void"?
10:13:22Araq"pointer"
10:13:36*zepolen joined #nim
10:15:31cheatfatethank you
10:15:31*zepolen quit (Read error: Connection reset by peer)
10:16:52cheatfatejust found commented "ptr void" in posix/kqueue.nim, enabled it and got an exception when trying to compile
10:18:14Araqcheatfate: c2nim translates void* to pointer
10:19:31Araqand usually c2nim is like GLaDOS
10:21:06cheatfate:)
10:21:11*Salewski joined #nim
10:21:48*darkf_ joined #nim
10:23:48*M-Quora quit (Quit: node-irc says goodbye)
10:24:19SalewskiAraq, you just mentioned c2nim. In https://github.com/Araq/wxnim/blob/master/private/spinbutt.nim we have template wxSpinEventHandler and template evt_Spin_Up # why some template names with _ and some without? I think that is nep1
10:26:00*darkf quit (Ping timeout: 276 seconds)
10:27:41AraqSalewski: good question, maybe https://github.com/Araq/wxnim/blob/master/headers/wx.c2nim contains the answer
10:27:50Araqbut it doesn't look like it
10:29:26*girvo joined #nim
10:30:55Salewskic2nim --nep1 gives me currently template names with _, as in template is_Application_Window. Question is if I should delete the _, that is why I looked at your wxWidgets...
10:31:49*darkf_ quit (Remote host closed the connection)
10:32:32Araqusually I'm in favor of this yes. maybe c2nim --nep1 ignores templates. fix it.
10:32:53*darkf_ joined #nim
10:33:06SalewskiOK, thanks.
10:33:26*Salewski quit ()
10:37:06*darkf_ is now known as darkf
10:38:56*toaoMgeorge joined #nim
10:42:15*darkf quit (Ping timeout: 276 seconds)
10:56:23*darkf joined #nim
11:35:11*filwit joined #nim
11:35:13*PMunch joined #nim
11:36:30*boopsiesisaway quit (Ping timeout: 248 seconds)
11:50:15*boopsiesisaway joined #nim
11:51:35veganskHey, http://nim-lang.org/docs/c2nim.html produces error 404!
11:55:55*toaoMgeorge quit (Ping timeout: 252 seconds)
11:56:39*toaoMgeorge joined #nim
11:58:32federico3and http://nim-lang.org/docs/ looks broken
12:05:53*arnetheduck joined #nim
12:07:00*arnetheduck quit (Remote host closed the connection)
12:09:07*arnetheduck joined #nim
12:23:16*Varriount quit (Read error: Connection reset by peer)
12:23:56*endragor quit (Remote host closed the connection)
12:25:16Araqhttp://nim-lang.org/documentation.html looks fine
12:30:09*toaoMgeorge quit (Ping timeout: 276 seconds)
12:30:19*toaoMgeorge joined #nim
12:40:11*zepolen joined #nim
12:59:15*endragor joined #nim
13:27:57*toaoMgeorge quit (Ping timeout: 260 seconds)
13:28:24*toaoMgeorge joined #nim
13:47:19*darkf_ joined #nim
13:47:47*lxdong quit (Quit: Page closed)
13:51:24*darkf quit (Ping timeout: 276 seconds)
14:04:10yglukhovquestion. i've got a proc performOnMainThread*(fun: proc(data: pointer) {.cdecl.}, data: pointer). When i call this proc with a global {.cdecl.} proc which is "not gc-safe", i get a compiler error about gcsafety. is there a common solution to this?
14:04:58*darkf_ is now known as darkf
14:08:36yglukhovcan i somehow say that performOnMainThread accepts a not-necessarily gcsafe proc?
14:08:56*cheatfate quit (Read error: Connection reset by peer)
14:13:50*cheatfate_ joined #nim
14:14:36*cheatfate_ is now known as cheatfate
14:32:21*toaoMgeorge quit (Read error: Connection reset by peer)
14:37:42Araqyglukhov: good question. There is ".gcunsafe" as that's the default
14:37:46Araq*there is no
14:38:15Araqso ... I am not sure what the problem is
14:40:23yglukhovok, my current workaround is to cast global proc to pointer. then cast pointer back to {.cdecl, gcsafe.}. seems to work
14:44:40Araqcasting is supported workaround indeed but it doesn't seem to be necessary for the situation you described
15:04:25*pregressive joined #nim
15:05:04*pregressive quit (Remote host closed the connection)
15:06:43*endragor quit (Ping timeout: 248 seconds)
15:22:10*mwbrown joined #nim
15:23:29mwbrownGot a question for you guys (mostly directed at Araq or anyone who has tried to do this):
15:24:04mwbrownDoes Nim support interop with C volatile pointers? I saw an issue report on github that said using {. volatile .} just marks the variable itself as volatile and not what it points to (in the pointer case)
15:24:25mwbrownor rather pointers to volatile data
15:25:01mwbrownI'm trying to get back into doing some development on an STMicro ARM Cortex-M3 and I've got the build system up and linking with some supporting C code, but I want to be able to do the actual volatile load/store from Nim
15:31:16yglukhovmwbrown: can't say about volatiles in nim, but you can always use {.emit.} and do whatever you want in C.
15:32:13mwbrownYeah, I vaguely remember seeing a workaround like that in the github issue
15:32:38yglukhovAraq: i'm playing with pinnedSpawn, and it seems like it's blocking a lot. is there a simple answer?
15:32:58mwbrownyglukhov: oh hey, I just noticed you were the one who posted that workaround, haha
15:33:12mwbrownhttps://github.com/nim-lang/Nim/issues/3382
15:34:26yglukhov:) yeah, but then you can go further and implement volatileLoad/Store routines in the same way. maybe even contribute them to stdlib then ;)
15:38:07*filwit quit (Quit: Leaving)
15:49:47Araqyglukhov: depends on what you mean by "blocking"
15:54:03yglukhovwell, its almost "synchronized" with tasks i spawn. i spawn a lot of tasks, every one may take around 0.25 seconds. and every pinnedSpawn hangs for about the same time
15:54:36*pregressive joined #nim
15:55:16*mwbrown quit (Remote host closed the connection)
15:55:45*mwbrown joined #nim
15:57:20yglukhovAraq: in threadpool.nim: await(distinguishedData[id].readyForTask). Does it mean that threads do not have a queue?
15:58:28yglukhovand spawn will wait until previous task completes?
15:58:38yglukhovthat would explain my observations...
16:11:40mwbrownIn a template, is it possible to convert an argument of type 'stmt' to a string?
16:11:53mwbrownKind of like in C how you can stringify macro arguments
16:13:32*zielmicha_ joined #nim
16:15:33*zielmicha quit (Ping timeout: 264 seconds)
16:15:33*mal`` quit (Ping timeout: 264 seconds)
16:15:36*zielmicha_ is now known as zielmicha
16:16:13*mal`` joined #nim
16:16:22yglukhovmwbrown: astToStr or smth
16:17:41yglukhovAraq: i think syscond is incorrect in windows. because they are not safe in wait. this should be used instead: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682052(v=vs.85).aspx
16:26:30*brson joined #nim
16:29:13*Jesin quit (Remote host closed the connection)
16:43:57*bozaloshtsh quit (Ping timeout: 260 seconds)
16:44:33*vendethiel joined #nim
16:45:36*vendethiel- quit (Ping timeout: 246 seconds)
16:56:30*endragor joined #nim
17:03:06*filcuc quit (Read error: Connection reset by peer)
17:03:10*darkf quit (Quit: Leaving)
17:16:45*yglukhov quit (Ping timeout: 248 seconds)
17:27:27*nero7 joined #nim
17:27:52*nero7 left #nim (#nim)
17:28:13*UberLambda joined #nim
17:31:33*cheatfate quit (Read error: Connection reset by peer)
17:32:10*cheatfate joined #nim
17:36:02ldleworkgmpreussner: I agree that it is annoying to have to inspect an implementation to know what a type needs in order to be passed to it
17:36:45ldleworkgmpreussner: I wonder if you could generate reports or use an IDE to compile requirement reports for types based on generic implementations
17:41:37*mahasamoot joined #nim
17:57:30*yglukhov joined #nim
17:58:24*yglukhov quit (Remote host closed the connection)
17:58:36*yglukhov joined #nim
18:05:19*sorakun joined #nim
18:07:39*Sys_ joined #nim
18:14:19*bozaloshtsh joined #nim
18:25:02*arnetheduck quit (Remote host closed the connection)
18:26:08*endragor quit (Remote host closed the connection)
18:30:09*mahasamoot quit (Ping timeout: 250 seconds)
18:40:40*zepolen quit (Remote host closed the connection)
18:42:30*yglukhov quit (Remote host closed the connection)
18:43:47*zepolen joined #nim
18:49:16*mahasamoot joined #nim
18:54:49gmpreussnerldlework: and another problem with implicitly defining types via the usages of their interfaces is problematic is that conceptually completely different types may implement procs with the same names and (generic) argument lists, but do completely different things. just because X.foo and Y.foo match it doesn't mean that X and Y are in any way semantically related, or that the foo's do similar things. one would have to have globally unique
18:54:49gmpreussner(and i literally mean 'globally', and therefore quite verbose) proc names for this to work
18:55:14gmpreussnerone could argue that if the names and signatures match, then it doesn't matter what the functions do, and they could be assumed to be related
18:55:16*PMunch quit (Ping timeout: 250 seconds)
18:55:21gmpreussnerbut in practice that is rarely the case
18:55:48gmpreussnerit might work for things like len() and max(), but in many other cases it won't
18:56:02ldleworkgmpreussner: So in conclusion I think that while Concepts are not technically required, they are an extremely valuable abstraction.
18:56:09gmpreussnerso you're right in that concepts are mainly a naming device
18:56:29ldleworkAnd I think that they are even more useful than naked predicates since we disocvered those too lack the named disambiguator
18:56:38ldlework(since the ambiguity is moved to equivalent parameter lists)
18:57:06gmpreussneri'm not sure about that. i'd have to see predicates in action. i'm intruiged by the possibility of composing them.
18:57:13gmpreussneryou can't really do that with concepts, i think
18:57:37ldleworkThey compose nicely, but Araq and I contemplated it yesterday and you can't disambiguate between parameters
18:57:45ldleworkimagine a predicate that takes (T, int)
18:58:02ldleworkAnd you want to pass an int to a generic function who's generic parameter is guarded with this predicate
18:58:10ldleworkAnd you want to pass an int /as the generic parameter/
18:58:20ldleworkThe same ambiguity exists but is moved to a different place.
18:58:48ldleworkIt wont conceptualize to you as the same ambiguity since a parameter is so different conceptually but if you contemplate it for a few minutes you will realize.
19:01:04gmpreussnerwell, Araq messaged me earlier that he found the final solution to the concept question (TM)
19:01:13gmpreussnerhe didn't say yet what it is, but i'm hopeful :)
19:01:59ldleworkgmpreussner: which concept question
19:02:08ldleworkoh he didn't say what the question was or the solution?
19:02:22gmpreussnerright :)
19:02:22*sarlalia1 quit (Quit: WeeChat 0.4.2)
19:03:27*sarlalia1 joined #nim
19:11:11*pregressive quit (Remote host closed the connection)
19:11:27*pregressive joined #nim
19:14:46*bozaloshtsh quit (Ping timeout: 244 seconds)
19:16:00*Jesin joined #nim
19:18:06*sarlalia1 left #nim ("WeeChat 0.4.2")
19:21:27*samdoran joined #nim
19:22:21*bozaloshtsh joined #nim
19:22:45*zepolen quit (Remote host closed the connection)
19:25:42*samdoran quit (Ping timeout: 252 seconds)
19:26:35*yglukhov joined #nim
19:26:36*yglukhov quit (Remote host closed the connection)
19:29:46*sorakun quit (Remote host closed the connection)
19:32:39*boopsiesisaway is now known as boopsies
19:33:17*mahasamoot_ joined #nim
19:33:31*mahasamoot quit (Ping timeout: 252 seconds)
19:41:05*Gonzih joined #nim
19:42:10*Matthias247 joined #nim
19:48:15*yglukhov joined #nim
19:53:41*yglukhov quit (Remote host closed the connection)
20:13:40*brson quit (Ping timeout: 244 seconds)
20:19:32*mat4 joined #nim
20:19:34mat4hello
20:19:46ldleworkhi mat4
20:19:59mat4hi ldlework
20:24:27mat4I'm surprised to read in the logs that Nim will implement 'duck typing' (or this is discussed)
20:25:05*UberLambda quit (Quit: GTG)
20:25:12ldleworkmat4: it already /does/
20:25:13ldlework:)
20:27:01*PMunch joined #nim
20:27:47mat4nice, where can I found related documentation about the needed interface concept ?
20:28:20ldleworkmat4: "needed interface concept" ?
20:28:34ldleworkmat4: but do you understand why Nim is already duck-typed?
20:32:49mat4I guess because Nim support method overloading in combination with some support for parametric polymorphism ?
20:33:27*sora joined #nim
20:33:27ldleworkmat4: no because the typeclass of T in a generic function is automatically derived if none is specified.
20:35:19ldleworkmat4: that means, whether or not you can pass a given type to that generic function will depend on whether the passed type adheres to the nonce typeclass derived from the implementation of the generic function
20:35:40mat4ok, I summary this under parametric polymorphism
20:41:42Araqgmpreussner: if the names are merely accentically the same concepts cannot protect you against that.
20:43:16gmpreussnertrue, but it can make it less likely
20:43:41*Ven joined #nim
20:43:44ldleworkgmpreussner: well your point kind of assumed that names divide the intended semantic space
20:43:57ldleworks/assumed/stood on the idea that
20:44:07gmpreussnerif the function uses only one proc of the type's interface instead of enforcing the entire interface (even though it is not used), the chances are higher
20:44:33ldleworkoh that's true too
20:44:43ldleworkIt bundles assumptions
20:44:50ldleworkWhich makes the disambiguation more aggressive
20:45:23mat4the problem I see is that duck typing is a dynamic concept determinating type compatibility dependent on the actual invoked parts of a structure (object, Nim terminology). Because invocation can change at runtime static analysis would be limited to the extend of possible type inconsistencies
20:45:54ldleworkmat4: eh "duck typed generics" is just a joke really
20:46:00ldleworkIt isn't anything like "python's duck-typing"
20:46:06ldleworkIt doesn't have anything to do with the runtime
20:46:28ldleworkIn fact, by the time you're calling a generic function at runtime, the implementation has already been expanded out to an implementation made just for that type you're passing.
20:46:41ldleworkThe "duck-typing" happens when trying to resolve generic instantiations
20:47:09mat4yes, I know this concept as structural typing
20:47:13ldleworkOr rather, "should this type A be able to be passed to generic function foo[T]()"
20:47:17ldleworkIts not structural typing either.
20:47:41mat4then it would be better to define a new terminology
20:47:41ldleworkIts the way in which Nim determines whether A can be used for T which is "like duck-typing"
20:47:50ldleworkIn other languages you have to tell the compiler what T is capable of
20:48:07ldleworkOnly then can you pass something like A as a T assuming A has all the things defined in that extra information about what T can do
20:48:17ldleworkBut in Nim the "extra bit of information about what T can do"
20:48:36ldleworkis *automatically derived* from what you *do* in the generic implementation
20:48:38ldleworkIf you do
20:48:49ldleworkvar t: T
20:48:52ldleworkt.something()
20:48:58*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:49:08ldleworkNim now assumes that all types that will be passed in as a T, like an A, must support .something()
20:49:37ldleworkThe reason why it is duck typing like, is because the programmer did not have to make a typeclass, specify that the typeclass allows for .something and then specify foo as foo[T: SomeTypeClass]
20:51:27ldleworkmat4: hopefully I helped.
20:51:41*toaoMgeorge joined #nim
20:52:45*Ven joined #nim
20:54:02mat4well put, except my point was confusion about the selected terminology
20:55:04ldleworkmat4: I agree.
20:59:24mat4I hope such appointments find no documentation usage
20:59:27gmpreussneri feel like we need to go back to the drawing board and think about what we really want to achieve. i'm not so sure anymore :)
21:00:18*Varriount joined #nim
21:04:16VarriountAraq: I just think that it makes things easier to read. Using methods means that we aren't manually branching for mode-specific behavior.
21:05:54AraqVarriount: if my IDE cannot reliably "goto definition" (and for methods it will never be able to do that) I don't care if it's "easier to read"
21:06:21VarriountAraq: Huh? How does my change affect that functionality?
21:07:08Araqmymethod(a, b) # goto def 'mymethod' ... er which one?
21:08:13Araqthat's why I avoid dynamic binding.
21:10:41VarriountAraq: Do you want me to switch out the methods for case statements?
21:12:52Araqyup. or generate it via a macro.
21:13:26VarriountAraq: But a macro would prevent 'goto definition' too.
21:13:51Araqnot necessarily.
21:15:53Araqwe should improve idetools so that it can do it ;-) it's possible. and no, you cannot argue the same for 'method', 'method' is impossible.
21:16:46VarriountAraq: Well, I can't say I feel the same way, but I'll do what you feel is right.
21:17:14Araqgood, thank you.
21:18:14VarriountAraq: I still think splitting off the various mode functionalities into their own procedures make sense.
21:19:01AraqI'd rather have fewer modes to begin with.
21:19:22Araqin theory every idetools test needs to be run for every mode we support.
21:19:38Araqright now we don't have tests (yay ...)
21:19:56dom96Araq: Does "Goto definition" support methods at all? Presumably when trying to "Go to definition" on a method call you would get a list of possible methods, right?
21:20:24Araqdom96: right.
21:20:41dom96Araq: Is that implemented?
21:20:48Araqnope.
21:21:01VarriountAraq: One might wonder how Java programmers get anything done. :3
21:21:05dom96Varriount/Araq: What are the different nimsuggest modes?
21:21:21dom96the modes only change the way the data is transferred right?
21:21:22VarriountStandard Input, Tcp, and Epc mode
21:21:53AraqVarriount: Java programmers don't get anything done.
21:23:04VarriountAraq: How does nimsuggest handle 'goto definition' in generic procedures?
21:23:26Varriount(when using it on a generically typed variable)
21:24:00dom96Hrm. I would create some sort of API out of nimsuggest, so that nimble packages can reuse it, and provide some limited modes which build on top of that API
21:24:06dom96that way we can just test the API
21:24:44Varriountdom96: Don't you mean a compiler API? Most of the Nimsuggest API is just a presentation layer.
21:24:55VarriountEr, most of the nimsuggest functionality.
21:26:32dom96oh. I didn't realise.
21:27:14dom96I'm sure nimsuggest could provide a thin wrapper on top of the compiler API, making it far nicer to use.
21:27:34AraqVarriount: it works.
21:27:54Araqit uses a "best effort" type checking approach for that.
21:28:17VarriountSo... back to presenting multiple choices?
21:29:49Araqif there are multiple choices, yes.
21:30:34gmpreussnerthat's VAX handles it
21:30:41gmpreussner*that's how
21:30:45Araqit's a valid remark, but I don't use generics everywhere just because I could either.
21:35:40VarriountAraq: Sorry, I'm just trying to figure out how your motivation that 'goto definition should work' fits in with the most elegant approaches.
21:36:11VarriountGenerics and methods could both return multiple choices, templates and macros could hide the invokation completely
21:37:27*PMunch quit (Ping timeout: 276 seconds)
21:37:40*Subspice joined #nim
21:38:05AraqVarriount: 'goto definition' is a good example of how good you and your tooling can reason about the code.
21:40:29VarriountEh. I guess I'm just used to Python, where explanatory comments are used instead.
21:43:31*brson joined #nim
21:55:24*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:00:57*toaoMgeorge quit (Ping timeout: 246 seconds)
22:03:04*toaoMgeorge joined #nim
22:08:05*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:13:33*Subspice quit ()
22:16:39*bjz joined #nim
22:17:48*Demon_Fox joined #nim
22:22:36*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:22:47*boopsies is now known as boopsiesisaway
22:23:49*Senketsu quit (Quit: Leaving)
22:24:12*pregressive quit (Remote host closed the connection)
22:24:40*bjz joined #nim
22:26:03*Demon_Fox quit (Ping timeout: 240 seconds)
22:26:07*brson quit (Ping timeout: 268 seconds)
22:26:55*Demon_Fox joined #nim
22:28:56*pregress_ joined #nim
22:31:04*vendethiel quit (Ping timeout: 244 seconds)
22:32:02*brson joined #nim
22:32:48*pregress_ quit (Remote host closed the connection)
22:33:04*pregressive joined #nim
22:34:34*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:39:37*vendethiel joined #nim
22:39:51*toaoMgeorge quit (Ping timeout: 276 seconds)
22:40:11*toaoMgeorge joined #nim
22:51:40*Kingsquee joined #nim
22:54:51*mahasamoot_ quit (Ping timeout: 246 seconds)
23:00:47*vendethiel quit (Ping timeout: 260 seconds)
23:02:46*vendethiel joined #nim
23:09:35*PMunch joined #nim
23:10:25*mat4 quit (Quit: Leaving)
23:18:41*NimBot joined #nim
23:23:54*vendethiel quit (Ping timeout: 246 seconds)
23:30:21*mahasamoot joined #nim
23:42:15*Matthias247 quit (Read error: Connection reset by peer)
23:50:57*vendethiel joined #nim
23:51:24*pregressive quit (Remote host closed the connection)
23:59:58*bozaloshtsh quit (Ping timeout: 244 seconds)