<< 30-06-2015 >>

00:10:12*saml_ joined #nim
00:15:33*enquora joined #nim
00:21:44*pregressive quit (Remote host closed the connection)
00:21:52*vendethiel quit (Ping timeout: 276 seconds)
00:22:31*enquora quit (Remote host closed the connection)
00:23:01*enquora joined #nim
00:26:19*enquora quit (Remote host closed the connection)
00:44:20*jaco60 quit (Ping timeout: 256 seconds)
00:50:37*jambulance joined #nim
01:01:15*dddddd quit (Ping timeout: 250 seconds)
01:02:26*dtscode is now known as mewtwo
01:02:39*thaless quit (Quit: Leaving)
01:04:48*mewtwo is now known as charmander
01:05:18*charmander is now known as Guest4215
01:05:25*Guest4215 is now known as dtscode
01:19:00*drewsrem quit (Quit: Leaving)
01:21:33*dtscode is now known as dtscoded
01:22:09*dtscoded is now known as dtscode
01:38:38*vendethiel joined #nim
01:39:20*Demos joined #nim
01:41:08*jambulance left #nim (#nim)
01:41:11dtscodedom96: ping
01:44:25*Demos quit (Ping timeout: 276 seconds)
01:51:22dtscodeif I have var foo = "some str" and I want to use that in a regex, how would I do that? re"foo" & foo & "bar" doesn't work, and whenever I use re() it says I'm trying to call a function that doesn't exist
01:58:19fowlre(foo & "bar")
01:58:52Quoralet's say i have a malloc'd pointer from C in nim. Do I have to free it discretely or will the GC handle it?
02:00:09fowlQuora you have to do it
02:00:11*vendethiel quit (Ping timeout: 250 seconds)
02:01:16fowlUse the library provided dealloc func (only use c's free if you know its from malloc)
02:02:35Quoraah okay
02:05:02*ozra- quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
02:06:56flaviudtscode: Can you post the exact code please?
02:07:08dtscodeflaviu: fowl fixed it
02:07:32flaviuok, good.
02:20:51*apense joined #nim
02:30:25*themagician quit (Ping timeout: 244 seconds)
02:36:17*themagician joined #nim
02:51:49*vendethiel joined #nim
03:07:57*darkf joined #nim
03:08:13*saml_ quit (Ping timeout: 264 seconds)
03:13:19*vendethiel quit (Ping timeout: 248 seconds)
03:28:08*Demos joined #nim
03:32:58*Demos quit (Ping timeout: 276 seconds)
03:52:12*BitPuffin|osx quit (Ping timeout: 265 seconds)
04:15:38*vendethiel joined #nim
04:50:59Varriountonionhammer: Is the 'Documentation' directory still needed? What purpose did it serve?
05:01:35dtscodeVarriount: I'm guessing it documented things
05:08:46*vasher_ quit (Quit: Connection closed for inactivity)
05:10:50*yglukhov___ joined #nim
05:11:28*flaviu quit (Ping timeout: 265 seconds)
05:15:40*yglukhov___ quit (Ping timeout: 276 seconds)
05:16:53*Demos joined #nim
05:21:35*Demos quit (Ping timeout: 256 seconds)
05:22:36*Kingsquee joined #nim
05:27:19*vendethiel quit (Ping timeout: 250 seconds)
05:30:39*vendethiel joined #nim
05:37:55*Jesin quit (Quit: Leaving)
05:52:15*vendethiel quit (Ping timeout: 248 seconds)
05:59:40*apense quit (Ping timeout: 255 seconds)
06:00:39*jubalh joined #nim
06:14:48*Quora is now known as Heartmender
06:33:28*yglukhov___ joined #nim
06:40:40*cg_ quit (Ping timeout: 246 seconds)
06:57:33*Trustable joined #nim
06:59:05*filwit quit (Quit: Leaving)
07:05:37*Demos joined #nim
07:10:07*Demos quit (Ping timeout: 248 seconds)
07:20:20*Ven joined #nim
07:22:08*Ven quit (Read error: No route to host)
07:34:57*jszymanski joined #nim
07:48:21*dtscode is now known as dtscoded
07:48:54*dtscoded is now known as dtscode
08:02:34*flaviu joined #nim
08:10:24*coffeepot joined #nim
08:14:50*dalarmmst quit (Ping timeout: 272 seconds)
08:48:37*Ven joined #nim
08:53:27*Ven quit (Client Quit)
08:54:26*Demos joined #nim
08:56:48scoeriI'm trying to dereference a C array from wihtin nim
08:57:06Xethe [] operator may be helpful
08:57:08scoerithe C array has the type "ptr cfloat"
08:57:21scoeriyeah, but I get the following error: http://pastie.org/10265755
08:57:37*yglukhov____ joined #nim
08:58:37*Demos quit (Ping timeout: 256 seconds)
08:59:02Araqr-ku: want to fix #3022, looks simple
08:59:06Araq?
08:59:42scoeriXe: do I need to import something to get the [] operator to also work on things of type ptr?
08:59:51coffeepotscoeri how's this? var myCfloat = cast[ptr cfloat](pointer)[]
09:00:53*yglukhov___ quit (Ping timeout: 256 seconds)
09:01:30coffeepot[] is dereference operator, different from using it as indexes, say in an array. AFAIK you can't add offsets to a pointer, so myPointer[10] wouldn't work
09:01:54fowlCan i shadow tables by having a local copy
09:02:15Araqthe C array shouldn't have type "ptr cfloat", use "ptr UncheckedArray[cfloat]"
09:02:24Araqfowl: yeah that indeed should work
09:02:56scoeriAraq: oh, ok, let me try that
09:03:31fowlmgetOrPut or whatever its called should be a template so it doesnt evaluate its argument needlessly
09:04:17*Ven joined #nim
09:04:43fowlMaking it template requires making the templates not dirty and instead have parameters
09:04:49r-kuAraq: i tried to look where error is raised. it wasnt too obvious but ill look more into it. to be clear - fix would be so it works the way i suggested?
09:05:10Araqr-ku: yes. the manual also suggests this should simply work
09:05:22scoeriAraq: Error: undeclared identifier: 'UncheckedArray'
09:05:44fowlOr let me bind a local dirty template, is that possible? It doesnt seem to work
09:06:03Araqscoeri: I know, for now you have to do:
09:06:16Araqwhen not declared(UncheckedArray): # coming soon
09:06:20Xewhat is the nim way to represent "const char *"?
09:06:20fowlscoeri define it like type UncheckedArray*{.unchecked.}[T]= array[1,T]
09:06:33Araqyeah what fowl says
09:06:42AraqXe: cstring
09:06:44scoeriI see
09:07:21Araqr-ku: proc sumGeneric in compiler/sigmatch.nim
09:07:40Araqdon't treat tyTypeDesc as an atom
09:09:37Araq of tyTypeDesc:
09:09:38Araq t = t.lastSon
09:09:39Araq if t.kind == tyEmpty: break
09:09:41Araq inc result
09:11:08r-kutotally easy once you spell it out :)
09:17:11Araqworks, now you only need to add a testcase and do the testing :P
09:17:57r-kuhttps://paste2box.com/1hLjpA#/zKK2GxVQ6pjQs5NMbD6vpUkVCPYmNDUuA6-twFJtaRo/45dOk7z0.diff ?
09:18:03r-kui have no idea what im doing
09:18:21r-kuspoilers: my change doesnt fix anything lol
09:18:29*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:18:49Araqdid I tell you to write the second break? :P
09:19:42r-kunope, but then again you did no tell me where to put that case. so i guessed w/o break execution would fall-through to the next one
09:19:52*bjz joined #nim
09:19:55*Araq wonders if he can explain the "simple" algorithm
09:20:08*Araq shakes his head
09:20:22r-kulol :) nim compiler entry bar is high \o/
09:21:41r-kuwithout break it indeed works. pure magic
09:21:59Araqwell the point of this code is to compute a "type rank"
09:22:41r-kumore "params" type has, bigger rank this more specific it is?
09:24:19Araqyes
09:25:13Araqin Nim seq[seq[T]] is more specific than seq[T'] because you can substitue T' = seq[T]
09:25:53Araqbut we don't compute it this way because it's faster to simply look at seq[seq[T]] and seq[T] seperately
09:27:52*onionhammer quit (Ping timeout: 276 seconds)
09:36:30*xificurC quit (Ping timeout: 246 seconds)
09:44:10*Kingsquee quit (Read error: Connection reset by peer)
09:46:01*xificurC joined #nim
09:50:42*Kingsquee joined #nim
10:11:37*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
10:13:12*bjz joined #nim
10:20:32*Kingsquee quit (Quit: Konversation terminated!)
10:20:44*Kingsquee joined #nim
10:26:14*xet7 quit (Quit: Leaving)
10:40:39*xet7 joined #nim
10:42:32fowlAraq is it possible to get type info from a typedesc
10:43:07*Demos joined #nim
10:43:10fowlThe rtti type
10:43:46Araqnot really but there is a bug in the compiler working in your favour
10:46:09fowlWhats that
10:46:54Araqjust try it and if it doesn't work patch the codegen
10:46:59Araqshouldn't be too hard
10:47:52*Demos quit (Ping timeout: 265 seconds)
10:48:56fowlI did try it because weird things work with typedescs
10:49:37fowlLike passing varargs typedesc is fine if you use a filter function
10:54:40*dddddd joined #nim
10:58:08*xcombelle joined #nim
11:00:30*boopsiesisaway is now known as boopsies
11:08:35*yglukhov____ quit (Quit: Be back later ...)
11:08:48*arnetheduck quit (Quit: Leaving)
11:09:06*arnetheduck joined #nim
11:20:31*vendethiel joined #nim
11:37:15*Kingsquee quit (Quit: Konversation terminated!)
11:44:19*vendethiel quit (Ping timeout: 250 seconds)
11:47:15*vendethiel joined #nim
11:48:46*myotis joined #nim
11:57:10*yglukhov____ joined #nim
12:00:58*xet7 quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com ))
12:01:58*xet7 joined #nim
12:04:52*jubalh quit (Quit: Leaving)
12:10:00*vendethiel quit (Ping timeout: 256 seconds)
12:19:24*jubalh joined #nim
12:26:38*FedeOmoto joined #nim
12:31:55*Demos joined #nim
12:36:25*Demos quit (Ping timeout: 264 seconds)
12:38:18*jubalh__ joined #nim
12:40:01*jubalh quit (Ping timeout: 264 seconds)
12:40:54*vendethiel joined #nim
12:41:51*jaco joined #nim
12:42:14*jaco is now known as Guest7962
12:42:36*Guest7962 quit (Client Quit)
12:42:59*jaco_ joined #nim
12:54:05*MatrixBridge quit (Remote host closed the connection)
12:54:29*MatrixBridge joined #nim
12:59:39*boopsies is now known as boopsiesisaway
13:00:35*boopsiesisaway is now known as boopsies
13:02:45*vendethiel quit (Ping timeout: 250 seconds)
13:04:43*Ven joined #nim
13:09:08*vendethiel joined #nim
13:09:29*boopsies is now known as boopsiesisaway
13:11:40*boopsiesisaway is now known as boopsies
13:13:23*BitPuffin|osx joined #nim
13:19:26*jubalh__ quit (Quit: Leaving)
13:26:01*xcombelle quit (Remote host closed the connection)
13:40:11*yglukhov____ quit (Ping timeout: 252 seconds)
13:40:46*yglukhov____ joined #nim
13:42:39*ozra- joined #nim
13:48:54*Demos joined #nim
13:53:57coffeepotJust trying to use the times.nim module. Apparently TimeInfo doesn't support milliseconds?
13:56:48coffeepotJavascript gets all the default functions to pull out or set the individual parts of the time for the Time type, but windows doesn't :/ AFAICT All you can really do with a time is convert it to TimeInfo. It seems like on JS, Time supports milliseconds but in windows it doesn't
13:57:12coffeepotplease tell me I'm wrong!
13:57:18Araqyou're wrong
13:57:23coffeepotyay! lol
13:57:42coffeepotTime is an int of seconds though, right?
13:58:25coffeepotFWIW I'm trying to choose a type to represent times in odbc
13:58:33coffeepotwhich come back in milliseconds
13:59:15coffeepotTimeInterval seems perfect for the job but is only really supported as an incrementor for TimeInfo AFAICT
13:59:38federico3oddly enough getTime().toSeconds returns a float instead of an int!
13:59:58federico3but it's rounded up to seconds
14:00:00coffeepotuh, it does? o_O
14:00:10coffeepotah
14:01:28*ozra- quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
14:01:29*Demos quit (Read error: Connection reset by peer)
14:01:44*Demos joined #nim
14:01:56Araq proc fromSeconds(since1970: float): Time = Time(since1970)
14:01:57Araq proc toSeconds(time: Time): float = float(time)
14:02:03*ozra joined #nim
14:02:28Araqthe idea is that we can support ms since it's a float
14:02:39Araqbut the underlying C library doesn't support this
14:03:34coffeepotI see, but why not add milliseconds to TimeInfo?
14:04:50coffeepotand if TimeImpl is an int, how would it support milliseconds as float?
14:05:28Araqyeah well ... I dunno TimeImpl could be a float one day
14:05:56Araqyou can add a milliseconds field but how does that help if C doesn't support it?
14:06:28coffeepotbecause I'm not really using C to give me the time, I just want to represent it when it comes back from odbc in a manor that lets people use it easily
14:07:48coffeepotcan't really have a DB time field that only supports seconds. Looks like my only real option is using TimeInterval
14:10:16federico3Araq: AFAICT epochTime() is the one that returns sub-second values
14:12:22Araqcoffeepot: yeah try to use TimeInterval for now
14:12:52*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:13:07*pregressive joined #nim
14:13:16*dalarmmst joined #nim
14:13:53coffeepotwill do, cheers
14:14:18coffeepotfor those interested, odbc returns this struct:
14:14:35coffeepotstruct tagTIMESTAMP_STRUCT {
14:14:35coffeepot SQLSMALLINT year;
14:14:35coffeepot SQLUSMALLINT month;
14:14:35coffeepot SQLUSMALLINT day;
14:14:35coffeepot SQLUSMALLINT hour;
14:14:36coffeepot SQLUSMALLINT minute;
14:14:36coffeepot SQLUSMALLINT second;
14:14:37coffeepot SQLUINTEGER fraction;[b]
14:14:37coffeepot} TIMESTAMP_STRUCT;[a]
14:14:44coffeepotwhere fraction is in nanoseconds(!)
14:14:53federico3and no timezone?
14:15:01coffeepotlol, nope :)
14:15:52*pregress_ joined #nim
14:16:38*pregressive quit (Read error: Connection reset by peer)
14:16:43federico3no timezone is wrong timezone
14:16:49*xcombelle joined #nim
14:18:23*gyeates joined #nim
14:19:26fowlTimezone is an offset from utc. Its in user prefs not the time itself
14:19:46federico3user prefs?
14:19:51fowlIt belongs*
14:20:00fowlIn user preferences
14:20:49federico3not at all. Python made the same mistake leading to ambiguous times all over the place
14:21:35fowlYou have to be committed
14:21:58*BitPuffin|osx quit (Remote host closed the connection)
14:22:10*BitPuffin|osx joined #nim
14:22:15fowlNot sloppy like python ;p
14:26:39*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
14:26:50*Ven joined #nim
14:29:11Araqfederico3: type TimezonedTime = distinct Time # oh, the joys when you have a type system ;-)
14:37:28*coffeepot joined #nim
14:41:29*pregress_ quit (Remote host closed the connection)
14:43:48*vendethiel quit (Ping timeout: 246 seconds)
14:45:36*pregressive joined #nim
14:46:37*gyeates quit (Ping timeout: 264 seconds)
14:51:17*doxavore joined #nim
14:51:37*xcombelle quit (Remote host closed the connection)
14:51:45*jefus_ joined #nim
14:53:03*jefus quit (Ping timeout: 264 seconds)
14:54:05*jefus_ is now known as jefus
14:59:47coffeepothuh just saw this (my irc d/c) "type TimezonedTime = distinct Time" niiiice
15:01:21coffeepotseems like the times module could be made amazing when there's some spare dev power to work on it
15:02:08coffeepotmind you, times are always a PITA in my experience, especially if you're working with strings
15:08:15*elbow_jason joined #nim
15:10:31r-kuehm is there a practical reason for `-`(Time, Time) operator to return int64 and not Time?
15:10:37*gyeates joined #nim
15:15:23Araqa time difference is not a point in time
15:15:40Araqor something like that, it's been modelled after ansi c times
15:17:10Demoscan we model it after std::chrono
15:17:44Demosbecause ANSI C times are not ideal in chrono is pretty good
15:17:56Demosofc somebody has to give that module some love
15:20:08r-kuwell.. then maybe we need `-/+`(Time, int64) operators that return Time. then it all would make sense
15:20:16r-kushould i make PR?
15:20:49*vendethiel joined #nim
15:22:06*MyMind quit (Ping timeout: 256 seconds)
15:27:38*Demos quit ()
15:29:40r-kuor maybe Time<->int64 converter would be more appropriate?
15:31:34*myotis quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
15:33:59*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:37:19reactormonkpigmej, if you don't like writing tests, just give me data and I'll write the test.
15:39:24*Demos joined #nim
15:40:48Araqr-ku: Time +- int64 is nice if you need it.
15:41:02Araqbut otherwise I have much more interesting stuff for you to work on
15:42:01r-kuis why i asked if i that kind of stuff is ok and i should make PR so you can work on your interesting stuff ;)
15:42:07*vendethiel quit (Ping timeout: 248 seconds)
15:43:11*gyeates quit (Ping timeout: 248 seconds)
15:46:23Araqthat kind of stuff is ok
15:49:22*Demos quit (Remote host closed the connection)
15:50:23coffeepotit'd be great if there were a full complement of functions for working with Time, like being able to set the month directly in a Time rather than having to use TimeInfo. I'm sure this isn't high priority tho
15:51:18*yglukhov____ quit (Quit: Be back later ...)
15:51:34*BitPuffin|osx quit (Ping timeout: 256 seconds)
15:51:57coffeepotlooking at the times module is probably the only time I've thought "wow javascript has it easy"
15:52:32r-kucoffeepot: Time however is just integer. its time_t from c/++. TimeInfo seems to serve exact purpose of manipulating time precisely
15:53:02coffeepotexcept it doesn't support sub-seconds, mind you i guess neither does Time atm
15:54:04r-kui guess there could be func like make_time(seconds, minutes=0, hours=0, days=0, months=0, years=0): Time, that would let one not use TimeInfo
15:54:10*Ven joined #nim
15:54:35coffeepotthat was something that struck me, that there's no initialiser for Time, too
15:54:42*myotis joined #nim
15:54:48*Trustable quit (Remote host closed the connection)
15:55:05r-kuwhat do you mean? Time(0) works, why wouldnt it?
15:55:19coffeepoti don't mind that, but coupled with the fact there's no way of setting say, month or day piecemeal, it means you gotta convert types, so then the point of Time is diminished a bit
15:55:35coffeepotTime(0) works, and you can get the current time
15:55:57r-kuyeah conversion is awkward
15:56:15coffeepotbut you can't say, ok I want a Time for 1/1/2000 00:00:00 at all without converting AFAICS
15:57:08coffeepotI mean don't get me wrong it's pretty cool to have time represented as an int in terms of space and speed
15:57:31reactormonkFor time, can someone implement joda-time? I think it's rather well organized
15:58:35r-kui bet that someone will be one who needs to use it ^_^
15:59:31*gyeates joined #nim
16:00:22coffeepottbh if we had the get/set funcs from javascript implemented on top of Time, and Time could support sub-seconds, it would be absolutely fine (at least for my use cases)
16:03:38*MatrixBridge2401 joined #nim
16:03:52*Demos joined #nim
16:05:41coffeepotwe're not THAT far from joda-time anyway in terms of capabilities it looks like
16:06:13Araqcoffeepot: just implement what you need right now please. no big rewrites or re-designs
16:06:43coffeepotI won't touch times for now as I want to get this odbc done (unless that's what you meant)
16:07:14Araqno, do touch times.nim if you need to
16:07:49coffeepotokay, noted. Won't be for couple of days though as I'm off
16:08:13coffeepotand on that note, catch you guys later :)
16:09:01r-kui think its not a bad idea to add to stdlib what we need (when its reasonable). stdlib would get better faster
16:09:31r-kujust the other day i added iterator to some xml module so i could iterate over attributes. just need to make PR heh
16:10:00r-kubesides not like adding one func mandates to drop all other projects and maintain this func full-time ;)
16:10:22*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:12:04*Demos_ joined #nim
16:12:45Demos_yeah I have literally no time to do anything with nim
16:14:22*arnetheduck quit (Ping timeout: 255 seconds)
16:15:16*Demos quit (Ping timeout: 255 seconds)
16:18:11*gmpreussner|work joined #nim
16:20:54*darkf quit (Quit: Leaving)
16:35:42*vendethiel joined #nim
16:41:42*Jehan` joined #nim
16:44:42*pregressive quit (Remote host closed the connection)
16:45:07*pregressive joined #nim
16:46:01*Arrrr joined #nim
16:57:19*vendethiel quit (Ping timeout: 248 seconds)
16:58:54*yglukhov joined #nim
17:02:11*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:02:43*vendethiel joined #nim
17:08:03*elbow_jason quit (Ping timeout: 264 seconds)
17:12:02*Ven joined #nim
17:12:47*pregressive quit (Remote host closed the connection)
17:16:24*doxavore quit (Quit: I said good day, sir.)
17:25:38*vendethiel quit (Ping timeout: 256 seconds)
17:28:01*Demos_ quit (Remote host closed the connection)
17:29:01*Demos joined #nim
17:29:35ozraThere should ofcourse be TimePoint / TimeStamp and TimeInterval. Best thing is if they could be tagged, or sub typed for different resolutions. I find the ideal is for time to be in int64 (not uint) and the types abstracting away resolution "multiplier", demanding
17:29:52ozradistinct intervals for adding / subtracting.
17:31:00ozraboost libs has some good chrono fetures. There's just so many ways of doing it. Unix time stamp is weird in it's leap second handling etc. In retrospect it should definitely not have been standardized as it was...
17:36:59*pregressive joined #nim
17:37:41*Ven quit (Ping timeout: 256 seconds)
17:40:09*Ven joined #nim
17:49:03*gyeates quit (Ping timeout: 248 seconds)
17:54:07Demosyeah I say copy boost::/std:: here
17:54:10*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:54:22Demosand make the syntax sexier and easier to remember
17:58:24Araqand then we get times2.nim? meh
17:58:44Araqthe new stuff should be compatible with our old stuff at least
17:59:50Araqbut ultimately it's dom96's decision anyway. he's the master of the stdlib
18:01:26*[CBR]Unspoken1 joined #nim
18:03:57*[CBR]Unspoken1 quit (Client Quit)
18:04:14*[CBR]Unspoken1 joined #nim
18:05:52*vendethiel joined #nim
18:11:14FedeOmotois this expected behaviour?
18:11:23FedeOmototype
18:11:23FedeOmoto Type = ref object of RootObj
18:11:23FedeOmoto SubType = ref object of Type
18:11:23FedeOmotoproc newSubType: SubType =
18:11:23FedeOmoto new(result)
18:11:23FedeOmotomethod isType(t: Type): bool =
18:11:25FedeOmoto if t is Type: true else: false
18:11:27FedeOmotoecho isType(newSubType()) # displays true
18:13:05Araqyes, 'is' is not 'of'
18:13:08*doxavore joined #nim
18:14:55FedeOmotook, so, how could I check for the Type type in isType()? of alsa returns true as Subtype is a subtype of Type
18:16:57fowlThe base type you get inside that method will always be type
18:17:25fowlIts not generic
18:17:49fowlOf uses rtti
18:17:49FedeOmotoI see... I was hopping there's a way to get the actual/real type
18:17:59fowlThere is, use rtti
18:18:21fowlThe typeinfo module
18:19:24fowlThere is no instanceOf() of afaik
18:22:24FedeOmotoI was looking at the typeinfo module, but I don't see how can I get the real type :(
18:23:01*xificurC quit (Ping timeout: 256 seconds)
18:30:50*yglukhov quit (Quit: Be back later ...)
18:32:22*MyMind joined #nim
18:36:31*MyMind quit (Ping timeout: 248 seconds)
18:43:03*[CBR]Unspoken1 quit (Quit: Leaving.)
18:43:24*[CBR]Unspoken1 joined #nim
18:43:26*[CBR]Unspoken1 quit (Max SendQ exceeded)
18:48:28ArrrrWhy doesnt shr/shr work for uint ?
18:49:05*yglukhov joined #nim
18:49:37*vendethiel quit (Ping timeout: 264 seconds)
18:51:35*vendethiel joined #nim
18:52:33def-Arrrr: import unsigned?
18:53:55ArrrrAh, you are right. I didnt know they were there.
18:54:01ArrrrThank you def-
18:54:55*filcuc joined #nim
18:59:10*doxavore quit (Quit: I said good day, sir.)
18:59:12*Arrrr quit (Quit: WeeChat 1.2)
19:05:53dtscodedom96: How would I get the client's nick? According to the source client.nick should work but apparently it doens't have that field
19:05:55*[CBR]Unspoken1 joined #nim
19:13:07*gyeates joined #nim
19:14:09*jaco_ quit (Quit: Leaving)
19:14:34*jaco joined #nim
19:14:53*Demos quit (Remote host closed the connection)
19:14:58*jaco is now known as Guest55302
19:16:47*Demos joined #nim
19:17:35*pipeep quit (Ping timeout: 248 seconds)
19:17:59*filcuc quit (Ping timeout: 256 seconds)
19:19:40*Demos quit (Remote host closed the connection)
19:21:46*pipeep joined #nim
19:30:43*Jesin joined #nim
19:32:53*Demos joined #nim
19:42:03*filcuc joined #nim
19:44:55*EXetoC joined #nim
19:46:29*MyMind joined #nim
19:51:07AraqJehan`: anything to know about pthread_setaffinity_np vs sched_setaffinity?
19:55:08Jehan`Araq: One for threads, one for processes.
19:55:28Araqthe docs say pthread_* just calls sched_*
19:57:14Jehan`Check the API. And yes, that may internally be the same code because Linux kernel threads also have pids (they are basically processes that don't duplicate memory etc.).
20:05:17Araqok so I cannot cast from pthread_t to pid_t
20:06:23Jehan`Umm … no, no, no.
20:10:37Araqugh, A DWORD_PTR is not a pointer. It is an unsigned integer that is the same
20:10:38Araqsize as a pointer. yeah ... right
20:11:08Araqso ... the docs say up to 64 processors are supported but on win32 the mask only has 32 bits ... wtf
20:11:28AraqI guess win32 doesn't support more than 32 processors then
20:29:29*pregressive quit (Read error: Connection reset by peer)
20:29:53*pregressive joined #nim
20:32:03pigmejreactormonk: I"m super busy ;/
20:32:05pigmejthat's why
20:32:14reactormonkpigmej, happens
20:32:21reactormonkbut work/life balance >:)
20:32:53pigmejyeah yeah ;/
20:34:20pigmejreactormonk: I run my own company so..... let's say my work/life is quite unbalanced;P
20:39:39*Trustable joined #nim
20:40:45*Strikecarl joined #nim
20:41:59Jehan`db_sqlite makes it really hard to work with sqlite error codes.
20:42:05StrikecarlAnyone up for an algorithm challenge (php -> NIM) ?
20:42:27Jehan`Ugh, sqlite error codes are hardcoded into sqlite3.nim rather than being imported from the C header?
20:44:20*doxavore joined #nim
20:44:43Araqyeah, many wrappers do this so we don't have to muck around with include paths and stuff
20:45:01Araqalso Linux usually has the .so lying around somewhere but not its headers
20:45:32*Strikecarl quit (Client Quit)
20:49:19*jszymanski quit (Ping timeout: 255 seconds)
20:51:15*Matthias247 joined #nim
20:51:44Jehan`Hmm. Not so great. I mean, I don't expect that these values will ever change, but you never know.
20:53:23Jehan`The whole dynlib stuff and this seems to be mostly to make things work for Linux developers who can't be bothered to install -dev packages. (Insert my usual rant about how Linux packaging is broken here.)
20:59:50*myotis quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
21:02:21AraqI don't agree. ABI stability is important and respected and *every* language implemenation that builds on -say- LLVM needs to do it this way and has no chance of "import directly from header".
21:03:43*yglukhov quit (Quit: Be back later ...)
21:04:49Araqin fact, I consider Posix much more broken than the stupid Win API for this reason. Posix only cares about C, every other language is essentially fucked.
21:05:10Jehan`Well, the usual approach in other languages to access FFI functionality is usually to write a wrapper in C/C++.
21:05:28Jehan`Which adds inconvenience, but produces an API that you control.
21:05:37*xificurC joined #nim
21:05:54DemosI mean most wrappers translate the header
21:06:04Demosupdates and import each function
21:06:09Demoseven in other languages
21:06:22Demosafaik java and .net don't automatically import constants
21:08:33Jehan`Demos: Most languages can't access the C API directly to begin with because they don't use the same types.
21:08:45Demosthat's true
21:10:19Demosso like finding headers on windows is even harder than it is on *NIX
21:10:31Demoson windows this would be a massive pain to deal with
21:11:22Araqdepends on what "most languages" means. ML, Ocaml, Hasell, D, Nim, Delphi, Java ... these can all access DLLs out of the box and they all have a notion of "value 4 that is a signed 32 bit integer"
21:11:40Demosdoes D import C headers?
21:12:08DemosJehan`: also note that windows actually exports a lot of the constants and error codes as symbols in the dlls
21:12:11Araqbut they don't have a notion of "pid_t is a (un)signed integer of implementation specific width"
21:12:57Jehan`OCaml has 31-bit integers, actually.
21:13:16Demosis the last bit for turning it into a float or something?
21:13:18Araqthat's a single huge "fuck you, <random compiled other programming language>" right here
21:13:29Jehan`Demos: No, to distinguish it from pointers.
21:13:33Demosah
21:13:58*yglukhov joined #nim
21:14:01Demoscan you not have pointers to half of memory?
21:14:14AraqDemos: no, it uses alignment bits
21:14:25Araqdoesn't cut the address space in half
21:15:27Jehan`Araq: integer specifics are a tiny part of the problem. Representing strings at char * or struct layout is a far bigger one.
21:15:32AraqJehan`: OCaml supports 32 bit integers too iirc
21:15:34Jehan`… as char *.
21:16:17Jehan`Araq: Only in a boxed form.
21:16:44Jehan`All floating point values in OCaml are boxed, too.
21:17:24Araqyes, that's why standards should focus on an ABI, not only on an API that happens to be written in a weakly typed language where "pointer to a single byte" and "pointer to a zero terminated byte array" happen to have the same type
21:17:45Jehan`Fun fact: MLTon rearranges its structs so that all references come first.
21:17:56FedeOmotoadd Smalltalk to the list of languages with 31-bit integers
21:18:08Jehan`This way the only thing the GC needs to know about them is how many references there are, and it improves GC cache-locality.
21:18:30Jehan`Araq: "should" and "is" are different things, alas.
21:18:51Jehan`GMP already drives me nuts at times.
21:19:06Jehan`Not because of the API, but because there are always subtle differences between versions.
21:19:25Jehan`Which is why you generally want to link against a specific version of GMP.
21:21:36*yglukhov quit (Quit: Be back later ...)
21:22:25Demosit really doesn't help the situation if nim starts parsing header files though. And let me tell you that on windows that would be hell on earth. It's annoying enough to have to point the compiler at the right dynlib, and headers are installed even more all over the place on windows
21:23:27Jehan`Huh, I thought the sqlite3 dynlib had been fixed for OS X?
21:25:31*BitPuffin|osx joined #nim
21:28:56*Demos quit (Remote host closed the connection)
21:28:59FedeOmotonot to mention that GMP uses "C long" extensively in its API
21:30:40Araqso ... should it be named setThreadAffinity or pinToCpu ?
21:32:29*Demos joined #nim
21:34:54*Guest55302 is now known as jaco60
21:34:56Araqcome on, a bikeshedding question of how to name something. everybody should have an opion on that.
21:36:13EXetoCd(:O)|<
21:36:52FedeOmotosetThreadAffinity, although pinToCpu is also a cool name :P
21:37:04Jehan`Hmm, pinToCpu singular? Could be multiple CPUs.
21:37:18AraqI only support 1 cpu for now
21:37:39Jehan`Ah, okay.
21:38:12Jehan`My care level is barely distinguishable from zero, I'm afraid (as far as the name question is concerned). :)
21:38:33*thales joined #nim
21:38:56*thales is now known as Guest80548
21:40:31*Trustable quit (Remote host closed the connection)
21:42:41DemosI kinda like pinToCpu myself but everyone seems to use Affinity
21:43:08DemosAffinity suggests to me that the function call is more of a suggestion to run on a given CPU, pin suggests it is more of a command
21:43:19Demosbut yeah, I don't really care much
21:45:22Jehan`Araq: Would you be open to a request for a feature that allows one to figure out exactly what dynamic libraries are being loaded by a Nim program?
21:45:56Araq--verbosity:2 makes the compiler output that, I think
21:46:06Jehan`Araq: Huh. Let me check.
21:46:45Jehan`Ah, there's a dependency line.
21:46:58Jehan`Not perfect, but I think I can parse the output.
21:47:00Araqbut it's at compile-time, for runtime edit lib/system/dyncalls.nim
21:47:27Araq #c_fprintf(c_stdout, "%s\n", dlerror())
21:47:32Jehan`compile time is what I want.
21:48:10Jehan`So that I can replace them with --dynliboverride and --passL:-l...
21:48:43*BitPuffin|osx quit (Ping timeout: 256 seconds)
21:54:36reactormonkAraq, no way to have types for iterators in concepts?
21:56:06reactormonkah, for value in c - oops,
22:01:13*doxavore quit (Quit: I said good day, sir.)
22:03:07*gyeates quit (Ping timeout: 250 seconds)
22:06:38*Jesin quit (Quit: Leaving)
22:09:22*Guest80548 quit (Ping timeout: 265 seconds)
22:10:37*filcuc quit (Quit: Konversation terminated!)
22:13:04*Jesin joined #nim
22:14:04*Jesin quit (Remote host closed the connection)
22:16:23AraqJehan`: how does that 'fix' anything? compiler doesn't support nested (|) ?
22:16:45Araq(it should)
22:16:54Jehan`dynliboverride doesn't work with anything that starts with a "(". At least I tried and it didn't.
22:17:12Jehan`More importantly, that declaration is wrong, anyway.
22:17:34Demosbetter static lib support would be nice in general
22:17:39Demosmaybe could be a stdlib thing
22:17:46Demos./maybe/
22:17:54Araqwell somebody required sqlite-3.6.13.dylib
22:18:34Jehan`I tried to track down the origin and I found only that 3.6.13 didn't work for gradha, so the other part was introduced.
22:18:49Jehan`3.6.13 seems to have been hardcoded in as the sole version at some point.
22:18:55AraqDemos: make a suggestion. --dynliboverride:everything ?
22:19:59Jehan`Araq: https://github.com/nim-lang/Nim/commit/2ea583926d9defbbbbbfbe810cba293fe9769e93
22:20:27AraqJehan`: very well then
22:23:04*gyeates joined #nim
22:24:17Jehan`The problem is not so much the dynliboverride (though an "everything" option would be nice to make sure you didn't forget anything) but that you can't automatically generate the -l options. That still has to be done manually, so a --dynliboverride:everything has only limited use.
22:24:23*milosn quit (Remote host closed the connection)
22:25:04Demosyeha, also it's really hard to static link the c runtime
22:25:26Jehan`Well, I often want to link dynamically, just not via dlopen().
22:25:50AraqI think it's a fair feature. you want manual -l hacking, you get manual -l hacking.
22:25:51Jehan`With -l I can tell (via ldd or otool -L) which libraries I need to ship.
22:25:59*milosn joined #nim
22:26:38Jehan`Araq: Yup. If I had to pick a name (gah!), just --dynlibOverrideAll?
22:26:58reactormonkAraq, with concepts, how do I describe the overloads? https://gist.github.com/b5c2983787e804ee7733
22:27:00Jehan`That's already pretty nice in that you can be sure that you didn't forget a library.
22:28:11AraqDemos: static linking of the C runtime is not permitted by its license anyway
22:28:33Jehan`Araq: Doesn't that depend on the libc in question?
22:28:38Demoswell if the output is gunna be GPL...
22:28:41Araqunless you use picoµlibc_really_slim, yes
22:28:47*pregressive quit (Remote host closed the connection)
22:28:48Jehan`I thought that musl allowed for it?
22:29:52AraqDemos: if the output is gonna be GPL you don't make money with it and so couldn't care less if it runs on another Linux machine *cough* :P
22:30:05Demoshehehehehe
22:32:00AraqJehan`: generating the -l stuff would be sweet though
22:32:07Araqcan we do that?
22:32:33Jehan`Araq: Hmm. The way I'd do it would be to pick all the first alternatives in the (|) choices.
22:33:52Jehan`That would be a heuristic, but something that could be planned for.
22:34:05Jehan`Then strip lib prefix and dll/so/dylib suffix.
22:35:19Jehan`I have no idea how well that would work, but it'd be something one could try.
22:35:20*Matthias247 quit (Read error: Connection reset by peer)
22:35:26Demoswe could provide the name as an option to the pragma
22:36:24Jehan`Demos: Not sure how that would work? dynlib names are usually encoded in a const string.
22:36:31Jehan`Inside a when clause for the different OSes.
22:36:39Demosalso we should be able to link different versions depending on compile options, like glfw3d.lib vs glfw3.lib
22:36:53Jehan`Hmm.
22:37:02Demosright. We could provide an additional pragma or another option for dynlib
22:37:19Demosalso on windows you MUST always link the runtime either statically or dynamically
22:37:30Jehan`Yeah, but that would seriously complicated things. Plus, not sure if there's room in the AST for another string.
22:37:48AraqDemos: I do that for Urhonimo. Works really well already
22:37:51Demosyeah, a new pragma would be OK, but require a lot of work for existing wrappers
22:37:52*Varriount|Mobile joined #nim
22:38:10*Jesin joined #nim
22:39:24AraqI'd like to have a --pathsareforsuckers switch which simply searches the full harddisk for anything ;-)
22:40:59Jehan`Heh. That would have a slightly problematic effect on compile times.
22:43:51reactormonkAraq, btw, how about renaming mitems to items, since we now have var overloading?
22:44:28Jehan`Does that work for iterators?
22:44:37*Kingsquee joined #nim
22:44:41fowlNo how could it
22:45:04Araqmeh, no. I like mitems better. in fact I don't like for i in items(x): i = 8 at all
22:45:10fowl> implying we have return type overloading
22:45:22Araqfowl: why shouldn't it work?
22:45:36fowlMagically? No thx
22:45:44Jehan`fowl: You'd have to look at how the iterator variable is being used inside the body of the for loop to figure out overloading.
22:46:06Jehan`Oops, that was meant for reactormonk.
22:46:08Araqyou have look at the 'x' in 'items(x)'. if it's an lvalue, use mitems
22:46:29Araqrequires no return type overloading whatsoever
22:46:36Jehan`Araq: Hmm.
22:47:15reactormonkAraq, you're just not used to it. ;-)
22:47:29Araqreactormonk: start with mget vs []. def- did it but it breaks bootstrapping
22:47:31Jehan`Not sure I'm following you there.
22:47:48reactormonkAraq, ok, let's see.
22:47:50*Varriount still thinks getVar would be more obvious.
22:47:55Jehan`mitems could be used on something immutable (say, a handle) and generate mutable values.
22:48:08reactormonkAraq, overloaded iterator - concept how? https://gist.github.com/b5c2983787e804ee7733
22:48:17reactormonkJehan`, nope, compiler error
22:48:47def-reactormonk: it broke bootstrapping because i changed the semantics of the old mget to make it consistent
22:48:55def-the PR should still be around
22:49:04reactormonkdef-, how did you change it?
22:49:38AraqJehan`: that's not an important use case
22:49:40Jehan`reactormonk: Why?
22:50:11def-reactormonk: https://github.com/nim-lang/Nim/pull/2435 "The non-var [] now throws an exception instead of returning binary 0 or an empty string"
22:50:17reactormonkJehan`, because it's rather horrible to suddenly change your invariable data
22:50:30Jehan`reactormonk: It's not a compiler error still.
22:50:50Jehan`Also, just because you have an immutable handle doesn't mean the underlying data is immutable.
22:51:21Jehan`Think, e.g. of an LRU pool of mutable resources.
22:51:25AraqJehan`: yeah and in these cases overloading by 'var T' doesn't work cause you don't even have a 'var T'. what's the problem?
22:52:10reactormonkdef-, I'll take a look
22:52:11Jehan`Araq: The problem is: how do I get at the version of items() that yields `var T` instead of `T`?
22:52:37reactormonkJehan`, you pass it var T
22:52:43Araqiterator items[T](x: var seq[T]): var T
22:52:48Araqvs
22:52:54Araqiterator items[T](x: seq[T]): T
22:53:00Jehan`iterator items(x: SomeDistinctIntType): var string
22:53:03reactormonkAraq, btw, how about an operator that converts a type from var T to T? other than via let f = g
22:53:16reactormonkactually, it can just be a function
22:53:19Jehan`That's what I'm getting at.
22:53:19reactormonkehh proc
22:54:04AraqJehan`: yeah I know, but for these rare cases you can have an mitems
22:54:43Araqor a non-overloaded items that always returns the var string.
22:54:48Jehan`Araq: The bigger question here is, I think, how to force overloading to be resolved in a specific way in general.
22:55:55Araqreactormonk: why is that necessary?
22:56:18AraqI never had a need for such an operator
22:57:54*Demos quit (Remote host closed the connection)
22:58:55*Varriount|Mobile quit (Ping timeout: 246 seconds)
23:01:03reactormonkAraq, if you wanna stop propagating var
23:01:32reactormonkoverloading map might modify the container you pass...
23:03:31fowlMap takes a different kind of function for var
23:03:56*vendethiel quit (Ping timeout: 252 seconds)
23:04:14reactormonkIt could take the same
23:06:34Araq"I have discovered the template/generic inst statement thanks to copy it here, because with colors it was completely black."
23:06:56Araq<-- just a friendly reminder that I'm always right. ;-)
23:08:11Jehan`Huh?
23:08:18Jehan`<-- missing context.
23:09:10federico3strcmp1: hi!
23:10:05AraqI'm reading bug reports
23:10:43reactormonkAraq, nope, he just has a fail color config - I'm using a black background and that stuff is white
23:11:13Jehan`Oh.
23:12:04Araqreactormonk: there is no such thing as a "fail color config" for consoles.
23:12:28Jehan`Hmm, the colors aren't a great choice for a white background now that I look at it.
23:13:01AraqJehan`: --colors:off is your friend then ;-)
23:13:16Jehan`I'm using a black background.
23:13:45Jehan`I was mostly thinking of other people.
23:14:46federico3a --colors:dark scheme would be welcome :D
23:17:14reactormonkfederico3, nah, you just gotta set your black to be white on the console
23:17:22federico3no way :D
23:17:54*boopsies is now known as boopsiesisaway
23:20:27Araqthis thing should just output HTML instead
23:29:20Araqproc foobar() {.header: "#define foobar\n#include `meh.h`", importc.} works now :-)
23:40:34Jehan`Does it check the individual lines or just the string as a whole?
23:40:42*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
23:42:40Araqit doesn't check anything
23:42:57Araqstring starts with #, ok so insert it
23:43:11Jehan`Okay.
23:43:12Araqbackticks are replaced by " though for convenience
23:43:35Jehan`So, if you have duplicate #include's, they'll be included more than once.
23:44:37Araqyeah but that's what these things have include guards for
23:50:10*apense joined #nim
23:59:57Jehan`Just as an aside: It still scares me that C found such wide adoption.