<< 07-05-2015 >>

00:10:02*solidsnack quit (Ping timeout: 246 seconds)
00:38:01*Jaood joined #nim
00:46:39*darkf joined #nim
00:55:59*xificurC quit (Read error: Connection reset by peer)
00:56:34*xificurC joined #nim
00:59:49*silven quit (Ping timeout: 245 seconds)
01:00:55*silven joined #nim
01:03:41*zzach quit ()
01:06:10*dddddd quit (Ping timeout: 272 seconds)
01:08:49*vikaton joined #nim
01:19:50*Jesin quit (Quit: Leaving)
01:22:27*kz joined #nim
01:37:19*Pisuke quit (Ping timeout: 255 seconds)
01:47:09*Pisuke joined #nim
01:47:31*kz quit (Ping timeout: 246 seconds)
01:54:31Xeis there a way to set the contents of language pragmas at runtime?
01:55:35Xespecifically i'm looking for a way to change the `dynlib` pragma of a function or reload the shared object, or should I wrap dlopen / dlsym / dlclose for that?
01:56:34*vendethiel joined #nim
02:01:37*ddl_smurf joined #nim
02:02:02fowlXe those funcs are available in dynlib
02:02:24Xeah cool
02:03:02fowlAraq has some late-loading mechanism used for opengl extension loading
02:03:30fowlIts near the top of opengl.nim
02:04:34Xeaha
02:04:47Xeso I would cast the resulting call to the type of function I expect
02:05:04fowlXe maybe if you have a macro that converts proc x(...) Into var x: proc... And load/reload it later
02:05:22XeHmm
02:05:45Xedo I need to keep a handle to the .so open for the function to keep working?
02:05:56Xeimported function*
02:06:20fowlYou could call x() and changing the func x points to will update other calls (because they now use pointer to function behind the scenes)
02:07:26fowlXe I think the DL has to stay open otherwise the symbols in it won't exist
02:13:06*Jesin joined #nim
02:15:01Xeadd5Func = cast[proc (a: int) int {.cdecl.}](lib1.symAddr("add5"))
02:15:05Xeseems to fail compilation with
02:15:21Xetype mismatch: got (proc (a: int){.closure.}) but expected 'proc (a: int): int{.closure.}'
02:15:29Xeor did I miss a colon
02:15:59fowlIt means add5func is a closure (bare proc type is closure)
02:17:32Xeah
02:19:06fowlEr
02:19:22fowlNo you did miss a colon
02:19:46Xehttps://gist.github.com/Xe/3e3d18cef5602036660e
02:19:55Xeyeah I did
02:20:29Xeit's now failing with a different compile reason
02:20:44fowlYou're importing a closure function on purpose?
02:21:09XeI'm trying to import a function from a C .so
02:21:26Xeit's defined as a nim function though
02:21:39Xehttps://github.com/Xe/nim-shared-object-example/blob/master/add5.nim
02:21:39*kz joined #nim
02:21:46*rgv151 joined #nim
02:21:53Xethis gets built as https://github.com/Xe/nim-shared-object-example/blob/master/Makefile#L2
02:23:28fowlChange those closure pragmas to nimcall
02:24:39Xeah
02:24:41Xeokay
02:24:43XeYes that works now
02:24:45Xethank you so much fowl
02:25:26fowlno prob
02:29:00Xefowl: is there a way to make nim quietly compile?
02:31:50saml_aporia cannot find NimSuggest in PATH
02:36:48fowlXe, try verbosity:0
02:37:10fowlsaml_, are you on windows
02:37:19saml_no, linux
02:37:36saml_looks like compiler/nimsuggest doesn't get built
02:37:49saml_using devel branch of Araq/Nim
02:37:55onionhammerwish it was built as part of nims install, but it isnt
02:38:51saml_so i built it manually . now aporia finds it. but Go To definitnio segfaults
02:42:03Xeokay so as far as I've gathered
02:42:08Xeoptions before filenames with nim c
02:49:48fowl--run will pass the arguments after the file name to the exe
02:55:12*jholland quit (Quit: Connection closed for inactivity)
02:57:53*Jaood left #nim (#nim)
03:00:26*endragor joined #nim
03:01:54*BitPuffin|osx quit (Ping timeout: 245 seconds)
03:05:34*kz quit (Ping timeout: 246 seconds)
03:15:17*Xe quit (Ping timeout: 265 seconds)
03:17:13*saml_ quit (Remote host closed the connection)
03:22:10*vendethiel quit (Ping timeout: 255 seconds)
03:22:17*jj2baile_ is now known as jj2baile
03:22:31*rgv151_ joined #nim
03:23:28*rgv151 quit (Ping timeout: 272 seconds)
03:26:06*aboisvert joined #nim
03:26:24*Xe joined #nim
03:29:44*yglukhov__ joined #nim
03:30:15*bougyman quit (Ping timeout: 256 seconds)
03:34:23*yglukhov__ quit (Ping timeout: 264 seconds)
03:45:51*gyeates joined #nim
03:47:20*Kingsquee joined #nim
03:49:30*TEttinger joined #nim
03:56:02*darkf quit (Quit: Leaving)
03:56:20*darkf joined #nim
03:59:44*aboisvert quit (Quit: aboisvert)
04:05:14*Demon_Fox quit (Ping timeout: 245 seconds)
04:06:00*Demon_Fox joined #nim
04:12:26*endragor_ joined #nim
04:15:47*endragor quit (Ping timeout: 264 seconds)
04:19:53*kz joined #nim
04:21:38*endragor_ quit (Remote host closed the connection)
04:26:04*kz quit (Ping timeout: 246 seconds)
04:26:12*gyeates quit (Ping timeout: 256 seconds)
04:27:21*endragor joined #nim
04:27:47*gyeates joined #nim
04:29:53*Sembei joined #nim
04:30:36*endragor_ joined #nim
04:31:57*endragor quit (Remote host closed the connection)
04:32:21*EulersBackup quit (Ping timeout: 250 seconds)
04:33:09*Pisuke quit (Ping timeout: 256 seconds)
04:36:13*endragor_ quit (Remote host closed the connection)
04:40:11*endragor joined #nim
04:44:29*endragor quit (Ping timeout: 256 seconds)
04:45:42*endragor joined #nim
04:47:23*endragor quit (Remote host closed the connection)
04:50:39*endragor joined #nim
04:52:33*endragor quit (Remote host closed the connection)
04:52:50*endragor joined #nim
04:53:16*aboisvert joined #nim
04:56:47*endragor quit (Remote host closed the connection)
05:04:40*endragor joined #nim
05:07:37*endragor quit (Remote host closed the connection)
05:12:08*ddl_smurf quit (Quit: ddl_smurf)
05:13:25*vikaton quit (Quit: Connection closed for inactivity)
05:14:57*endragor joined #nim
05:16:41*filwit joined #nim
05:27:43*aboisvert quit (Quit: aboisvert)
05:32:17*endragor quit (Remote host closed the connection)
05:34:09*endragor joined #nim
05:37:37*endragor quit (Remote host closed the connection)
05:38:06*endragor joined #nim
05:44:06*BlaXpirit joined #nim
05:46:36*gsingh93 quit (Ping timeout: 240 seconds)
05:49:46*phira joined #nim
05:54:12*Jesin quit (Quit: Leaving)
06:05:21*dtscode joined #nim
06:05:56*gokr_ quit (Ping timeout: 240 seconds)
06:09:02*Jesin joined #nim
06:30:25*nande quit (Remote host closed the connection)
06:58:00*TEttinger quit (Quit: Leaving)
07:07:36*TEttinger joined #nim
07:08:41*yglukhov__ joined #nim
07:11:04*bjz joined #nim
07:16:00rgv151_is there a way to make macro return value?
07:16:34ldleworkrgv151_: macros have to return ast, that's the point
07:19:49rgv151_i c
07:20:47*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
07:21:12*bjz joined #nim
07:21:23*bjz quit (Client Quit)
07:21:47*Ven joined #nim
07:27:29*BlaXpirit quit (Quit: Quit Konversation)
07:27:38*endragor_ joined #nim
07:31:50*endragor quit (Ping timeout: 276 seconds)
07:33:21*OnO joined #nim
07:36:20*OnO quit (Client Quit)
07:36:41*bjz joined #nim
07:38:14*OnO joined #nim
07:40:57*JinShil joined #nim
07:42:55*HakanD joined #nim
07:44:22*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
07:45:25*endragor_ quit (Remote host closed the connection)
07:49:32*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
07:50:21fowlneat https://github.com/MasonMcGill/numerics
07:58:28dtscodeneater http://eleks.github.io/js2js/#features
07:58:52ldleworklol
07:59:15*bjz joined #nim
08:00:07ldleworkdtscode: https://github.com/jterrace/js.js/
08:00:54*Triplefox quit (Remote host closed the connection)
08:01:07dtscodei love everyhing about this
08:01:26*Triplefox joined #nim
08:01:28*Trustable joined #nim
08:01:37ldleworkoh my god all I want to do is go to sleep
08:01:44ldleworkwhhyyyy saltstack. whyyyyyyyy
08:02:08dtscodei want to sleep but compilers :/
08:03:08r-kuwho happens to know how to check if type is ref type (in macros)?
08:03:41*bjz quit (Client Quit)
08:05:39filwitr-ku: if T is ref: ...
08:05:50filwitr-ku: oh, macros, sorry
08:05:57filwitr-ku: use 'getType()'
08:06:02filwitin macros
08:06:23*JinShil quit (Quit: Konversation terminated!)
08:06:34r-kuand check returned NimNode == nnkRefTy?
08:06:43someplacewhat's argv in nim?
08:07:00filwitr-ku: yes, basically.
08:07:03r-kuthanks
08:07:59yglukhov__someplace: os.commandLineParams
08:08:07someplacecheers
08:08:45filwitr-ku: another hint: if you're using getType() with a typeDesc, you might need to call it twice.. the first call will give you just the 'typedesc' AST, so you call it again on the second child to get the real type AST.. if you're working with an instance though you only need it once.
08:09:53r-kuhmm somehow i cant pull it off. i get type identifier from AST, i suppose thats not what getType really wants
08:11:08filwitr-ku: if you gist an example of what you're going for I can help you future.
08:11:14filwitfurther*
08:11:45r-kuhttps://gist.github.com/r-ku/79454071e33c89ed3485
08:12:16r-kuim exploring Jehans named constructor idea by rewriting proc to allocate and initialize type. saves one keyword
08:12:21filwitr-ku: you need to pass by 'typed' i think. getType doesn't work with 'untyped'
08:13:07r-kustill getting "node has no type"
08:13:29filwitr-ku: k one sec.
08:14:56*Jehan_ joined #nim
08:15:18filwitr-ku: i'm not even seeing getType() here, but maybe I'm just tired?
08:15:40r-kuhttps://gist.github.com/r-ku/79454071e33c89ed3485#file-gistfile1-nim-L14
08:15:54filwitr-ku: i'm not sure exactly what you're going for with this, (also, Jehan_ just signed on, if you're trying something he suggested, maybe he'd be better help)
08:16:06Jehan_Umm. what's the matter?
08:16:31r-kuim exploring your named constructors idea by rewriting proc instead of having make "keyword"
08:16:45r-kujust cant figure out how to check if type is ref or not inside a macro
08:16:47ldleworkthat's crazy that you can reimplement proc
08:16:49fowlGettype(n).typekind== ntyRef
08:17:55Jehan_I'm not sure if you can if it's an immediate macro.
08:18:23fowlI was about to say that - it can't run on a proc macro like that
08:18:33filwitr-ku: here's how I do this: use a template + 'when T is ref' and call a macro based on that
08:18:41fowlThe proc is passed before it is instantiated
08:18:55r-kuoh thats a good idea filwit, its probably most appropriate way
08:18:55Jehan_Immediate macros basically postprocess ASTs after parsing, but before semantic analysis.
08:18:59*MyMind joined #nim
08:19:12*EulersBackup joined #nim
08:19:17fowl5 examples of macroshttps://gist.github.com/fowlmouth/3c74409c30533bb0a5b4
08:19:25Jehan_filwit: You'd have to embed that in the macro output.
08:19:27fowlMacros.Gettype *
08:20:09fowlGn
08:20:43filwitJehan_: macro output? I'm not sure what you mean. Let me make a example for r-ku real quick (i'm doing this exact thing in my own macros)
08:20:54r-kuhey filwit but wait, for template to work proc will have to be analuzed/defined already. then i wont be able to rewrite it?
08:20:56Jehan_macro output = the code that the macro returns.
08:21:39*yglukhov___ joined #nim
08:21:40filwitoh, i see, cause you're using this as a {.pragma.} macro
08:21:53r-kuyup, cause i want to rewrite proc itself
08:23:06filwitr-ku: what I do is have an 'impl' macro which accepts a type and a body of procs
08:23:08filwitimpl Foo:
08:23:19filwit proc init = echo me.name
08:23:22filwittype of thing
08:23:25gokrfowl: So... getType gives you the type of something in the AST, so its after semantic analysis?
08:23:30r-kubut its terribly ugly
08:23:43gokrOh, he went to bed
08:23:46fowlYea gokr
08:23:54gokrNow...
08:23:58fowlIrc from bed ;)
08:24:10gokrfowl: So if we want to go even further...
08:24:11filwitr-ku: i actually really like it for many other reasons, but what you're going for might be impossible ATM
08:24:44r-kuwell that check is not critical, but it would take away ability to tell when one is shooting himself in the foot because macro expects non-ref type
08:24:49gokrfowl: I am thinking of even more reflection - but ... all the code hasn't been parsed of course, only in the current module or?
08:25:05*yglukhov__ quit (Ping timeout: 265 seconds)
08:25:25fowlgokr: in the current scope
08:25:46gokrfowl: Right, so any thoughts on having macros that can operate even later in the compilation process?
08:25:47filwitr-ku: let me try something real quick and get back to you
08:25:59r-kuthanks for help
08:26:30fowlgokr: sure lots of times I'm using macros to build some compile time state and another macro that acts on it later
08:27:11gokrJust curious on what the "next step" is in this field.
08:27:47fowlRemind me tomorrow I'll make an example
08:28:01gokrfowl: Sure, cool stuff
08:28:30gokrI can't help contrasting it with the full reflection of Smalltalk and trying to see where it can go.
08:29:02*endragor joined #nim
08:34:47ekarlsoany cool things lately in nim ?
08:38:29filwitr-ku: yeah i'm pretty sure this is impossible. You have to pass the Type as 'typed', but you're trying to pick it up from the proc which you have to pass as 'untyped'
08:39:07*Trustable quit (Remote host closed the connection)
08:39:25filwitr-ku: it's unfortunate really. You could do it like this: proc init {.ctor:Foo.} = ...
08:39:36r-kuim no longer even sure if i can cover both ref and non-ref with one constructor declaration
08:39:43*Trustable joined #nim
08:40:17gokrekarlso: Did you see nimpdf?
08:40:32ekarlsogokr: nope :p
08:41:00gokrhttps://github.com/jangko/nimpdf
08:41:03gokrQuite impressive
08:41:16filwitr-ku: if you're going for named constructors, why not simply overload by type, eg: proc init(T:typedesc[Foo]) = ...; let f = Foo.init()
08:41:38ekarlsogokr: meh, I would like to see more network / services libraries in nim
08:41:46ekarlsolike http stuff, protobuf etc
08:41:59r-kufilwit: its pretty much what i got now, or close to it
08:42:03filwitr-ku: you could make a {.ctor.} macro which basically just turns 'proc init(f:var Foo)' into 'proc init(f:typedesc[Foo])'
08:42:11r-kuinit(T: type Foo, ...)
08:42:25gokrekarlso: That doesn't make nimpdf less cool ;)
08:42:26ekarlsogokr: it's where stufl ike Go has gotten tons of attention ;p
08:42:33r-kutype Foo same as typedesc[Foo]?
08:42:38filwityes
08:42:48r-kuyeah so thats what i got
08:43:04r-kubut i wanted basically to define single constructor that later worked for (ref Foo) too
08:43:19gokrekarlso: Sure
08:44:21*Demon_Fox quit (Quit: Leaving)
08:44:49r-kui be damned, it can be pulled off by doing so: proc init[T: Foo|(ref Foo)](self: var T) {.ctor.} =
08:45:31filwitr-ku: the problem is ref-types need to be allocated
08:45:50r-kufor some reason Foo() work in both cases somehow
08:45:57filwitthough technically you could just make the 'ctor' macro inject 'self = T()' as the first line
08:46:08r-kuah wait not in both heh
08:46:20r-kuyes thats what im doing already too
08:46:52filwitwell then that should work, since Nim's default constructors allocate ref types
08:47:03r-kuactually non-ref type misbehaves, field does not get set
08:47:20*Trustable quit (Remote host closed the connection)
08:47:20filwitthough the real solution here is build this pattern into Nim like I was planning on doing..
08:47:32filwitr-ku: ah.. right
08:47:47r-kuthis is what i got so far if interested https://gist.github.com/r-ku/79454071e33c89ed3485
08:47:59*Trustable joined #nim
08:48:12fowlWe have constructors that you manually write already. In the std lib they start with init or new
08:48:41filwitthose are not constructors
08:48:42*Trustable quit (Remote host closed the connection)
08:48:51filwitthose are allocators
08:49:02fowlHeh oh
08:49:22fowlAnd type.init isn't an allocator. It's a constructor?
08:49:27*bluenote joined #nim
08:49:28*Trustable joined #nim
08:49:33*Trustable quit (Remote host closed the connection)
08:50:04r-kufowl: those constructors are abomination
08:50:26filwitfowl: i don't see an 'init' in system, where are you finding this?
08:50:45r-kufilwit: i believe initTable() has that
08:50:53*Trustable joined #nim
08:50:55fowlI said "start with"
08:51:03filwitah, okay
08:51:47fowlRef-agnostic "allocator" is possible
08:52:10filwitthere are many reasons I don't like this and think Nim should have a real constructor pattern (one that triggers on it's built-in constructors).. I need to make that now I think.
08:53:29Jehan_What's a "real constructor pattern"?
08:53:36r-kufilwit: on thread i posted Jehan_ pointed out that T(x) is problematic because it is already used for converting to other type. then it becomes ambiguous, is it a conversion or ctor w/ one param. maybe you have ideas for fixing that?
08:54:30filwitactually that's not really a problem, in fact constructors with a single parameter would just work as a way to overload the conversion
08:54:48gokrJehan_: Your little "make" macro that enables the "make MyType.someProc(x,y,z)" style, was that mainly to demonstrate techniques or a serious idea?
08:55:18Jehan_gokr: It was basically an adaptation of Eiffel's constructors.
08:56:05gokrJehan_: Because... I can't really see its benefit. Ok, so it is visually standing out, and its separately specifying the type - but I mean... I don't see the exact benefits.
08:56:45Jehan_gokr: I'm personally fine with `newT` and `initT` myself.
08:56:48filwitJehan_: we've talked about this on the forums already. Basically we have a few issues with just using named function to allocate things (there's too many to list here, and I can't remember them all of the top of my head right now).
08:57:37Jehan_filwit: Yes, and I think the issues are imaginary.
08:58:10gokrPersonally if we a) added ability to restrict access to the current object literal "constructor" and b) added some kind of pragma to mark procs as being constructors - then life seems fine to me.
08:58:46gokrfilwit: I would actually like to see such a list of issues in more detail.
08:59:10filwitJehan_: yes i know your position on it, but I disagree (however you could, of course, be right). Either way, I think it wouldn't hurt for me to implement it and then debate about how it works instead of just talking theory.
08:59:32Jehan_The primary issue seems to be that Nim has a different look and feel from C++/C#/Java.
09:00:01filwitno that's not the issue at all, at least, not any issue I was ever talking about
09:00:41r-kumy main issue with constructors is that 1. they are not tied to type in any way and 2. there can be initSomething|cookSomething|makeSomething|newSomething|blahblahblaSomething
09:00:48Jehan_For example, while Scala has constructors (if only for Java compatibility), they are typically only used internally in a package and the companion object has Nim-like constructor fucntions.
09:01:05r-kunow what Jehan_'s named constructors fix is Type.<ide here can return list of constructors>
09:01:13r-kuthis makes things cleaner A LOT
09:01:17Jehan_r-ku: Those are features, not bugs.
09:01:31r-kufeature to make as much mess as one wants?
09:01:34Jehan_You do not want to have constructors tied to types. That's a leaky abstraction.
09:01:49filwitgokr: the discussion about my constructor concept (and Jehan + other's arguments against it) starts on this page: http://forum.nim-lang.org/t/703/6
09:01:53r-kui have no idea what that means Jehan_
09:02:09gokrr-ku: In Smallltalk which has "named constructors" there is no mess.
09:02:16r-kubut if you want two types use same constructor - just make overload and call other ctor
09:02:28Jehan_It means that you cannot have new T() return an instance of U, for example, where U is a different type.
09:03:06r-kui do not understand why one would call "new T()" if he wants U, then call "new U()"
09:03:11Jehan_This can occur, for example, if you change the implementation of T and U is a proper subtype of T.
09:03:11filwitbut you use named constructors for those, because they're not 'constructors' but 'factories'
09:03:28Jehan_r-ku: Because of information hiding.
09:03:31gokrIn Smalltalk one could however argue that the class is visible at the "call site" - but... if we marked "constructor procs" then an IDE can easily show us all these places too. And Nim is statically typed so the information is there AFAIK.
09:03:51Jehan_filwit: Yes, and once you've made something a "constructor", you cannot change that without breaking the API.
09:04:11r-kuJehan_: didnt you mean U being proper supertype of T?
09:04:37r-kuactually sorry
09:04:39Jehan_r-ku: No, I meant subtype. A specialized implementation of T.
09:04:40r-kumy logic got messed
09:04:45r-kuindeed
09:05:06Jehan_filwit: Most people in favor of constructors are talking aesthetics. I'm talking about the software engineering aspect.
09:05:15r-kubut this very well reminds me c++ implementation hiding with virtual header stuff
09:05:27r-kudoes this even apply in nim?
09:06:05gokrNim not having constructors á la Java/C++ etc is a huge virtue IMHO. Of course, I come from Smalltalk, so its natural to me.
09:06:33filwitJehan_: well i'm not fully understanding the problem you'd addressing really. I don't see how 'breaking the API' is any more a problem then changing the parameters of a proc is 'breaking the API' which will happen all the time. But again, I don't see what you're referring too exactly
09:07:00Jehan_gokr: Yeah, it's a matter of background, I think. I come from using languages like Eiffel and ML, so I don't get the obsession with using C++-style constructors.
09:07:15gokrI just ask people that haven't used a lang with named constructors - to not just say "its a mess". Because its not.
09:07:21filwitJehan_: and I was never really talking about the aesthetics. Personally I was always happy with Type.new(...) overloading
09:07:31Jehan_filwit: I'm not changing the parameters or the result type of the proc in my example.
09:07:45filwitbut then it's an invalid comparison?
09:07:45Jehan_filwit: Type.new has the exact same problem.
09:08:05Jehan_filwit: No, because I'm not using constructors. You are.
09:08:12Jehan_Hence my API doesn't break and yours does.
09:09:09filwitI don't see how this is actually a problem though. You's saying that if you change a fundamental type in your API, that all the constructors of it will break? Perhaps you could give an code example for clarity.
09:09:45Jehan_filwit: No.
09:10:11Jehan_I can write makeMeATLikeThing and have it return an instance of either T or U.
09:10:56Jehan_When you write `new T`, you're stuck with an actual instance of T.
09:11:07Jehan_Because new T hardcodes the allocation of an instance of T.
09:11:34Jehan_This is also why C++ has all these other hacks like placement new.
09:12:03gokrOne very important thing you often do in Smalltalk - is to find all instantiations of a class. There are basically two ways in Smalltalk - either look at all references to the class (catches slightly more than all instantiation sites) or look at all callers of the specific named constructor (if there is one). In Nim Araq mentioned we can probably identify "constructor procs" with heuristics, or else I can live with a pragma marking them.
09:12:12filwityeah sure, but now lets talk about how often you want a constructor to return T or U vs the places you just want a convenient way to construct an object.. and nothing about constructors prevents you from making named constructors which do what you're suggesting.
09:13:07ldleworkgokr: why would I ever need to do that in Nim?
09:13:08Jehan_filwit: Constructing an object isn't hard.
09:13:25gokrldlework: Find instantiation sites?
09:13:38filwitJehan_: i agree, but it could be improved. That's my point.
09:13:42ldleworkor all instances of a class or any other craziness you just mentioned
09:14:02gokrldlework: Are you serious?
09:14:14ldleworkgokr: I've been writing code for a long time
09:14:25ldleworkI simply have never needed to do either of those things
09:14:31ldleworkI'm asking you why you would
09:14:37*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:14:46Jehan_ldlework: Debugging?
09:15:00gokrThere are tons of reasons. But if you haven't used advanced IDEs on a very large codebase - then fine.
09:15:01Jehan_ldlework: Right now I'm trying to hunt down a bug in the GC.
09:15:05ldleworkJehan_: tools do that, so okay maybe gokr is writing a debugger?
09:15:11filwitJehan_: one of the biggest ways it could be improved that has nothing to do with aesthetics, is by making it impossible to use the constructor syntax T() where you want explicitly set variables T(1, 2), that need to be constructed (eg, they can't just be marked 'not nil' or are obj type)
09:15:29ldleworkgokr: are you writing an IDE/debugger?
09:15:45Jehan_For which it would be very helpful to be able to enumerate all instances of a type. (Though, in fairness, the problem is here that I'm doing this in a part of the code where I can't do memory allocations.)
09:15:46ldleworkgokr: you said it was 'very important' but that seems more like 'extremely narrow'
09:15:54ldleworkI was just thrown off
09:15:56gokrldlework: No, its not narrow
09:16:05ldleworkgokr: what other usecases are there for that?
09:16:10r-kuehm either of you would happen to know how i could make variable alias? result = T(); var self = result; makes copy of self into result. i want self to be alias of result. possible? (non-ref type)
09:16:30gokrldlework: There are literally tons of reasons for me to want to find all places a specific class is instantiated or otherwise used.
09:16:42ldleworkI'm asking what some of them are.
09:16:56Jehan_filwit: Not sure I understand what you mean there?
09:17:10gokrOk, so let's say I want to change class X, I want to find all its usages.
09:17:12Jehan_If it's about exposing the type without the constructor, yeah, that's in need of a clean-up.
09:17:23ldleworkgokr: we already covered "features of your ide so it can refactor for you"
09:17:28gokrOr let's say I am learning about class X - I want to look at all the code using class X to see sample code
09:17:39ldleworkgokr: okay so "IDE refactor features"
09:17:47gokrldlework: The whole Smalltalk env is written in itself.
09:17:54ldleworkgokr: okay?
09:18:31gokrldlework: You lost me. Let me go back a few steps here
09:18:43ldleworkgokr: you said this was 'very important'
09:18:58gokrI am talking about the ability for tools/compilers to find all instantiation sites.
09:18:59ldleworkbut it doesn't seem very important outside of 'ide reflection features'
09:19:08ldleworkgotcha
09:19:17gokrAnd tools can't do that easily unless there is something to go on.
09:19:24ldleworkYeah. That's been established.
09:19:28gokrRight now we don't have constructors.
09:19:31ldleworkI guess that's the opposite of narrow to you.
09:19:32gokrWe have procs.
09:19:59gokrSo in Nim - if I want to see all places where we instantiate class X - what do I do?
09:20:07gokrOr rather, what does the tool do?
09:20:15ldleworkI understand, what you want, and what you need.
09:20:30ldleworkI was puzzled by how this is very important, since I have never needed this from a language for any software I personally have written.
09:20:37ldleworkI hope you can understand my small momentary confusion
09:20:51ldleworkAnd that it is not about what features are needed to implement IDE features.
09:20:53gokrldlework: I am trying to understand it - but ... I am slightly perplexed.
09:21:04Varriountgokr: Look at every possible code path that calls a procedure that instantiates or creates a new instance of type X?
09:21:11filwitJehan_: yes, basically. But my proposal did that + makes it easy to overload the attractive constructor syntax (which has the least amount of noise, so people will always want to use it IMO). So I don't see how we loose anything with that. We still have named constructors for the places you want, we get the ability to enforce a specific constructor is called (beyond manually allocating and setting memory), and we get to extend the sexy
09:21:11filwitconstructor syntax that is basically useless for anything more complex than a Vector type.
09:21:23ldleworkgokr: K
09:21:30gokrVarriount: Yeah, basically.
09:21:45gokrIn Smalltalk we use a lot of cross referencing tools.
09:21:46Jehan_gokr: Good programming style should have all constructors for a type embedded in a module that declares that type.
09:21:49Varriountgokr: Which isn't an easy task.
09:21:58gokrIts very common to pull up a browser on all methods that reference class X.
09:21:59filwitbasically useless.. **right now**
09:22:16Jehan_This generally makes it easy to find them without tools.
09:22:20gokrJehan_: Yes, but that module has lots of procs.
09:22:49gokrThen ldlework asked why on earth I would want to find all instantiation sites.
09:23:05Jehan_filwit: So, back to aesthetics because it's "the attractive constructor syntax"? (That I personally don't find attractive at all, but that's subjective.)
09:23:16ldleworkgokr: *other than implementing an ide feature*
09:23:22gokrI presume anyone who have used say Eclipse in a large Java codebase - have often pulled up "all references to class X"
09:23:36gokrWhich is slightly wider net of course.
09:23:45Jehan_gokr: You have the same problem with a class that implements tons of constructors.
09:23:59gokrBut in Eclipse one can also show all calls to a specific constructor.
09:24:04filwitJehan_: it's not just about aesthetic appeal, it's about extending what people will gravitate towards (because of aesthetics) to be better
09:24:05gokrJehan_: Yes.
09:24:45gokrBut my original point was that I would like for "Nim" to be able to distinguish constructor procs. Either by pragma marking them, or as Araq says - it can be done with heuristics.
09:24:54Jehan_gokr: Here's a question: Is diagonalMatrix(n: float) = identityMatrix() * n a constructor?
09:25:11Jehan_I.e. if a constructor is implemented purely in terms of another constructor, is it still a constructor?
09:25:47gokrJehan_: I agree that Nim has many more "mechanisms" that ... the term constructor is not as easily defined as say in Java or Smalltalk.
09:26:22gokrldlework: Haven't you ever done a "show me all places where this constructor is called" in say Eclipse?
09:26:29Jehan_gokr: It's more that, for example, a purely functional language cannot really have constructors in the OO sense.
09:26:32RegisterOnhttp://forum.nim-lang.org/t/703/2
09:26:56Jehan_You instantiate all variables at once because they can't be mutated later on.
09:27:22Jehan_Advanced "constructors" then have to call upon the basic data constructors.
09:27:54ldleworkgokr: thousands of times. you keep just ignoring my adjustment to the conversation in that, you said very important, this struck me as odd and I wanted to know more, you said language features, I said okay that seems narrow for something that's very imporatnt anything else, and you are now just repeating ide features over. I don't know what else to say. I wasn't attacking you I was just curious what you meant.
09:28:25ldleworkI agree that reflection is both awesome and useful for ide features. No disagreement at all.
09:28:35Jehan_Anyhow, I have to tune out for now (work and finding the GC bug).
09:29:04gokrldlework: Btw, I didn't say "all instances of a class" - I said instantiation sites. All instances is something else.
09:29:34ldleworkgokr: which smalltalk must also do
09:29:38ldleworksince it can reload instances
09:29:42ldlework(which is crazy)
09:29:48Jehan_gokr: Eh, that's easy. All calls of T(...) and all new(x) calls where x is of type T.
09:29:55gokrldlework: yes, but I wasn't talking about that. And no, its not crazy.
09:30:01Jehan_Anyhow, gotta go.
09:30:05*Jehan_ quit (Quit: Leaving)
09:30:08ldleworkgokr: crazy like a fox
09:30:13ldlework(ie, crazy awesome)
09:30:20gokrldlework: ah
09:30:38gokrldlework: But I am actually trying to answer you. Let me reread what you wrote above
09:31:12ldleworkgokr: I thought you were saying that finding the instantion sites of a class was 'very important' in that it is important day-to-day or even for a wide range of tasks in the language.
09:31:21ldleworkI was like "what could you possibly use that for"
09:31:49ldleworkyou brought up IDE stuff, which yeah is obvious. I asked if you could think of anything else, but mentioned more ide features. That's fine. Maybe that's all its good for.
09:32:06gokrOk, so I use it all the time in Smalltalk - because in a large codebase I need to find all these places.
09:32:20ldleworkYeah but you don't use that as a way to implement features in your program
09:32:22ldleworkThat's what I meant
09:32:43gokrEh... no? Did I ever claim that?
09:32:45ldleworkYou don't use those features to implement normal applications, usually, unless that application is some ide tool
09:32:58ldleworkgokr: nope, you didn't. You said it was 'very important'
09:33:02gokrI just said I want my tools to be able to do it.
09:33:16ldleworkAnd *I* wondered how it could be important, like, from a day to day persepective
09:33:24gokrAnd they can't do it if the procs are "just like all other procs"
09:33:40ldleworkI know! but you'll just have to trust me, because I'm gonna stop saying it now.
09:33:59ldleworkgokr: pharo seriously needs just a basic updated walkthrough
09:34:24gokrI said "One very important thing you often do in Smalltalk - is to find all instantiations of a class"
09:34:30ldleworkLike no one has to update the whole by example book, just a new tiny little beginner's article
09:34:39gokrOk, so you thought I was describing "code" that does that.
09:34:50ldleworkgokr: yes, I interpreted that to mean "this is something you literally d oall the time while writing smalltalk applications"
09:35:02ldleworkrather than "this is an important feature of smalltalk to support is many awesome ide features"
09:35:22gokrBut let me then rephrase: "One very important thing you often do when you work in Smalltalk - is to have your tools finding all methods that instantiate a class."
09:35:29ldleworkhaha yes
09:35:32*filwit quit (Quit: Leaving)
09:35:33ldleworkthat's what I get you to mean now
09:36:05gokr"while writing" - yes. "in code" - no.
09:36:32gokrldlework: Did you try the "PharoTutorial go"
09:36:39ldleworkyeah but it was too tedious
09:36:51ldleworkpharo is very click, type, click type
09:36:57ldleworkand omg, I hate clicking
09:37:00ldleworkand using the arrow keys
09:37:02ldlework:(
09:37:14gokrI am actually a really bad person to ask for learning advice on Smalltalk - since I haven't read a book on Smalltalk in like 15 years.
09:37:19ldleworkhaha
09:37:33*filwit joined #nim
09:37:58ldleworkgokr: what would be really cool to see, is a small opengl demo, with a commandline repl, that allowed me to change the scene in realtime
09:37:59gokrBtw, there are different Smalltalks - GNU Smalltalk is more Vim style.
09:38:14ldleworkor something similar to that anyway
09:38:16gokrBut why a command line repl?
09:38:21ldleworkso I can interact with it
09:38:27gokrYou can type and run code everywhere in Pharo.
09:38:28ldleworkI mean, a full editor would be cool too
09:38:34ldleworkI know, but it sucks, as an editor
09:38:42fowlLol
09:38:42gokrLiterally *any* place you can type code - you can run it.
09:38:47ldleworkI know
09:38:56ldleworkbut as an interface for editing text, its really horrible
09:39:07gokrSo you think a REPL is better?
09:39:10ldleworktrust me, I'm amazed by the actual environment
09:39:14ldleworkgokr: if it has readline? yes.
09:39:34gokrI never understood why people love typing in line by line in a single window that echoes something back.
09:39:43ldleworkgokr: well, emacs integration would be ideal
09:39:51ldleworkI just figured repl wasn't asking for too much
09:40:00ldleworklike, I underbid, by saying repl
09:40:18ldleworkanything that is decent at editing text, unlike pharo
09:40:20gokrWhen I instead can use lots of tree explorers, inspectors etc - and run code and look at stuff and drill - in many windows in parallel.
09:40:24filwitldlework: https://www.youtube.com/watch?v=db-7J5OaSag
09:40:30fowlldlework: pharo included sdl2 so I bet it uses opengl (whether its exposed for you or not, idk)
09:40:37ldleworkgokr: all that stuff is nice assuming you can /type text/
09:40:45ldleworkgokr: hehe, I'm only half teasing though
09:40:48ldleworkit was kind of painful
09:40:49*antranigv1 joined #nim
09:41:04ldleworkfilwit: heh nice
09:41:09gokrldlework: There is some Emacs/Vim thingymabob to give those key bindings
09:41:24ldleworkgokr: oh that would be wonderful
09:41:29gokrfowl: Pharo can do OpenGL in many ways
09:41:43filwitldlework: i know i thought that was pretty cool.. it's for Oculus, which I have.. but I haven't tried this one yet..
09:41:55ldleworkfilwit: if I could get this with multiplayer, my life would be complete
09:41:59ldleworkI yearn for the metaverse so bad
09:42:09ldleworkand I don't mean secondlife, I just mean empty room that we can both script at the same time
09:42:16filwitwatching yoru program come to live before your eyes in VR would be absolutely awesome though
09:42:17ldleworkseriously, I would never leave there.
09:42:23ldleworkfilwit: agreed
09:42:27filwitlol, true
09:42:33ldleworkI would make little artificial life experiments
09:42:37ldleworkand give them names...
09:42:49ldleworkI'm squeeee'ing so hard at the thought
09:42:49gokrfilwit: That looks similar to what we can do in our system.
09:42:55filwitthe only problem is Oculus doesn't have enough resolution to make coding in it comfortable
09:43:07filwitgokr: yeah i was just thinking that
09:43:21r-kuim nearly done with my macro, check it out here: http://forum.nim-lang.org/t/1190/2#7420
09:43:26fowlHaha that video. "I'm in three dimensions, I need a two dimensional space to work on though"
09:44:19filwitfowl: actually they're making a 3D compositor for Wayland (at least someone started it).. looked pretty cool, and basically breaks down everything we know about how to right compositors so far (I mean.. what IS a 3D "window" anyways)
09:44:28Varriounthttps://www.youtube.com/watch?v=VzFpg271sm8
09:45:19antranigv1anyone thought of nim for pedagogical use?
09:45:42antranigv1for 15yo kids, say (: as a replacement for pascal/python in school
09:46:07*antranigv1 thinks to post the question in the forums
09:46:09gokrHere is a video showing OpenCobalt which is same system as ours: https://www.youtube.com/watch?v=1s9ldlqhVkM
09:46:22*antranigv1 is now known as antranigv
09:46:26r-kuantranigv1: i bet it could replace pascal, but python is still easier
09:46:44ldleworkgokr: the probelm I have with systems like these, is that they are optimized to simulate offices and avatars and such
09:46:55antranigvas a replacement for pascal, I'd love to see Oberon in schools
09:47:02r-kutbh pascal in schools is terrible terrible decision, better teach them language that is actually useful in industry nowdays
09:47:04antranigvnim and oberon are similar in very ways.
09:47:11Varriountr-ku, antranigv: Nim still has some really pointy bits that stick out and trip you up.
09:47:15gokrldlework: Our system is not "optimized" for that.
09:47:44antranigvno, I disagree. pascal is very goo, they (the kids) should know what is programming, not what is pascal (a language)
09:47:46fowlOberon and pascal? Where do you go to school that teaches those
09:47:59antranigvI learned pascal in school in Syria
09:48:01gokrldlework: Its in fact a generic synchronized object memory - that models a 3D space.
09:48:24ldleworkyes and then there is a ton of stuff built ontop of that foundation right?
09:48:27antranigvoberon was a relpacement, no nothing changed, cz of the war
09:48:31ldleworkthat costs cycles and memory?
09:49:08gokrldlework: Well... cycles and memory... not sure what you mean.
09:49:11ldleworkgokr: can I run your thing easily, without any assumptions? multiplayer black programming void?
09:49:41ldleworkor do I need a landscape and an avatar and so on
09:50:08filwitactually Nim would make a great educational language. It's safe enough and easy enough for beginners, is a natural stepping stone from Python in some sense, and can be used to teach all the low-level stuff without having to deal with C
09:50:33ldleworkgokr: woah lorenz attractor demo is kind of exactly what I'm imagining
09:50:54gokrldlework: Our system is a product for collab, not a programming framework. But our "worlds" can be very custom, its not hardwired.
09:50:59*HakanD quit (Quit: Be back later ...)
09:51:19gokrCroquet was built as a generic platform for shared 3D worlds, in whatever shapes and forms.
09:51:26ldleworkgokr: okay, so you and I can't jump into a space and code collaboratively on things that are simulated in the same space?
09:51:46ldleworkto me, this is what the word 'metaverse' means
09:51:49ldleworknot these virtual offices
09:51:57fowlI too am interested in multiplayer smalltall
09:52:02gokrldlework: In our product we don't expose that. Croquet however does, and we build on the same codebase.
09:52:24ldleworkgokr: I tried to look at Croquet before, and I failed to use it.
09:52:31*gokr going to nim-offtopic
09:53:38*antranigv joins gokr
09:58:48*Ven joined #nim
10:03:06*bjz joined #nim
10:14:56*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:20:36*bjz quit (Ping timeout: 240 seconds)
10:35:03rgv151_i c
10:35:08*rgv151_ quit (Quit: Leaving...)
10:36:54*vikaton joined #nim
10:42:22*yglukhov___ quit (Ping timeout: 272 seconds)
10:43:00*yglukhov___ joined #nim
10:44:09*bjz joined #nim
10:48:18*JinShil joined #nim
10:52:10*HakanD joined #nim
10:53:01Senketsuumm is there any reason why importing a wrapper (db_sqlite/sqlite3 for example) causes double free error and such with threading? any way to prevent that ?
10:55:30Senketsuactually importing only sqlite3 doesnt seem to cause that
10:56:29*HakanD quit (Ping timeout: 245 seconds)
11:15:23*arnetheduck joined #nim
11:24:09*wb joined #nim
11:28:57*BlaXpirit joined #nim
11:34:28*HakanD joined #nim
11:52:54*milosn quit (Quit: leaving)
11:55:52someplacehttp://hastebin.com/hoqaqajoye.avrasm <- any idea how I'd debug this?
11:56:02someplaceusing the nim-lang/irc module
11:58:16*Jehan_ joined #nim
12:01:50*saml_ joined #nim
12:05:52Senketsusomeplace, would check all strings first, probably you are accessing non-initialized string ?
12:07:52*gyeates quit (Ping timeout: 272 seconds)
12:08:36*drewsrem joined #nim
12:09:45someplacehm.
12:10:14def-Looks more like a GC bug to me
12:10:22def-maybe there's an existing Issue about it
12:10:22someplaceI don't see where it would be happening in this code, but I'm worried that it's a GC or async bug
12:10:24someplacehm
12:10:32someplaceI'll dig around
12:11:55Jehan_I've just found a GC bug (well, not technically a bug in the GC, but a result of the interaction of setjmp() and some compiler optimizations).
12:12:00Jehan_Not sure if it's related.
12:12:05someplacehttps://github.com/Araq/Nim/issues/2650 < same lib, no GC in backtrace though
12:12:34Jehan_GC in backtrace often shows up as a side effect of memory corruption.
12:12:54someplacethat's fun
12:12:56Jehan_For example, if you do a copyMem() that's overwriting stuff, then you will probably wreck reference counts.
12:13:19Jehan_But that's why you want to be careful with the low-level primitives.
12:14:27someplaceit only happened once, overnight, hasn't happened again yet
12:21:12*kokozedman joined #nim
12:22:29kokozedmanhey guys, I'm trying to generate C++ codes, but I also use mips for OpenWrt. Specifying the compiler is mips.linux.gcc.exe for the C compiler, but what is the config for the C++ compiler definition?
12:25:17def-mips.linux.gcc.cpp.exe maybe
12:30:28kokozedmandef-, yeah, that worked... thanks
12:32:04Jehan_def-: I've found the bug (I think).
12:32:21def-Jehan_: great
12:32:46Jehan_Basically, jmp_buf may not always be word-aligned.
12:32:53drewsremIt seems to me that compiler/nimlexbase.nim is the exact same as lib/pure/lexbase.nim only that it uses llstream.nim instead of "normal" streams. - Is it deliberate that llstream is not "general" enough to put into the stlib or does the stream-interface not allow the efficiency that llstreams provide?
12:33:02Jehan_In which case scanning the registers will not find the pointers therein.
12:33:21Jehan_It can also with --opt:size result in no addresses on the stack being found at all.
12:34:12def-Weird that this didn't pop up before
12:34:40*Kingsquee quit (Quit: Konversation terminated!)
12:36:17filwitr-ku: replied to your forum post
12:40:12Jehan_def-: It is pretty rare. It becomes fairly reproducible with --opt:size on OS X.
12:40:29Jehan_But on OS X, clang is the default, which doesn't do what gcc does.
12:40:46Jehan_Basically, sizeof(jmp_buf) == 0x94 on OS X.
12:41:16Jehan_clang still aligns it properly; gcc can sometimes put it at an address that isn't word-aligned.
12:42:46Jehan_I'm more concerned at the moment that C structs on the stack with __attribute__((packed)) can throw things off.
12:44:01*Matthias247 joined #nim
12:44:21Jehan_If packed structs are being used, then the entire stack has to be scanned in byte rather than word increments.
12:44:39*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:46:40*gyeates joined #nim
12:50:35def-Hm, sounds bad
12:53:55Senketsuhmm only impure libs cause the seqfaults on import .. weird
12:54:43*JinShil quit (Quit: Konversation terminated!)
12:56:20gyeatesso is nimble the successor of babel?
12:56:31gokryup
13:02:54BlaXpirits/the successor of//
13:03:14BlaXpiritjust a rename
13:03:25*vikaton quit (Quit: Connection closed for inactivity)
13:03:49drewsremIn what "metasyntax" is nims grammar written in? https://github.com/Araq/Nim/blob/devel/doc/grammar.txt i.e. how do I read it?
13:04:12cryzedprobably BNF?
13:05:53drewsremI don't think so
13:06:24drewsremBut I guess it's a mixture
13:09:44drewsremThere's stuff like ^* ^+ e.g.: exprList = expr ^+ comma
13:16:56drewsremAhhh stupid me, it's right in the beginning of the manual
13:19:50Jehan_def-: Yeah. At least it looks as though if you're just putting packed C structs on the stack that it won't affect the positioning of other variables. So, as long as you don't haverefs within one (which you shouldn't, according to the manual), then you'll be good.
13:25:45*saml_ quit (Ping timeout: 240 seconds)
13:29:42*BitPuffin|osx joined #nim
13:37:09*BitPuffin|osx quit (Ping timeout: 256 seconds)
13:42:51someplaceoh
13:42:57someplacere: that crash I found this in the compile low
13:42:59someplacelog, even
13:43:01someplacelib/nim/pure/asyncdispatch.nim(1196, 8) Warning: 'cb' is not GC-safe as it accesses
13:43:03someplace'nameIterVar' which is a global using GC'ed memory
13:43:08someplaceis that known? an issue?
13:44:17fowlA warning
13:45:56someplacethis is re: a gc crash with asyncdispatch in the traceback
13:46:15XeHow do you define a c struct in nim?
13:46:29Xeis it just an object with a cexport pragma?
13:46:54someplaceyou probably want the packed pragma too
13:47:03fowlTo export it yea
13:47:57fowlPacked just adds __attribute(packed)
13:48:23Xedo you know of a code sample?
13:49:03fowlXe: its 'exportc' are you having trouble?
13:49:35XeI'm not quite sure I understand how to make a structure-like thing in nim
13:49:51fowlType x {.exportc.} = object ..
13:51:23Xedoes the type have to be exported for the exportc pragma to work?
13:51:28Xeer
13:51:37Xetype X* vs type X
13:55:30fowlaha unless you use the type it doesnt show up
13:55:55fowland when it does show up, its in the module's .c, not some .h where it would be usable
13:57:42Xehmm
14:04:37*darkf quit (Quit: Leaving)
14:04:56*TEttinger quit (Ping timeout: 244 seconds)
14:09:21Xebah
14:09:23Xewifi
14:10:17Xehttp://ix.io/ilY -> http://ix.io/im0
14:11:00*gyeates quit (Ping timeout: 256 seconds)
14:12:07fowlXe, looks like "object" is not a good module name
14:12:25Xewelp
14:12:51fowli believe if you tried to import it you would get a syntax error
14:13:51Xeis there a if __name__ == "__main__" in nim?
14:14:10fowlthere's a special symbol "isMainModule" that is true when the current module is the main module
14:14:16fowlwhen isMainModule:
14:17:03kokozedmanc2nim documentation is 404: http://nim-lang.org/docs/c2nim.html
14:17:13*yglukhov___ quit (Ping timeout: 264 seconds)
14:17:51*yglukhov___ joined #nim
14:22:06Xefowl: so I have an object C exported into a .so file, how can I use it?
14:22:32fowlXe, datatypes dont end up in the end product (dll, exe)
14:23:09Xehmm
14:23:25fowlcan you move it to a header and importc it instead
14:23:47Xecan a C struct refer to nim types and vice versa?
14:24:38fowlc is less useful than nim
14:25:03XeI'm more thinking about how I would pass data between loaded libraries
14:25:04fowlfor ex a generic function can't be in the compiled exe
14:25:19Xeprimitives work fine, but I'd like to be able to pass objects around
14:30:16Xethings like hash tables, arrays, etc
14:33:07*Ven joined #nim
14:34:51*aboisvert joined #nim
14:37:27*Jehan_ quit (Quit: Leaving)
14:38:12*gsingh93 joined #nim
14:39:34*gyeates joined #nim
14:47:58*jholland joined #nim
14:49:26*pregressive joined #nim
14:49:43*milosn joined #nim
14:52:01*gsingh93 quit (Ping timeout: 250 seconds)
14:58:37*HakanD quit (Quit: Be back later ...)
14:58:49*Jehan_ joined #nim
15:00:02*HakanD joined #nim
15:04:56*HakanD quit (Ping timeout: 240 seconds)
15:08:41*gyeates quit (Ping timeout: 265 seconds)
15:13:01*HakanD joined #nim
15:14:09*vendethiel joined #nim
15:14:35*banister joined #nim
15:32:55*Matthias247 quit (Read error: Connection reset by peer)
15:34:11*ingsoc joined #nim
15:37:25*vendethiel quit (Ping timeout: 244 seconds)
15:37:45*gsingh93 joined #nim
15:47:48*sick joined #nim
15:48:14sickHey all!
15:48:52def-Hi sick
15:49:18sickI have a table that contains a seq value (Table[string, seq[string]]), but I cant seem to 'add' to the seq
15:49:51sickI tried: t["a"] = @[], then t["a"].add "b"
15:50:05sickbut it complains that the seq is not a var type
15:50:06def-t.mget("a").add("b")
15:50:13sickahh
15:50:35sickthat worked!
15:50:40def-this is something we wanted to improve, so that ["a"] works, but there are a few problems with that: https://github.com/Araq/Nim/pull/2435
15:50:41sickthanks def-!!
15:51:13sicknice I'll take a look
15:53:02*vendethiel joined #nim
15:53:33*aboisvert quit (Quit: aboisvert)
15:54:28def-Basically we wanted to have mget and [] have the same semantics, but then all the code depending on the old semantics breaks
15:54:37*HakanD quit (Quit: Be back later ...)
15:55:38*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:55:47*Varriount|Laptop joined #nim
15:56:08sickYea just finished reading the PR comments
15:56:46sickit would certainly look cleaner using []
15:57:12sickbut I'm pretty impressed with Nim so far :)
15:57:19*zahary quit (Read error: Connection reset by peer)
15:57:23Varriount|LaptopMeep
15:57:35Varriount|LaptopI'm free! All my exams are over!
15:59:59*Strikecarl joined #nim
16:00:10StrikecarlEasiest way to clear screen in Nim? without spamming Echo ofcourse.
16:00:19Strikecarllooking for something like the windows command "cls"
16:00:32def-Strikecarl: http://nim-lang.org/docs/terminal.html#eraseScreen,
16:01:24*aboisvert joined #nim
16:02:27StrikecarlWeird.
16:03:24Varriount|LaptopSomeone needs to create self-aware documentation
16:06:02Strikecarl"execution of an external program failed" ugh
16:06:08StrikecarlThis basicly sums up my life
16:06:11Strikecarltheres an erro.
16:06:15Strikecarlerror*
16:06:16def---parallelBuild:1
16:06:19StrikecarlBut it won't tell me what to do.
16:06:22Strikecarlwhat does that do?
16:06:42def-it builds 1 file at a time and outputs errors at compilation
16:06:49StrikecarlOh thanks :)
16:06:54Strikecarlgreat
16:06:58Strikecarldidn't do anything
16:07:00def-but i think you should just compile without "-r"
16:07:02Strikecarl"Process terminated with exit code 1"
16:07:12def-and run it by hand afterwards
16:07:17Varriount|LaptopStrikecarl: What's the console output?
16:07:20Strikecarloh wait
16:07:22Varriount|LaptopLike, all of it.
16:07:24Strikecarli am SO FUCKING RETARDED
16:07:26Strikecarllmao
16:07:29StrikecarlI had the program open
16:07:34Varriount|Laptop-_-
16:07:34Strikecarlthe .exe it was trying to compile...
16:07:39Strikecarlfacedesk...
16:10:14def-Hm, how can I get a variable into a nim file from the compilation line? os.getEnv seems to work at compiletime, but --os:standalone destroys it
16:11:04Varriount|Laptopdef-: What kind of variable?
16:11:08def-a filename
16:11:14def-I'm doing something really weird
16:11:24Xedef-: code generation?
16:11:54Varriount|Laptopdef-: Maybe you could use the process running procedures to grab output from the system shell?
16:12:04def-oh right
16:12:07def-staticExec
16:12:12def-thanks!
16:12:22*bluenote quit (Ping timeout: 246 seconds)
16:12:28Varriount|LaptopWhy does os:standalone not work?
16:13:26def-no more posix compatibility for the times module
16:13:28def-(or os module)
16:13:42def-but I'm os:linux at compiletime, then os:standalone at runtime, just no way to encod ethat
16:14:17*vendethiel quit (Ping timeout: 246 seconds)
16:18:50def-great, works
16:18:56def-Now I can make https://github.com/def-/nim-small-coreutils nicer
16:19:00*mal`` quit (Ping timeout: 276 seconds)
16:25:02*mal`` joined #nim
16:25:52BlaXpiritdef-, don't you think you're taking this binary size thing too far?
16:26:40*endragor quit (Remote host closed the connection)
16:27:13Varriount|Laptopdef-: Your tools don't handle all the wierd corner cases of disrupted writes and the other 100 corner cases.
16:27:21*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:30:56*OnO joined #nim
16:36:43Varriount|Laptopdef-: I just saw your PR for taking advantage of GCC and Clang's arithmetic with overflow functions
16:37:41*vendethiel joined #nim
16:38:19Varriount|LaptopYou would think that the C standard would have arithmatic overflow operations already...
16:43:59*rgv151 joined #nim
16:47:53*yglukhov___ quit (Ping timeout: 246 seconds)
16:57:36*vikaton joined #nim
16:59:21*vendethiel quit (Ping timeout: 265 seconds)
17:03:16*brson joined #nim
17:03:20Jehan_Varriount|Laptop: About the GC pull request you were asking about on GitHub: Basically, that my program kept crashing with gcc and --opt:speed or --opt:size.
17:03:37Varriount|LaptopJehan_: Ah, ok.
17:11:20def-BlaXpirit: sure i am, but it's fun, so who cares?
17:12:17BlaXpiritnot exactly my definition of fun
17:18:52Jehan_BlaXpirit: Well, lots of people also do sudoku puzzles ...
17:20:49*drewsrem quit (Quit: Leaving)
17:20:55*vendethiel joined #nim
17:24:04*brson_ joined #nim
17:26:57*brson quit (Ping timeout: 244 seconds)
17:26:57*EulersBackup quit (Ping timeout: 244 seconds)
17:33:47*brson_ quit (Quit: leaving)
17:33:55*brson joined #nim
17:37:25*Varriount|Laptop quit (Ping timeout: 246 seconds)
17:42:44someplacehttp://hastebin.com/panazapexo.pas <- the crash again, but with useSysAssert and useGcAssert
17:42:57someplaceapparently happened just after the bot sent a message
17:43:39*vendethiel quit (Ping timeout: 256 seconds)
17:45:54*yglukhov___ joined #nim
17:48:59dom96someplace: Please report it on Github
17:49:51someplacesure
17:50:42*gokr_ joined #nim
17:51:03*gyeates joined #nim
18:04:10*filcuc joined #nim
18:12:58dalarmmstCan I do something similar to this in nim? return rexW ? (ext ? R8 : RAX) : (ext ? R8D : EAX)
18:13:15*filcuc quit (Quit: Konversation terminated!)
18:17:36def-dalarmmst: that's not very good style I'd say, but you can do: return if rexW: (if ext: R8 else: RAX) else: (if ext: R8D else: EAX)
18:18:08def-ifs can be used as expressions in Nim
18:18:19*grncdr joined #nim
18:19:04dalarmmstdef-: Thanks
18:19:28dalarmmstWhat would be a better style you think?
18:19:42def-want to post your full proc somewhere?
18:22:05*grncdr quit (Client Quit)
18:22:32dalarmmstdef-: http://pastebin.com/eV21VPcH I haven't written a proc yet, trying to convert my original C++ method
18:24:54*jryan joined #nim
18:25:29jryanHey guys. I'm trying to cross compile to windows from linux using mingw-w64 on arch linux.
18:25:41jryanAnd getting nimcache/system.o:system.c:(.text+0x1971b): undefined reference to `memcpy'
18:25:42*nande joined #nim
18:25:51jryanAnything jump out at anyone?
18:26:02def-jryan: can you cross compile C code?
18:26:10def-if that works, Nim should also work
18:27:23*dalarmmst quit (Ping timeout: 250 seconds)
18:27:49kokozedmanhey guys, I'm trying to use a C libraries that use ... as parameter; is it possible to use it in nim with c2nim? if so, then how do I do it?
18:27:58def-kokozedman: {.varargs.}
18:28:11kokozedmanoh ok... didn't know about that
18:28:14kokozedmanthanks def-
18:28:29def-http://nim-lang.org/manual.html#varargs-pragma
18:29:12jryandef-: Yes I can
18:29:44def-jryan: you can use --verbosity:3 --parallelBuild:1 to see the exact gcc commands used
18:29:48def-maybe you'll notice what's wrong
18:30:00*filcuc joined #nim
18:30:13jryandef-: Yeah I did that, and I didn't see anything weird during the linking step.
18:30:34def-so you can use memcpy in C programs linked with the same command?
18:30:40def-maybe the include is missing?
18:31:12*gyeates quit (Ping timeout: 265 seconds)
18:31:34jryandef-: https://gist.github.com/jjryan/99a98d18b4222769a396
18:31:41jryanIs what it's outputting as the linker command.
18:32:23def-looks pretty normal
18:32:30def-but then I never cross-compiled for Windows
18:33:39*koalazen joined #nim
18:33:41*vendethiel joined #nim
18:34:07jryanSeems to be acting differently now.
18:34:13jryanNot sure why... /usr/bin/x86_64-w64-mingw32-ld: cannot find -ldl
18:34:18koalazenHi, where am I supposed to add tests for a change in the standard library ? In my case it's math.nim
18:35:17def-koalazen: maybe tests/floats or tests/stdlib/tmath.nim
18:35:55*grncdr joined #nim
18:36:28def-jryan: you do set --os:windows, right?
18:36:32*nande quit (Remote host closed the connection)
18:36:50*fizzbooze joined #nim
18:37:19jryandef-: nim c -d:windows --cpu:amd64 --verbosity:3 --parallelBuild:1 frontcut.nim
18:37:46def-that should be --os:windows
18:38:02koalazenthanks def-
18:38:06jryansorry that was an old command def-
18:38:12jryannim c --os:windows --cpu:amd64 --verbosity:3 --parallelBuild:1 frontcut.nim
18:38:22kokozedmanwhat's the Nim way of using the offsetof () C macro to get the offset of an object member? I suppose Nim object types are converted to struct in C... I'm trying to use a third-party C library that takes the offset of a struct member
18:39:42*dalarmmst joined #nim
18:39:50*Demon_Fox joined #nim
18:39:58def-dalarmmst: hm, don't see a better way to do that
18:40:15def-dalarmmst: except if you fill them into a table maybe
18:40:21*OnO quit (Quit: Textual IRC Client: www.textualapp.com)
18:40:36dalarmmstdef-: Ok, thanks for looking at it, and thanks for the nim help
18:44:23def-kokozedman: you want to use the macro or reimplement it in Nim?
18:44:49kokozedmandef-, just the macro if I can... whichever is "efficient"
18:45:26kokozedmanor, whichever works with the 3rd party lib
18:46:22*filcuc quit (Quit: Konversation terminated!)
18:46:31*flaviu quit (Remote host closed the connection)
18:47:15*Mat4 joined #nim
18:47:21Mat4hello
18:48:04*nande joined #nim
18:53:29def-kokozedman: does this work? https://gist.github.com/def-/2ed28c3be686fb02fa2d
18:53:47*loz1 joined #nim
18:56:03kokozedmandef-, man! that looks really nice! Can't test right now because I'm just writing a bunch of wrapper, but I think it should be already. Thanks for sharing :)
18:56:19*filcuc joined #nim
18:56:56*vendethiel quit (Ping timeout: 276 seconds)
19:00:16jryandef-: If I compile them all using gcc, and have gcc link it for me, it works.
19:00:39jryanSo no -c just *.c and -o
19:00:49def-jryan: so if you do it by hand it's fine? but when nim calls the same commands it doesn't work?
19:02:11*grncdr quit (Quit: Leaving.)
19:04:36RegisterOnnim has a problem
19:04:55RegisterOnit's a little bit too awesome
19:05:17*grncdr joined #nim
19:05:34def-dalarmmst: i'm curious, what are you working on?
19:09:28*koalazen quit (Ping timeout: 246 seconds)
19:12:28*filcuc quit (Remote host closed the connection)
19:15:30*ingsoc quit (Quit: Leaving.)
19:19:08*kokozedman left #nim ("Leaving")
19:22:18jryandef-: When I do it by hand it works yes. But I don't manually call the linker, I have gcc do that for me.
19:22:24jryandef-: Which is why it's working
19:22:34jryanJust tested the exe and it works too.
19:22:52def-jryan: then I guess it would help to find out how gcc calls the linker and tell nim the same
19:23:12def-wait, shouldn't gcc use gcc as the linker?
19:23:13jryanYeah. I don't really know how to figure how what the heck it's doing.
19:23:14*filcuc joined #nim
19:23:31def-the linkerexe should be gcc, not gcc-ld
19:23:35jryandef-: oh really
19:23:37def-yes
19:23:49def-see in config/nim.cfg
19:24:03def-under "example of how to setup a cross-compiler"
19:24:11jryanoh my god i'm dumb
19:24:28jryanI should of copy pasted I guess hahah
19:24:32jryaninstead of guessing
19:24:47jryanthat totally fixes it
19:24:50def-great
19:25:18jryanI haven't been in C land for a long time, so I was confused why vanilla LD wasn't working. Makes sense now.
19:25:34jryanThere's tons of default crap being passed through there.
19:28:38jryandef-: thank you very much
19:28:42*skyfex_ quit (Quit: (null))
19:30:15*skyfex__ joined #nim
19:33:10*Mat4 is now known as Mat4-coding
19:33:59*vikaton quit ()
19:36:17*jryan quit (Quit: Page closed)
19:37:02*fizzbooze quit (Ping timeout: 252 seconds)
19:38:32*skyfex__ quit (Ping timeout: 256 seconds)
19:46:36*vikaton joined #nim
19:46:37Xaseronmy parallel build fails. is my code wrong or did i found a bug? https://paste.xinu.at/Sds/nimrod
19:48:30*Jesin quit (Quit: Leaving)
19:49:02RegisterOnXaseron: it fails in what way?
19:50:00Xaseron/home/xaseron/nim/qsort/nimcache/qsort.c:264:36: error: ‘HEX3Atmp_146207Len0’ undeclared (first use in this function)
19:50:02Xaseron quicksort_146085(HEX3Atmp_146207, HEX3Atmp_146207Len0, HEX3Atmp_146210, HEX3Atmp_146213);
19:50:18Xaserongcc 4.9.2
19:54:34*xificurC quit (Remote host closed the connection)
19:54:47*MyMind quit (Ping timeout: 246 seconds)
19:55:09*xificurC joined #nim
19:56:43*ingsoc joined #nim
19:57:15RegisterOnXaseron: same under clang. The second-last line is the problem, compiles without it
19:57:46*Jesin joined #nim
19:57:58def-Xaseron: we have a few bug reports that have very similar sounding errors
19:58:19def-it works with seq instead of openarray
19:59:04def-for example this one: https://github.com/Araq/Nim/issues/1834
19:59:17RegisterOnyeah, changing to seq works
19:59:29def-I guess you should report it
19:59:38RegisterOnindex error at runtime, but compiles
19:59:50def-for me it runs fine
19:59:55*OnO joined #nim
20:00:21RegisterOndef-: clang?
20:00:24def-gcc
20:00:31RegisterOnweird
20:00:36def-clang fine to
20:00:40def-too*
20:00:42RegisterOnall i did was take his code and change to seq
20:00:47RegisterOnanything else?
20:01:03def-i changed both instances of openarray to seq
20:03:26*vendethiel joined #nim
20:03:37Xaseronworks for me with gcc and clang
20:04:19*Matthias247 joined #nim
20:04:20RegisterOnwell, probably because i'm on 0.10.2 because brew isn't updated
20:04:36def-Right, 0.10.2 is probably broken
20:04:47RegisterOnnope, it works some of time
20:04:51RegisterOnsome race condition?
20:05:02RegisterOnrun it lots of times, breaks some of the time
20:05:12RegisterOnError: unhandled exception: index out of bounds [IndexError]
20:05:14RegisterOn@[-31, 0, 2, 2, 4, 65, 83, 99, 782]
20:05:29*fizzbooze joined #nim
20:05:55RegisterOnseems completely random
20:06:23RegisterOnSIGBUS: Illegal storage access. (Try to compile with -d:useSysAssert -d:useGcAssert for details.)
20:06:26RegisterOnsome of time...
20:09:48loz1hi guys, i'm trying to swap two ref's, and i think this doesn't work:
20:09:48loz1let tmp = field
20:09:48loz1field = field2
20:09:51loz1field2 = tmp
20:09:59loz1am i right?
20:10:31RegisterOnXaseron: does it fail sometimes if you run many times quickly?
20:11:01XaseronRegisterOn: nope
20:11:11RegisterOnweird
20:11:35Xaseronhmm
20:11:45RegisterOnmaybe if you increase the array size so it gets more work
20:11:50RegisterOnseems like a race somewhere
20:11:52Xaseronsorting 1000 elements takes forever in the debug build
20:12:22BlaXpiritloz1, u can probably use `swap field, field2`
20:12:49BlaXpiritbut your code should work too
20:12:52def-loz1: swap their contents? then swap field[], field2[]
20:13:04BlaXpiritright..
20:13:20XaseronRegisterOn: looks like a deadlock to me
20:13:21loz1def-: good question, the type of field is Field which is ref FieldObj
20:13:40loz1def-: and i want to swap pointers
20:13:40def-loz1: if you swap them like that, you just swap their addresses, not the contents
20:13:47def-oh, then that should be fine
20:13:59*gokr_ quit (Ping timeout: 245 seconds)
20:13:59loz1how can i print the addresses?
20:14:06BlaXpiritmaybe repr
20:14:13BlaXpiritnot sure though
20:14:24BlaXpiritwhere's Mimbus? :(
20:14:46def-cast[ByteAddress](field) if repr doesn'T like it
20:15:11XaseronRegisterOn: SIGSEGV: Illegal storage access. (Attempt to read from nil?)
20:15:41RegisterOnright
20:15:59RegisterOnparallel seems rather buggy
20:16:15Xaseronqsort: ../nptl/pthread_mutex_lock.c:81: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
20:16:17XaseronSIGABRT: Abnormal termination.
20:16:21BlaXpiritD:
20:16:30RegisterOnand IndexError from time to time
20:16:37RegisterOnall sorts of random failures
20:16:53*gokr_ joined #nim
20:17:02def-RegisterOn: you really shouldn't test with 0.10.2, it's known to be buggy
20:17:15def-Xaseron: what system are you on, I can't reproduce any crashes
20:17:31RegisterOndef-: brew has 0.10.2 so that's what I am using
20:17:56Xaseronarch linux or what do you mean by system?
20:18:08def-Xaseron: hm, but it seems to deadlock
20:18:21RegisterOnXaseron: i'm on OSX
20:18:34RegisterOndef-: ^
20:18:50def-I have to say i've never used parallel stuff in Nim
20:19:17RegisterOnit's the first thing that meet users on the home page, so it better work :)
20:19:32Xaseron^^
20:19:58*fizzbooze quit (Ping timeout: 272 seconds)
20:20:04def-I agree, no idea why it's there
20:20:35RegisterOnconcurrency tends to be a study in why it doesn't work, and Nim is no different :) I just spawn tons of processes and communicate via queues, Erlang style
20:20:49RegisterOnchicken-shit approach, but boy, does it always work
20:20:50*HakanD joined #nim
20:22:24loz1oh ok, if i remove parallel stuff everything works
20:22:33*loz1 sad
20:25:26*vendethiel quit (Ping timeout: 252 seconds)
20:25:35def-Xaseron: I guess a bug report would be good
20:25:43dalarmmstdef-: I'm building a disassembler just for fun
20:26:02def-dalarmmst: that sounds fun!
20:26:46Xaseroneven if i limit the thread pool size to 1 it deadlocks
20:27:14Xaserondef-: about the parallel deadlock or the compile error with openarray?
20:27:15dalarmmstdef-: Yeah it is :) I'm working as a compiler engineer so it helps me in my work as well
20:27:17Xaseronor both?
20:27:27def-Xaseron: both of course
20:28:40RegisterOn"both, please" increases the chance of it actually getting done
20:34:02*Jesin quit (Quit: Leaving)
20:46:01*rgv151 quit (Remote host closed the connection)
20:53:13*elbow_jason quit (Read error: Connection reset by peer)
20:53:23*elbow_jason joined #nim
21:01:21*pregressive quit (Remote host closed the connection)
21:09:01OnOAraq: sorry, but we need some quick fixup for csources submodule: https://github.com/Araq/Nim/pull/2675
21:11:24*ingsoc quit (Quit: Leaving.)
21:17:17*Jesin joined #nim
21:18:43*Kingsquee joined #nim
21:20:24*Mat4-coding left #nim ("http://quassel-irc.org - Chat comfortably. Anywhere.")
21:20:39*fizzbooze joined #nim
21:21:29*gokr_ quit (Ping timeout: 245 seconds)
21:25:19*gokr_ joined #nim
21:25:48*gsingh93 quit (Quit: WeeChat 1.1.1)
21:37:45*gyeates joined #nim
21:42:21*pregressive joined #nim
21:42:21*pregressive quit (Remote host closed the connection)
21:43:03*pregressive joined #nim
21:43:50*yglukhov___ quit (Quit: Be back later ...)
21:44:00*Trustable quit (Remote host closed the connection)
21:44:13*fizzbooze quit (Ping timeout: 255 seconds)
21:47:37*Mat4-coding joined #nim
21:47:44*Mat4-coding left #nim ("http://quassel-irc.org - Chat comfortably. Anywhere.")
21:47:52*coffeepot joined #nim
21:49:40*gyeates quit (Ping timeout: 256 seconds)
21:51:17*loz1 quit (Ping timeout: 256 seconds)
21:52:58reactormonkOnO, I just hope it works
21:53:23OnOtest, see for youself
21:53:48OnOthnx
21:55:48OnOstill would be nice to have *.o ignored in csources repo
21:55:53OnO*.obj too
21:56:34OnOsee https://github.com/nim-lang/csources/pull/16
21:56:53OnOotherwise after build csources are shown by Git as dirty
21:58:30gokrdef-: Don't we consider the lambda syntax in future to "be lambdas"?
22:00:08def-gokr: i'm not sure about terminology. i guess all anonymous procs are lambdas, but I expect them to be a bit nicer than they currently are in Nim to use them
22:00:24gokrBut you tried the ones in future, right?
22:00:48gokrThe new restriction that all params must be typed does make them slightly verbose again though.
22:02:32def-and that they don't always work
22:03:09Jehan_I'd honestly consider making them part of the compiler proper rather than macros.
22:03:14reactormonklambdas are procs with {.closure.} or {.procvar.} from what I understand
22:03:20*vendethiel joined #nim
22:04:06def-gokr: https://github.com/Araq/Nim/issues/2179
22:04:19Jehan_reactormonk: They're just syntactic sugar for the proc(...): auto = ... notation.
22:04:44gokrdef-: But... doesn't that already work?
22:04:55def-gokr: I wish
22:05:37gokrI think I did several lambdas like that in this article: http://goran.krampe.se/2014/12/03/nim-seq/
22:05:39def-we're rather going in the opposite direction, argument types are now mandatory
22:05:51gokryes, that is a bit annoying I agree.
22:07:34gokrThis works just fine: echo(@[1,2,3].map((x:int) => x * 2))
22:08:09gokrSo I am unsure what 2179 means.
22:08:40def-it means I'd prefer @[1,2,3].map(x => x*2)
22:09:10gokrSo x instead of (x:int) ?
22:09:15Jehan_I haven't looked at it, but type inference can become a bit tricky when you omit arguments. Especially when you have overloading or subtyping.
22:09:22def-yes, and no return type and for it to work more consistently
22:09:36gokrdef-: I didn't use a return type
22:09:42Jehan_def-: Last I tried, you could omit the return type?
22:09:49def-gokr: not in this case, but in some it fails to compile
22:10:08gokrI agree that it seems to be a bit... varying.
22:10:17gokrI think my comments in my article also notes this.
22:10:22Jehan_I have to admit that I don't use the future stuff a whole lot since I consider it unstable (not in the sense of it breaking, but there being no guarantee that it'll remain part of the language).
22:11:37gokrI think getting lambdas working is an important part. And... I can buy that Araq wanted to get rid of the untyped parameters in general since people thought it was type inferencing - when in fact it was generics.
22:11:58gokrBut for lambdas, it would be nice to get it working without types.
22:12:23def-hat we have all these procs ending with It in sequtils shows that lambdas don't work that well yet
22:12:43gokrdef-: I think its fairly old code though.
22:12:58gokrAnd they aren't procs are they?
22:13:15gokrThey are templates.
22:13:30Jehan_def-: The advantage of mapIt() and such is that they provide better performance.
22:14:04gokrRight
22:14:34Jehan_You could get the same performance out of lambdas, but that would require the compiler to do the necessary inlining analysis.
22:15:51Jehan_Which is not entirely trivial and part of the reason why Scala's for statement tends to have poor performance.
22:17:33Jehan_(Scala's for is basically syntactic sugar for a composition of foreach, map, flatMap, and filter operations working on lambdas.)
22:17:36gokrAt least the precedence of => is tweaked now so that you can avoid the ( ) around the body.
22:18:24Jehan_That means even for (i <- 1 to 100) {s += a(i)} turns the `s += a(i)` part into a closure that the JVM then has to worry about inlining.
22:19:56def-gokr: Ah, here was the example which I tried with lambdas instead of *It: https://github.com/Araq/Nim/pull/2175
22:20:05def-and you needed the return type there
22:23:43*pregressive quit ()
22:25:43reactormonkanyone know where the compiler resolves symbols?
22:25:51*vendethiel quit (Ping timeout: 256 seconds)
22:27:59gokrdef-: I seemed to get away without return types in that code.
22:28:13gokrThis works: us.filter((x:User) => x.active).sortedByIt(it.id).map((x:User) => x.lastName)
22:28:25gokrBut there is no sortedBy :)
22:29:30def-it's just called sorted now
22:29:48gokrEhm... no...
22:29:53gokrThat takes a compare proc
22:30:19gokrI was thinking something like sortedBy((x:User) => x.id)
22:33:06fowlreactormonk: sem*
22:33:26*vikaton quit (Quit: Connection closed for inactivity)
22:33:56*dtscode quit (Remote host closed the connection)
22:40:46*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:42:37sickdoes anyone know why spawn keeps complaining about the passed in proc not returning a value?
22:43:13*filcuc quit (Quit: Konversation terminated!)
22:45:05sickusing the example in the guide (http://nim-lang.org/docs/manual.html#parallel-spawn-spawn-statement), gives me this error: spawn.nim(8, 20) Error: expression 'processLine(x)' has no type (or is ambiguous)
22:45:25sickno clue what to do :(
22:45:59ldleworksick: don't worry someone will know what the problem is
22:47:33reactormonkfowl, ok
22:47:47reactormonkfowl, I'm looking for global variables.
22:49:27*grncdr quit (Quit: Leaving.)
22:52:05Jehan_An alternative way to do filter and map with macros: https://gist.github.com/rbehrends/c7127c8e61344bb1dadc
22:52:42def-Jehan_: nice
22:52:43Jehan_Wondering if this can be regularized without having all the boilerplate all the time.
22:53:46reactormonkJehan_, neat. do you get useful error messages?
22:54:14reactormonkwith types etc.
22:54:17*OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…)
22:54:42Jehan_reactormonk: No idea. Just a quick hack.
22:55:05Jehan_Macro-related error messages can be anywhere from very good to "what the hell does that mean"?
22:55:20Jehan_Unavoidably, really, since the error reporting mechanism has only so much context to work with.
22:56:57*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
23:02:02*saml_ joined #nim
23:02:12*aboisvert quit (Quit: aboisvert)
23:09:32*Jehan_ quit (Quit: Leaving)
23:14:37*vendethiel joined #nim
23:18:47*HakanD quit (Quit: Be back later ...)
23:19:35*Matthias247 quit (Read error: Connection reset by peer)
23:21:27reactormonkfowl,
23:21:30reactormonkehh
23:21:41reactormonksemVarOrLet is executed once per var/let statement group?
23:22:46fowlI'm not a good person to ask about the compiler >.>
23:23:21reactormonk>:)
23:24:11reactormonkI'm still chasing my double-global bug... suggestionResultHook_335823: ["sfExported", "sfGlobal"], [], ["compiler/suggest.nim", 32, 2], skVar and suggestionResultHook_456030: ["sfExported", "sfGlobal"], [], ["compiler/suggest.nim", 32, 2], skVar
23:24:14reactormonkshould be the same
23:24:48reactormonkone of them gets added to the sigmatch module... *scratches head*
23:24:57reactormonkI don't even mention that one in that module
23:30:14reactormonk-.-
23:30:23reactormonkthere's an include somewhere in the compiler that screwed me up.
23:35:02reactormonkI guess I should read some more... # included from sigmatch.nim
23:35:59*BlaXpirit_ joined #nim
23:35:59*BlaXpirit is now known as Guest66546
23:35:59*Guest66546 quit (Killed (orwell.freenode.net (Nickname regained by services)))
23:35:59*BlaXpirit_ is now known as BlaXpirit
23:37:10*vendethiel quit (Ping timeout: 255 seconds)
23:37:11*Siecje joined #nim
23:37:15*Siecje quit (Max SendQ exceeded)
23:38:04*Siecje joined #nim
23:38:29*Siecje quit (Max SendQ exceeded)
23:39:14filwitgokr: any thoughts on how I should modify 'marshal' to have hooks? Marshal doesn't quite work for me, so instead of just remaking it I'll contribute back, but I've barely used these things in other languages, so I don't know 'best practice' here. My idea is to have basically this syntax: foo.serialize(shallow=false, hooks={"int":handleInt, "string":handleString})
23:39:19*Siecje joined #nim
23:40:23filwitwhere 'handleInt' is a `proc(i:int): string`, etc
23:40:51filwiterr, make that `proc handleInt(i:int): JObject`
23:41:03filwitanyone have opinions?
23:41:10gokrI have only skimmed that code
23:42:29filwitokay, it just sounded like you where familiar with other serialization libs, and you might have specific ideas on how best to improve the API
23:42:58fowlDoes marshal even work with variant objects
23:43:25filwitidk..
23:43:31*sick quit (Ping timeout: 246 seconds)
23:43:41filwitbut I don't need it for variant objects right now, so not going to worry about that
23:44:53reactormonkpigmej, ok, got epc running with nim. Wanna hook it into nim-mode?
23:45:45filwitfowl: wait, i misunderstood what you meant by that.. I'm not sure how marshal handles case-objects.. one sec, let me test
23:45:56filwitcause I do want to support those
23:49:18filwitfowl: yeah it handles variant objects fine
23:51:33fowlAh ok