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:31 | Xe | is there a way to set the contents of language pragmas at runtime? |
01:55:35 | Xe | specifically 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:02 | fowl | Xe those funcs are available in dynlib |
02:02:24 | Xe | ah cool |
02:03:02 | fowl | Araq has some late-loading mechanism used for opengl extension loading |
02:03:30 | fowl | Its near the top of opengl.nim |
02:04:34 | Xe | aha |
02:04:47 | Xe | so I would cast the resulting call to the type of function I expect |
02:05:04 | fowl | Xe maybe if you have a macro that converts proc x(...) Into var x: proc... And load/reload it later |
02:05:22 | Xe | Hmm |
02:05:45 | Xe | do I need to keep a handle to the .so open for the function to keep working? |
02:05:56 | Xe | imported function* |
02:06:20 | fowl | You 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:26 | fowl | Xe I think the DL has to stay open otherwise the symbols in it won't exist |
02:13:06 | * | Jesin joined #nim |
02:15:01 | Xe | add5Func = cast[proc (a: int) int {.cdecl.}](lib1.symAddr("add5")) |
02:15:05 | Xe | seems to fail compilation with |
02:15:21 | Xe | type mismatch: got (proc (a: int){.closure.}) but expected 'proc (a: int): int{.closure.}' |
02:15:29 | Xe | or did I miss a colon |
02:15:59 | fowl | It means add5func is a closure (bare proc type is closure) |
02:17:32 | Xe | ah |
02:19:06 | fowl | Er |
02:19:22 | fowl | No you did miss a colon |
02:19:46 | Xe | https://gist.github.com/Xe/3e3d18cef5602036660e |
02:19:55 | Xe | yeah I did |
02:20:29 | Xe | it's now failing with a different compile reason |
02:20:44 | fowl | You're importing a closure function on purpose? |
02:21:09 | Xe | I'm trying to import a function from a C .so |
02:21:26 | Xe | it's defined as a nim function though |
02:21:39 | Xe | https://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:53 | Xe | this gets built as https://github.com/Xe/nim-shared-object-example/blob/master/Makefile#L2 |
02:23:28 | fowl | Change those closure pragmas to nimcall |
02:24:39 | Xe | ah |
02:24:41 | Xe | okay |
02:24:43 | Xe | Yes that works now |
02:24:45 | Xe | thank you so much fowl |
02:25:26 | fowl | no prob |
02:29:00 | Xe | fowl: is there a way to make nim quietly compile? |
02:31:50 | saml_ | aporia cannot find NimSuggest in PATH |
02:36:48 | fowl | Xe, try verbosity:0 |
02:37:10 | fowl | saml_, are you on windows |
02:37:19 | saml_ | no, linux |
02:37:36 | saml_ | looks like compiler/nimsuggest doesn't get built |
02:37:49 | saml_ | using devel branch of Araq/Nim |
02:37:55 | onionhammer | wish it was built as part of nims install, but it isnt |
02:38:51 | saml_ | so i built it manually . now aporia finds it. but Go To definitnio segfaults |
02:42:03 | Xe | okay so as far as I've gathered |
02:42:08 | Xe | options before filenames with nim c |
02:49:48 | fowl | --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:00 | rgv151_ | is there a way to make macro return value? |
07:16:34 | ldlework | rgv151_: macros have to return ast, that's the point |
07:19:49 | rgv151_ | 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:21 | fowl | neat https://github.com/MasonMcGill/numerics |
07:58:28 | dtscode | neater http://eleks.github.io/js2js/#features |
07:58:52 | ldlework | lol |
07:59:15 | * | bjz joined #nim |
08:00:07 | ldlework | dtscode: https://github.com/jterrace/js.js/ |
08:00:54 | * | Triplefox quit (Remote host closed the connection) |
08:01:07 | dtscode | i love everyhing about this |
08:01:26 | * | Triplefox joined #nim |
08:01:28 | * | Trustable joined #nim |
08:01:37 | ldlework | oh my god all I want to do is go to sleep |
08:01:44 | ldlework | whhyyyy saltstack. whyyyyyyyy |
08:02:08 | dtscode | i want to sleep but compilers :/ |
08:03:08 | r-ku | who happens to know how to check if type is ref type (in macros)? |
08:03:41 | * | bjz quit (Client Quit) |
08:05:39 | filwit | r-ku: if T is ref: ... |
08:05:50 | filwit | r-ku: oh, macros, sorry |
08:05:57 | filwit | r-ku: use 'getType()' |
08:06:02 | filwit | in macros |
08:06:23 | * | JinShil quit (Quit: Konversation terminated!) |
08:06:34 | r-ku | and check returned NimNode == nnkRefTy? |
08:06:43 | someplace | what's argv in nim? |
08:07:00 | filwit | r-ku: yes, basically. |
08:07:03 | r-ku | thanks |
08:07:59 | yglukhov__ | someplace: os.commandLineParams |
08:08:07 | someplace | cheers |
08:08:45 | filwit | r-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:53 | r-ku | hmm somehow i cant pull it off. i get type identifier from AST, i suppose thats not what getType really wants |
08:11:08 | filwit | r-ku: if you gist an example of what you're going for I can help you future. |
08:11:14 | filwit | further* |
08:11:45 | r-ku | https://gist.github.com/r-ku/79454071e33c89ed3485 |
08:12:16 | r-ku | im exploring Jehans named constructor idea by rewriting proc to allocate and initialize type. saves one keyword |
08:12:21 | filwit | r-ku: you need to pass by 'typed' i think. getType doesn't work with 'untyped' |
08:13:07 | r-ku | still getting "node has no type" |
08:13:29 | filwit | r-ku: k one sec. |
08:14:56 | * | Jehan_ joined #nim |
08:15:18 | filwit | r-ku: i'm not even seeing getType() here, but maybe I'm just tired? |
08:15:40 | r-ku | https://gist.github.com/r-ku/79454071e33c89ed3485#file-gistfile1-nim-L14 |
08:15:54 | filwit | r-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:06 | Jehan_ | Umm. what's the matter? |
08:16:31 | r-ku | im exploring your named constructors idea by rewriting proc instead of having make "keyword" |
08:16:45 | r-ku | just cant figure out how to check if type is ref or not inside a macro |
08:16:47 | ldlework | that's crazy that you can reimplement proc |
08:16:49 | fowl | Gettype(n).typekind== ntyRef |
08:17:55 | Jehan_ | I'm not sure if you can if it's an immediate macro. |
08:18:23 | fowl | I was about to say that - it can't run on a proc macro like that |
08:18:33 | filwit | r-ku: here's how I do this: use a template + 'when T is ref' and call a macro based on that |
08:18:41 | fowl | The proc is passed before it is instantiated |
08:18:55 | r-ku | oh thats a good idea filwit, its probably most appropriate way |
08:18:55 | Jehan_ | 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:17 | fowl | 5 examples of macroshttps://gist.github.com/fowlmouth/3c74409c30533bb0a5b4 |
08:19:25 | Jehan_ | filwit: You'd have to embed that in the macro output. |
08:19:27 | fowl | Macros.Gettype * |
08:20:09 | fowl | Gn |
08:20:43 | filwit | Jehan_: 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:54 | r-ku | hey 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:56 | Jehan_ | macro output = the code that the macro returns. |
08:21:39 | * | yglukhov___ joined #nim |
08:21:40 | filwit | oh, i see, cause you're using this as a {.pragma.} macro |
08:21:53 | r-ku | yup, cause i want to rewrite proc itself |
08:23:06 | filwit | r-ku: what I do is have an 'impl' macro which accepts a type and a body of procs |
08:23:08 | filwit | impl Foo: |
08:23:19 | filwit | proc init = echo me.name |
08:23:22 | filwit | type of thing |
08:23:25 | gokr | fowl: So... getType gives you the type of something in the AST, so its after semantic analysis? |
08:23:30 | r-ku | but its terribly ugly |
08:23:43 | gokr | Oh, he went to bed |
08:23:46 | fowl | Yea gokr |
08:23:54 | gokr | Now... |
08:23:58 | fowl | Irc from bed ;) |
08:24:10 | gokr | fowl: So if we want to go even further... |
08:24:11 | filwit | r-ku: i actually really like it for many other reasons, but what you're going for might be impossible ATM |
08:24:44 | r-ku | well 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:49 | gokr | fowl: 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:25 | fowl | gokr: in the current scope |
08:25:46 | gokr | fowl: Right, so any thoughts on having macros that can operate even later in the compilation process? |
08:25:47 | filwit | r-ku: let me try something real quick and get back to you |
08:25:59 | r-ku | thanks for help |
08:26:30 | fowl | gokr: sure lots of times I'm using macros to build some compile time state and another macro that acts on it later |
08:27:11 | gokr | Just curious on what the "next step" is in this field. |
08:27:47 | fowl | Remind me tomorrow I'll make an example |
08:28:01 | gokr | fowl: Sure, cool stuff |
08:28:30 | gokr | I 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:47 | ekarlso | any cool things lately in nim ? |
08:38:29 | filwit | r-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:25 | filwit | r-ku: it's unfortunate really. You could do it like this: proc init {.ctor:Foo.} = ... |
08:39:36 | r-ku | im 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:17 | gokr | ekarlso: Did you see nimpdf? |
08:40:32 | ekarlso | gokr: nope :p |
08:41:00 | gokr | https://github.com/jangko/nimpdf |
08:41:03 | gokr | Quite impressive |
08:41:16 | filwit | r-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:38 | ekarlso | gokr: meh, I would like to see more network / services libraries in nim |
08:41:46 | ekarlso | like http stuff, protobuf etc |
08:41:59 | r-ku | filwit: its pretty much what i got now, or close to it |
08:42:03 | filwit | r-ku: you could make a {.ctor.} macro which basically just turns 'proc init(f:var Foo)' into 'proc init(f:typedesc[Foo])' |
08:42:11 | r-ku | init(T: type Foo, ...) |
08:42:25 | gokr | ekarlso: That doesn't make nimpdf less cool ;) |
08:42:26 | ekarlso | gokr: it's where stufl ike Go has gotten tons of attention ;p |
08:42:33 | r-ku | type Foo same as typedesc[Foo]? |
08:42:38 | filwit | yes |
08:42:48 | r-ku | yeah so thats what i got |
08:43:04 | r-ku | but i wanted basically to define single constructor that later worked for (ref Foo) too |
08:43:19 | gokr | ekarlso: Sure |
08:44:21 | * | Demon_Fox quit (Quit: Leaving) |
08:44:49 | r-ku | i be damned, it can be pulled off by doing so: proc init[T: Foo|(ref Foo)](self: var T) {.ctor.} = |
08:45:31 | filwit | r-ku: the problem is ref-types need to be allocated |
08:45:50 | r-ku | for some reason Foo() work in both cases somehow |
08:45:57 | filwit | though technically you could just make the 'ctor' macro inject 'self = T()' as the first line |
08:46:08 | r-ku | ah wait not in both heh |
08:46:20 | r-ku | yes thats what im doing already too |
08:46:52 | filwit | well then that should work, since Nim's default constructors allocate ref types |
08:47:03 | r-ku | actually non-ref type misbehaves, field does not get set |
08:47:20 | * | Trustable quit (Remote host closed the connection) |
08:47:20 | filwit | though the real solution here is build this pattern into Nim like I was planning on doing.. |
08:47:32 | filwit | r-ku: ah.. right |
08:47:47 | r-ku | this is what i got so far if interested https://gist.github.com/r-ku/79454071e33c89ed3485 |
08:47:59 | * | Trustable joined #nim |
08:48:12 | fowl | We have constructors that you manually write already. In the std lib they start with init or new |
08:48:41 | filwit | those are not constructors |
08:48:42 | * | Trustable quit (Remote host closed the connection) |
08:48:51 | filwit | those are allocators |
08:49:02 | fowl | Heh oh |
08:49:22 | fowl | And 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:04 | r-ku | fowl: those constructors are abomination |
08:50:26 | filwit | fowl: i don't see an 'init' in system, where are you finding this? |
08:50:45 | r-ku | filwit: i believe initTable() has that |
08:50:53 | * | Trustable joined #nim |
08:50:55 | fowl | I said "start with" |
08:51:03 | filwit | ah, okay |
08:51:47 | fowl | Ref-agnostic "allocator" is possible |
08:52:10 | filwit | there 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:29 | Jehan_ | What's a "real constructor pattern"? |
08:53:36 | r-ku | filwit: 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:30 | filwit | actually 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:48 | gokr | Jehan_: 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:18 | Jehan_ | gokr: It was basically an adaptation of Eiffel's constructors. |
08:56:05 | gokr | Jehan_: 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:45 | Jehan_ | gokr: I'm personally fine with `newT` and `initT` myself. |
08:56:48 | filwit | Jehan_: 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:37 | Jehan_ | filwit: Yes, and I think the issues are imaginary. |
08:58:10 | gokr | Personally 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:46 | gokr | filwit: I would actually like to see such a list of issues in more detail. |
08:59:10 | filwit | Jehan_: 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:32 | Jehan_ | The primary issue seems to be that Nim has a different look and feel from C++/C#/Java. |
09:00:01 | filwit | no that's not the issue at all, at least, not any issue I was ever talking about |
09:00:41 | r-ku | my 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:48 | Jehan_ | 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:05 | r-ku | now what Jehan_'s named constructors fix is Type.<ide here can return list of constructors> |
09:01:13 | r-ku | this makes things cleaner A LOT |
09:01:17 | Jehan_ | r-ku: Those are features, not bugs. |
09:01:31 | r-ku | feature to make as much mess as one wants? |
09:01:34 | Jehan_ | You do not want to have constructors tied to types. That's a leaky abstraction. |
09:01:49 | filwit | gokr: 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:53 | r-ku | i have no idea what that means Jehan_ |
09:02:09 | gokr | r-ku: In Smallltalk which has "named constructors" there is no mess. |
09:02:16 | r-ku | but if you want two types use same constructor - just make overload and call other ctor |
09:02:28 | Jehan_ | It means that you cannot have new T() return an instance of U, for example, where U is a different type. |
09:03:06 | r-ku | i do not understand why one would call "new T()" if he wants U, then call "new U()" |
09:03:11 | Jehan_ | This can occur, for example, if you change the implementation of T and U is a proper subtype of T. |
09:03:11 | filwit | but you use named constructors for those, because they're not 'constructors' but 'factories' |
09:03:28 | Jehan_ | r-ku: Because of information hiding. |
09:03:31 | gokr | In 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:51 | Jehan_ | filwit: Yes, and once you've made something a "constructor", you cannot change that without breaking the API. |
09:04:11 | r-ku | Jehan_: didnt you mean U being proper supertype of T? |
09:04:37 | r-ku | actually sorry |
09:04:39 | Jehan_ | r-ku: No, I meant subtype. A specialized implementation of T. |
09:04:40 | r-ku | my logic got messed |
09:04:45 | r-ku | indeed |
09:05:06 | Jehan_ | filwit: Most people in favor of constructors are talking aesthetics. I'm talking about the software engineering aspect. |
09:05:15 | r-ku | but this very well reminds me c++ implementation hiding with virtual header stuff |
09:05:27 | r-ku | does this even apply in nim? |
09:06:05 | gokr | Nim 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:33 | filwit | Jehan_: 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:00 | Jehan_ | 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:15 | gokr | I just ask people that haven't used a lang with named constructors - to not just say "its a mess". Because its not. |
09:07:21 | filwit | Jehan_: and I was never really talking about the aesthetics. Personally I was always happy with Type.new(...) overloading |
09:07:31 | Jehan_ | filwit: I'm not changing the parameters or the result type of the proc in my example. |
09:07:45 | filwit | but then it's an invalid comparison? |
09:07:45 | Jehan_ | filwit: Type.new has the exact same problem. |
09:08:05 | Jehan_ | filwit: No, because I'm not using constructors. You are. |
09:08:12 | Jehan_ | Hence my API doesn't break and yours does. |
09:09:09 | filwit | I 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:45 | Jehan_ | filwit: No. |
09:10:11 | Jehan_ | I can write makeMeATLikeThing and have it return an instance of either T or U. |
09:10:56 | Jehan_ | When you write `new T`, you're stuck with an actual instance of T. |
09:11:07 | Jehan_ | Because new T hardcodes the allocation of an instance of T. |
09:11:34 | Jehan_ | This is also why C++ has all these other hacks like placement new. |
09:12:03 | gokr | One 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:12 | filwit | yeah 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:07 | ldlework | gokr: why would I ever need to do that in Nim? |
09:13:08 | Jehan_ | filwit: Constructing an object isn't hard. |
09:13:25 | gokr | ldlework: Find instantiation sites? |
09:13:38 | filwit | Jehan_: i agree, but it could be improved. That's my point. |
09:13:42 | ldlework | or all instances of a class or any other craziness you just mentioned |
09:14:02 | gokr | ldlework: Are you serious? |
09:14:14 | ldlework | gokr: I've been writing code for a long time |
09:14:25 | ldlework | I simply have never needed to do either of those things |
09:14:31 | ldlework | I'm asking you why you would |
09:14:37 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:14:46 | Jehan_ | ldlework: Debugging? |
09:15:00 | gokr | There are tons of reasons. But if you haven't used advanced IDEs on a very large codebase - then fine. |
09:15:01 | Jehan_ | ldlework: Right now I'm trying to hunt down a bug in the GC. |
09:15:05 | ldlework | Jehan_: tools do that, so okay maybe gokr is writing a debugger? |
09:15:11 | filwit | Jehan_: 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:29 | ldlework | gokr: are you writing an IDE/debugger? |
09:15:45 | Jehan_ | 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:46 | ldlework | gokr: you said it was 'very important' but that seems more like 'extremely narrow' |
09:15:54 | ldlework | I was just thrown off |
09:15:56 | gokr | ldlework: No, its not narrow |
09:16:05 | ldlework | gokr: what other usecases are there for that? |
09:16:10 | r-ku | ehm 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:30 | gokr | ldlework: There are literally tons of reasons for me to want to find all places a specific class is instantiated or otherwise used. |
09:16:42 | ldlework | I'm asking what some of them are. |
09:16:56 | Jehan_ | filwit: Not sure I understand what you mean there? |
09:17:10 | gokr | Ok, so let's say I want to change class X, I want to find all its usages. |
09:17:12 | Jehan_ | If it's about exposing the type without the constructor, yeah, that's in need of a clean-up. |
09:17:23 | ldlework | gokr: we already covered "features of your ide so it can refactor for you" |
09:17:28 | gokr | Or 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:39 | ldlework | gokr: okay so "IDE refactor features" |
09:17:47 | gokr | ldlework: The whole Smalltalk env is written in itself. |
09:17:54 | ldlework | gokr: okay? |
09:18:31 | gokr | ldlework: You lost me. Let me go back a few steps here |
09:18:43 | ldlework | gokr: you said this was 'very important' |
09:18:58 | gokr | I am talking about the ability for tools/compilers to find all instantiation sites. |
09:18:59 | ldlework | but it doesn't seem very important outside of 'ide reflection features' |
09:19:08 | ldlework | gotcha |
09:19:17 | gokr | And tools can't do that easily unless there is something to go on. |
09:19:24 | ldlework | Yeah. That's been established. |
09:19:28 | gokr | Right now we don't have constructors. |
09:19:31 | ldlework | I guess that's the opposite of narrow to you. |
09:19:32 | gokr | We have procs. |
09:19:59 | gokr | So in Nim - if I want to see all places where we instantiate class X - what do I do? |
09:20:07 | gokr | Or rather, what does the tool do? |
09:20:15 | ldlework | I understand, what you want, and what you need. |
09:20:30 | ldlework | I 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:37 | ldlework | I hope you can understand my small momentary confusion |
09:20:51 | ldlework | And that it is not about what features are needed to implement IDE features. |
09:20:53 | gokr | ldlework: I am trying to understand it - but ... I am slightly perplexed. |
09:21:04 | Varriount | gokr: Look at every possible code path that calls a procedure that instantiates or creates a new instance of type X? |
09:21:11 | filwit | Jehan_: 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:11 | filwit | constructor syntax that is basically useless for anything more complex than a Vector type. |
09:21:23 | ldlework | gokr: K |
09:21:30 | gokr | Varriount: Yeah, basically. |
09:21:45 | gokr | In Smalltalk we use a lot of cross referencing tools. |
09:21:46 | Jehan_ | gokr: Good programming style should have all constructors for a type embedded in a module that declares that type. |
09:21:49 | Varriount | gokr: Which isn't an easy task. |
09:21:58 | gokr | Its very common to pull up a browser on all methods that reference class X. |
09:21:59 | filwit | basically useless.. **right now** |
09:22:16 | Jehan_ | This generally makes it easy to find them without tools. |
09:22:20 | gokr | Jehan_: Yes, but that module has lots of procs. |
09:22:49 | gokr | Then ldlework asked why on earth I would want to find all instantiation sites. |
09:23:05 | Jehan_ | 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:16 | ldlework | gokr: *other than implementing an ide feature* |
09:23:22 | gokr | I presume anyone who have used say Eclipse in a large Java codebase - have often pulled up "all references to class X" |
09:23:36 | gokr | Which is slightly wider net of course. |
09:23:45 | Jehan_ | gokr: You have the same problem with a class that implements tons of constructors. |
09:23:59 | gokr | But in Eclipse one can also show all calls to a specific constructor. |
09:24:04 | filwit | Jehan_: it's not just about aesthetic appeal, it's about extending what people will gravitate towards (because of aesthetics) to be better |
09:24:05 | gokr | Jehan_: Yes. |
09:24:45 | gokr | But 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:54 | Jehan_ | gokr: Here's a question: Is diagonalMatrix(n: float) = identityMatrix() * n a constructor? |
09:25:11 | Jehan_ | I.e. if a constructor is implemented purely in terms of another constructor, is it still a constructor? |
09:25:47 | gokr | Jehan_: 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:22 | gokr | ldlework: Haven't you ever done a "show me all places where this constructor is called" in say Eclipse? |
09:26:29 | Jehan_ | gokr: It's more that, for example, a purely functional language cannot really have constructors in the OO sense. |
09:26:32 | RegisterOn | http://forum.nim-lang.org/t/703/2 |
09:26:56 | Jehan_ | You instantiate all variables at once because they can't be mutated later on. |
09:27:22 | Jehan_ | Advanced "constructors" then have to call upon the basic data constructors. |
09:27:54 | ldlework | gokr: 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:25 | ldlework | I agree that reflection is both awesome and useful for ide features. No disagreement at all. |
09:28:35 | Jehan_ | Anyhow, I have to tune out for now (work and finding the GC bug). |
09:29:04 | gokr | ldlework: Btw, I didn't say "all instances of a class" - I said instantiation sites. All instances is something else. |
09:29:34 | ldlework | gokr: which smalltalk must also do |
09:29:38 | ldlework | since it can reload instances |
09:29:42 | ldlework | (which is crazy) |
09:29:48 | Jehan_ | gokr: Eh, that's easy. All calls of T(...) and all new(x) calls where x is of type T. |
09:29:55 | gokr | ldlework: yes, but I wasn't talking about that. And no, its not crazy. |
09:30:01 | Jehan_ | Anyhow, gotta go. |
09:30:05 | * | Jehan_ quit (Quit: Leaving) |
09:30:08 | ldlework | gokr: crazy like a fox |
09:30:13 | ldlework | (ie, crazy awesome) |
09:30:20 | gokr | ldlework: ah |
09:30:38 | gokr | ldlework: But I am actually trying to answer you. Let me reread what you wrote above |
09:31:12 | ldlework | gokr: 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:21 | ldlework | I was like "what could you possibly use that for" |
09:31:49 | ldlework | you 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:06 | gokr | Ok, so I use it all the time in Smalltalk - because in a large codebase I need to find all these places. |
09:32:20 | ldlework | Yeah but you don't use that as a way to implement features in your program |
09:32:22 | ldlework | That's what I meant |
09:32:43 | gokr | Eh... no? Did I ever claim that? |
09:32:45 | ldlework | You don't use those features to implement normal applications, usually, unless that application is some ide tool |
09:32:58 | ldlework | gokr: nope, you didn't. You said it was 'very important' |
09:33:02 | gokr | I just said I want my tools to be able to do it. |
09:33:16 | ldlework | And *I* wondered how it could be important, like, from a day to day persepective |
09:33:24 | gokr | And they can't do it if the procs are "just like all other procs" |
09:33:40 | ldlework | I know! but you'll just have to trust me, because I'm gonna stop saying it now. |
09:33:59 | ldlework | gokr: pharo seriously needs just a basic updated walkthrough |
09:34:24 | gokr | I said "One very important thing you often do in Smalltalk - is to find all instantiations of a class" |
09:34:30 | ldlework | Like no one has to update the whole by example book, just a new tiny little beginner's article |
09:34:39 | gokr | Ok, so you thought I was describing "code" that does that. |
09:34:50 | ldlework | gokr: yes, I interpreted that to mean "this is something you literally d oall the time while writing smalltalk applications" |
09:35:02 | ldlework | rather than "this is an important feature of smalltalk to support is many awesome ide features" |
09:35:22 | gokr | But 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:29 | ldlework | haha yes |
09:35:32 | * | filwit quit (Quit: Leaving) |
09:35:33 | ldlework | that's what I get you to mean now |
09:36:05 | gokr | "while writing" - yes. "in code" - no. |
09:36:32 | gokr | ldlework: Did you try the "PharoTutorial go" |
09:36:39 | ldlework | yeah but it was too tedious |
09:36:51 | ldlework | pharo is very click, type, click type |
09:36:57 | ldlework | and omg, I hate clicking |
09:37:00 | ldlework | and using the arrow keys |
09:37:02 | ldlework | :( |
09:37:14 | gokr | I 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:19 | ldlework | haha |
09:37:33 | * | filwit joined #nim |
09:37:58 | ldlework | gokr: 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:59 | gokr | Btw, there are different Smalltalks - GNU Smalltalk is more Vim style. |
09:38:14 | ldlework | or something similar to that anyway |
09:38:16 | gokr | But why a command line repl? |
09:38:21 | ldlework | so I can interact with it |
09:38:27 | gokr | You can type and run code everywhere in Pharo. |
09:38:28 | ldlework | I mean, a full editor would be cool too |
09:38:34 | ldlework | I know, but it sucks, as an editor |
09:38:42 | fowl | Lol |
09:38:42 | gokr | Literally *any* place you can type code - you can run it. |
09:38:47 | ldlework | I know |
09:38:56 | ldlework | but as an interface for editing text, its really horrible |
09:39:07 | gokr | So you think a REPL is better? |
09:39:10 | ldlework | trust me, I'm amazed by the actual environment |
09:39:14 | ldlework | gokr: if it has readline? yes. |
09:39:34 | gokr | I never understood why people love typing in line by line in a single window that echoes something back. |
09:39:43 | ldlework | gokr: well, emacs integration would be ideal |
09:39:51 | ldlework | I just figured repl wasn't asking for too much |
09:40:00 | ldlework | like, I underbid, by saying repl |
09:40:18 | ldlework | anything that is decent at editing text, unlike pharo |
09:40:20 | gokr | When 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:24 | filwit | ldlework: https://www.youtube.com/watch?v=db-7J5OaSag |
09:40:30 | fowl | ldlework: pharo included sdl2 so I bet it uses opengl (whether its exposed for you or not, idk) |
09:40:37 | ldlework | gokr: all that stuff is nice assuming you can /type text/ |
09:40:45 | ldlework | gokr: hehe, I'm only half teasing though |
09:40:48 | ldlework | it was kind of painful |
09:40:49 | * | antranigv1 joined #nim |
09:41:04 | ldlework | filwit: heh nice |
09:41:09 | gokr | ldlework: There is some Emacs/Vim thingymabob to give those key bindings |
09:41:24 | ldlework | gokr: oh that would be wonderful |
09:41:29 | gokr | fowl: Pharo can do OpenGL in many ways |
09:41:43 | filwit | ldlework: 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:55 | ldlework | filwit: if I could get this with multiplayer, my life would be complete |
09:41:59 | ldlework | I yearn for the metaverse so bad |
09:42:09 | ldlework | and I don't mean secondlife, I just mean empty room that we can both script at the same time |
09:42:16 | filwit | watching yoru program come to live before your eyes in VR would be absolutely awesome though |
09:42:17 | ldlework | seriously, I would never leave there. |
09:42:23 | ldlework | filwit: agreed |
09:42:27 | filwit | lol, true |
09:42:33 | ldlework | I would make little artificial life experiments |
09:42:37 | ldlework | and give them names... |
09:42:49 | ldlework | I'm squeeee'ing so hard at the thought |
09:42:49 | gokr | filwit: That looks similar to what we can do in our system. |
09:42:55 | filwit | the only problem is Oculus doesn't have enough resolution to make coding in it comfortable |
09:43:07 | filwit | gokr: yeah i was just thinking that |
09:43:21 | r-ku | im nearly done with my macro, check it out here: http://forum.nim-lang.org/t/1190/2#7420 |
09:43:26 | fowl | Haha that video. "I'm in three dimensions, I need a two dimensional space to work on though" |
09:44:19 | filwit | fowl: 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:28 | Varriount | https://www.youtube.com/watch?v=VzFpg271sm8 |
09:45:19 | antranigv1 | anyone thought of nim for pedagogical use? |
09:45:42 | antranigv1 | for 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:09 | gokr | Here 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:26 | r-ku | antranigv1: i bet it could replace pascal, but python is still easier |
09:46:44 | ldlework | gokr: the probelm I have with systems like these, is that they are optimized to simulate offices and avatars and such |
09:46:55 | antranigv | as a replacement for pascal, I'd love to see Oberon in schools |
09:47:02 | r-ku | tbh pascal in schools is terrible terrible decision, better teach them language that is actually useful in industry nowdays |
09:47:04 | antranigv | nim and oberon are similar in very ways. |
09:47:11 | Varriount | r-ku, antranigv: Nim still has some really pointy bits that stick out and trip you up. |
09:47:15 | gokr | ldlework: Our system is not "optimized" for that. |
09:47:44 | antranigv | no, I disagree. pascal is very goo, they (the kids) should know what is programming, not what is pascal (a language) |
09:47:46 | fowl | Oberon and pascal? Where do you go to school that teaches those |
09:47:59 | antranigv | I learned pascal in school in Syria |
09:48:01 | gokr | ldlework: Its in fact a generic synchronized object memory - that models a 3D space. |
09:48:24 | ldlework | yes and then there is a ton of stuff built ontop of that foundation right? |
09:48:27 | antranigv | oberon was a relpacement, no nothing changed, cz of the war |
09:48:31 | ldlework | that costs cycles and memory? |
09:49:08 | gokr | ldlework: Well... cycles and memory... not sure what you mean. |
09:49:11 | ldlework | gokr: can I run your thing easily, without any assumptions? multiplayer black programming void? |
09:49:41 | ldlework | or do I need a landscape and an avatar and so on |
09:50:08 | filwit | actually 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:33 | ldlework | gokr: woah lorenz attractor demo is kind of exactly what I'm imagining |
09:50:54 | gokr | ldlework: 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:19 | gokr | Croquet was built as a generic platform for shared 3D worlds, in whatever shapes and forms. |
09:51:26 | ldlework | gokr: 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:46 | ldlework | to me, this is what the word 'metaverse' means |
09:51:49 | ldlework | not these virtual offices |
09:51:57 | fowl | I too am interested in multiplayer smalltall |
09:52:02 | gokr | ldlework: In our product we don't expose that. Croquet however does, and we build on the same codebase. |
09:52:24 | ldlework | gokr: 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:03 | rgv151_ | 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:01 | Senketsu | umm 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:30 | Senketsu | actually 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:52 | someplace | http://hastebin.com/hoqaqajoye.avrasm <- any idea how I'd debug this? |
11:56:02 | someplace | using the nim-lang/irc module |
11:58:16 | * | Jehan_ joined #nim |
12:01:50 | * | saml_ joined #nim |
12:05:52 | Senketsu | someplace, 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:45 | someplace | hm. |
12:10:14 | def- | Looks more like a GC bug to me |
12:10:22 | def- | maybe there's an existing Issue about it |
12:10:22 | someplace | I 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:24 | someplace | hm |
12:10:32 | someplace | I'll dig around |
12:11:55 | Jehan_ | 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:00 | Jehan_ | Not sure if it's related. |
12:12:05 | someplace | https://github.com/Araq/Nim/issues/2650 < same lib, no GC in backtrace though |
12:12:34 | Jehan_ | GC in backtrace often shows up as a side effect of memory corruption. |
12:12:54 | someplace | that's fun |
12:12:56 | Jehan_ | For example, if you do a copyMem() that's overwriting stuff, then you will probably wreck reference counts. |
12:13:19 | Jehan_ | But that's why you want to be careful with the low-level primitives. |
12:14:27 | someplace | it only happened once, overnight, hasn't happened again yet |
12:21:12 | * | kokozedman joined #nim |
12:22:29 | kokozedman | hey 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:17 | def- | mips.linux.gcc.cpp.exe maybe |
12:30:28 | kokozedman | def-, yeah, that worked... thanks |
12:32:04 | Jehan_ | def-: I've found the bug (I think). |
12:32:21 | def- | Jehan_: great |
12:32:46 | Jehan_ | Basically, jmp_buf may not always be word-aligned. |
12:32:53 | drewsrem | It 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:02 | Jehan_ | In which case scanning the registers will not find the pointers therein. |
12:33:21 | Jehan_ | It can also with --opt:size result in no addresses on the stack being found at all. |
12:34:12 | def- | Weird that this didn't pop up before |
12:34:40 | * | Kingsquee quit (Quit: Konversation terminated!) |
12:36:17 | filwit | r-ku: replied to your forum post |
12:40:12 | Jehan_ | def-: It is pretty rare. It becomes fairly reproducible with --opt:size on OS X. |
12:40:29 | Jehan_ | But on OS X, clang is the default, which doesn't do what gcc does. |
12:40:46 | Jehan_ | Basically, sizeof(jmp_buf) == 0x94 on OS X. |
12:41:16 | Jehan_ | clang still aligns it properly; gcc can sometimes put it at an address that isn't word-aligned. |
12:42:46 | Jehan_ | 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:21 | Jehan_ | 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:35 | def- | Hm, sounds bad |
12:53:55 | Senketsu | hmm only impure libs cause the seqfaults on import .. weird |
12:54:43 | * | JinShil quit (Quit: Konversation terminated!) |
12:56:20 | gyeates | so is nimble the successor of babel? |
12:56:31 | gokr | yup |
13:02:54 | BlaXpirit | s/the successor of// |
13:03:14 | BlaXpirit | just a rename |
13:03:25 | * | vikaton quit (Quit: Connection closed for inactivity) |
13:03:49 | drewsrem | In 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:12 | cryzed | probably BNF? |
13:05:53 | drewsrem | I don't think so |
13:06:24 | drewsrem | But I guess it's a mixture |
13:09:44 | drewsrem | There's stuff like ^* ^+ e.g.: exprList = expr ^+ comma |
13:16:56 | drewsrem | Ahhh stupid me, it's right in the beginning of the manual |
13:19:50 | Jehan_ | 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:51 | someplace | oh |
13:42:57 | someplace | re: that crash I found this in the compile low |
13:42:59 | someplace | log, even |
13:43:01 | someplace | lib/nim/pure/asyncdispatch.nim(1196, 8) Warning: 'cb' is not GC-safe as it accesses |
13:43:03 | someplace | 'nameIterVar' which is a global using GC'ed memory |
13:43:08 | someplace | is that known? an issue? |
13:44:17 | fowl | A warning |
13:45:56 | someplace | this is re: a gc crash with asyncdispatch in the traceback |
13:46:15 | Xe | How do you define a c struct in nim? |
13:46:29 | Xe | is it just an object with a cexport pragma? |
13:46:54 | someplace | you probably want the packed pragma too |
13:47:03 | fowl | To export it yea |
13:47:57 | fowl | Packed just adds __attribute(packed) |
13:48:23 | Xe | do you know of a code sample? |
13:49:03 | fowl | Xe: its 'exportc' are you having trouble? |
13:49:35 | Xe | I'm not quite sure I understand how to make a structure-like thing in nim |
13:49:51 | fowl | Type x {.exportc.} = object .. |
13:51:23 | Xe | does the type have to be exported for the exportc pragma to work? |
13:51:28 | Xe | er |
13:51:37 | Xe | type X* vs type X |
13:55:30 | fowl | aha unless you use the type it doesnt show up |
13:55:55 | fowl | and when it does show up, its in the module's .c, not some .h where it would be usable |
13:57:42 | Xe | hmm |
14:04:37 | * | darkf quit (Quit: Leaving) |
14:04:56 | * | TEttinger quit (Ping timeout: 244 seconds) |
14:09:21 | Xe | bah |
14:09:23 | Xe | wifi |
14:10:17 | Xe | http://ix.io/ilY -> http://ix.io/im0 |
14:11:00 | * | gyeates quit (Ping timeout: 256 seconds) |
14:12:07 | fowl | Xe, looks like "object" is not a good module name |
14:12:25 | Xe | welp |
14:12:51 | fowl | i believe if you tried to import it you would get a syntax error |
14:13:51 | Xe | is there a if __name__ == "__main__" in nim? |
14:14:10 | fowl | there's a special symbol "isMainModule" that is true when the current module is the main module |
14:14:16 | fowl | when isMainModule: |
14:17:03 | kokozedman | c2nim 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:06 | Xe | fowl: so I have an object C exported into a .so file, how can I use it? |
14:22:32 | fowl | Xe, datatypes dont end up in the end product (dll, exe) |
14:23:09 | Xe | hmm |
14:23:25 | fowl | can you move it to a header and importc it instead |
14:23:47 | Xe | can a C struct refer to nim types and vice versa? |
14:24:38 | fowl | c is less useful than nim |
14:25:03 | Xe | I'm more thinking about how I would pass data between loaded libraries |
14:25:04 | fowl | for ex a generic function can't be in the compiled exe |
14:25:19 | Xe | primitives work fine, but I'd like to be able to pass objects around |
14:30:16 | Xe | things 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:14 | sick | Hey all! |
15:48:52 | def- | Hi sick |
15:49:18 | sick | I have a table that contains a seq value (Table[string, seq[string]]), but I cant seem to 'add' to the seq |
15:49:51 | sick | I tried: t["a"] = @[], then t["a"].add "b" |
15:50:05 | sick | but it complains that the seq is not a var type |
15:50:06 | def- | t.mget("a").add("b") |
15:50:13 | sick | ahh |
15:50:35 | sick | that worked! |
15:50:40 | def- | 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:41 | sick | thanks def-!! |
15:51:13 | sick | nice I'll take a look |
15:53:02 | * | vendethiel joined #nim |
15:53:33 | * | aboisvert quit (Quit: aboisvert) |
15:54:28 | def- | 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:08 | sick | Yea just finished reading the PR comments |
15:56:46 | sick | it would certainly look cleaner using [] |
15:57:12 | sick | but I'm pretty impressed with Nim so far :) |
15:57:19 | * | zahary quit (Read error: Connection reset by peer) |
15:57:23 | Varriount|Laptop | Meep |
15:57:35 | Varriount|Laptop | I'm free! All my exams are over! |
15:59:59 | * | Strikecarl joined #nim |
16:00:10 | Strikecarl | Easiest way to clear screen in Nim? without spamming Echo ofcourse. |
16:00:19 | Strikecarl | looking for something like the windows command "cls" |
16:00:32 | def- | Strikecarl: http://nim-lang.org/docs/terminal.html#eraseScreen, |
16:01:24 | * | aboisvert joined #nim |
16:02:27 | Strikecarl | Weird. |
16:03:24 | Varriount|Laptop | Someone needs to create self-aware documentation |
16:06:02 | Strikecarl | "execution of an external program failed" ugh |
16:06:08 | Strikecarl | This basicly sums up my life |
16:06:11 | Strikecarl | theres an erro. |
16:06:15 | Strikecarl | error* |
16:06:16 | def- | --parallelBuild:1 |
16:06:19 | Strikecarl | But it won't tell me what to do. |
16:06:22 | Strikecarl | what does that do? |
16:06:42 | def- | it builds 1 file at a time and outputs errors at compilation |
16:06:49 | Strikecarl | Oh thanks :) |
16:06:54 | Strikecarl | great |
16:06:58 | Strikecarl | didn't do anything |
16:07:00 | def- | but i think you should just compile without "-r" |
16:07:02 | Strikecarl | "Process terminated with exit code 1" |
16:07:12 | def- | and run it by hand afterwards |
16:07:17 | Varriount|Laptop | Strikecarl: What's the console output? |
16:07:20 | Strikecarl | oh wait |
16:07:22 | Varriount|Laptop | Like, all of it. |
16:07:24 | Strikecarl | i am SO FUCKING RETARDED |
16:07:26 | Strikecarl | lmao |
16:07:29 | Strikecarl | I had the program open |
16:07:34 | Varriount|Laptop | -_- |
16:07:34 | Strikecarl | the .exe it was trying to compile... |
16:07:39 | Strikecarl | facedesk... |
16:10:14 | def- | 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:04 | Varriount|Laptop | def-: What kind of variable? |
16:11:08 | def- | a filename |
16:11:14 | def- | I'm doing something really weird |
16:11:24 | Xe | def-: code generation? |
16:11:54 | Varriount|Laptop | def-: Maybe you could use the process running procedures to grab output from the system shell? |
16:12:04 | def- | oh right |
16:12:07 | def- | staticExec |
16:12:12 | def- | thanks! |
16:12:22 | * | bluenote quit (Ping timeout: 246 seconds) |
16:12:28 | Varriount|Laptop | Why does os:standalone not work? |
16:13:26 | def- | no more posix compatibility for the times module |
16:13:28 | def- | (or os module) |
16:13:42 | def- | 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:50 | def- | great, works |
16:18:56 | def- | 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:52 | BlaXpirit | def-, 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:13 | Varriount|Laptop | def-: 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:43 | Varriount|Laptop | def-: 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:19 | Varriount|Laptop | You 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:20 | Jehan_ | 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:37 | Varriount|Laptop | Jehan_: Ah, ok. |
17:11:20 | def- | BlaXpirit: sure i am, but it's fun, so who cares? |
17:12:17 | BlaXpirit | not exactly my definition of fun |
17:18:52 | Jehan_ | 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:44 | someplace | http://hastebin.com/panazapexo.pas <- the crash again, but with useSysAssert and useGcAssert |
17:42:57 | someplace | apparently 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:59 | dom96 | someplace: Please report it on Github |
17:49:51 | someplace | sure |
17:50:42 | * | gokr_ joined #nim |
17:51:03 | * | gyeates joined #nim |
18:04:10 | * | filcuc joined #nim |
18:12:58 | dalarmmst | Can 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:36 | def- | 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:08 | def- | ifs can be used as expressions in Nim |
18:18:19 | * | grncdr joined #nim |
18:19:04 | dalarmmst | def-: Thanks |
18:19:28 | dalarmmst | What would be a better style you think? |
18:19:42 | def- | want to post your full proc somewhere? |
18:22:05 | * | grncdr quit (Client Quit) |
18:22:32 | dalarmmst | def-: 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:29 | jryan | Hey guys. I'm trying to cross compile to windows from linux using mingw-w64 on arch linux. |
18:25:41 | jryan | And getting nimcache/system.o:system.c:(.text+0x1971b): undefined reference to `memcpy' |
18:25:42 | * | nande joined #nim |
18:25:51 | jryan | Anything jump out at anyone? |
18:26:02 | def- | jryan: can you cross compile C code? |
18:26:10 | def- | if that works, Nim should also work |
18:27:23 | * | dalarmmst quit (Ping timeout: 250 seconds) |
18:27:49 | kokozedman | hey 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:58 | def- | kokozedman: {.varargs.} |
18:28:11 | kokozedman | oh ok... didn't know about that |
18:28:14 | kokozedman | thanks def- |
18:28:29 | def- | http://nim-lang.org/manual.html#varargs-pragma |
18:29:12 | jryan | def-: Yes I can |
18:29:44 | def- | jryan: you can use --verbosity:3 --parallelBuild:1 to see the exact gcc commands used |
18:29:48 | def- | maybe you'll notice what's wrong |
18:30:00 | * | filcuc joined #nim |
18:30:13 | jryan | def-: Yeah I did that, and I didn't see anything weird during the linking step. |
18:30:34 | def- | so you can use memcpy in C programs linked with the same command? |
18:30:40 | def- | maybe the include is missing? |
18:31:12 | * | gyeates quit (Ping timeout: 265 seconds) |
18:31:34 | jryan | def-: https://gist.github.com/jjryan/99a98d18b4222769a396 |
18:31:41 | jryan | Is what it's outputting as the linker command. |
18:32:23 | def- | looks pretty normal |
18:32:30 | def- | but then I never cross-compiled for Windows |
18:33:39 | * | koalazen joined #nim |
18:33:41 | * | vendethiel joined #nim |
18:34:07 | jryan | Seems to be acting differently now. |
18:34:13 | jryan | Not sure why... /usr/bin/x86_64-w64-mingw32-ld: cannot find -ldl |
18:34:18 | koalazen | Hi, where am I supposed to add tests for a change in the standard library ? In my case it's math.nim |
18:35:17 | def- | koalazen: maybe tests/floats or tests/stdlib/tmath.nim |
18:35:55 | * | grncdr joined #nim |
18:36:28 | def- | 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:19 | jryan | def-: nim c -d:windows --cpu:amd64 --verbosity:3 --parallelBuild:1 frontcut.nim |
18:37:46 | def- | that should be --os:windows |
18:38:02 | koalazen | thanks def- |
18:38:06 | jryan | sorry that was an old command def- |
18:38:12 | jryan | nim c --os:windows --cpu:amd64 --verbosity:3 --parallelBuild:1 frontcut.nim |
18:38:22 | kokozedman | what'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:58 | def- | dalarmmst: hm, don't see a better way to do that |
18:40:15 | def- | dalarmmst: except if you fill them into a table maybe |
18:40:21 | * | OnO quit (Quit: Textual IRC Client: www.textualapp.com) |
18:40:36 | dalarmmst | def-: Ok, thanks for looking at it, and thanks for the nim help |
18:44:23 | def- | kokozedman: you want to use the macro or reimplement it in Nim? |
18:44:49 | kokozedman | def-, just the macro if I can... whichever is "efficient" |
18:45:26 | kokozedman | or, 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:21 | Mat4 | hello |
18:48:04 | * | nande joined #nim |
18:53:29 | def- | kokozedman: does this work? https://gist.github.com/def-/2ed28c3be686fb02fa2d |
18:53:47 | * | loz1 joined #nim |
18:56:03 | kokozedman | def-, 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:16 | jryan | def-: If I compile them all using gcc, and have gcc link it for me, it works. |
19:00:39 | jryan | So no -c just *.c and -o |
19:00:49 | def- | 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:36 | RegisterOn | nim has a problem |
19:04:55 | RegisterOn | it's a little bit too awesome |
19:05:17 | * | grncdr joined #nim |
19:05:34 | def- | 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:18 | jryan | def-: 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:24 | jryan | def-: Which is why it's working |
19:22:34 | jryan | Just tested the exe and it works too. |
19:22:52 | def- | jryan: then I guess it would help to find out how gcc calls the linker and tell nim the same |
19:23:12 | def- | wait, shouldn't gcc use gcc as the linker? |
19:23:13 | jryan | Yeah. I don't really know how to figure how what the heck it's doing. |
19:23:14 | * | filcuc joined #nim |
19:23:31 | def- | the linkerexe should be gcc, not gcc-ld |
19:23:35 | jryan | def-: oh really |
19:23:37 | def- | yes |
19:23:49 | def- | see in config/nim.cfg |
19:24:03 | def- | under "example of how to setup a cross-compiler" |
19:24:11 | jryan | oh my god i'm dumb |
19:24:28 | jryan | I should of copy pasted I guess hahah |
19:24:32 | jryan | instead of guessing |
19:24:47 | jryan | that totally fixes it |
19:24:50 | def- | great |
19:25:18 | jryan | I 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:34 | jryan | There's tons of default crap being passed through there. |
19:28:38 | jryan | def-: 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:37 | Xaseron | my 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:02 | RegisterOn | Xaseron: it fails in what way? |
19:50:00 | Xaseron | /home/xaseron/nim/qsort/nimcache/qsort.c:264:36: error: ‘HEX3Atmp_146207Len0’ undeclared (first use in this function) |
19:50:02 | Xaseron | quicksort_146085(HEX3Atmp_146207, HEX3Atmp_146207Len0, HEX3Atmp_146210, HEX3Atmp_146213); |
19:50:18 | Xaseron | gcc 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:15 | RegisterOn | Xaseron: same under clang. The second-last line is the problem, compiles without it |
19:57:46 | * | Jesin joined #nim |
19:57:58 | def- | Xaseron: we have a few bug reports that have very similar sounding errors |
19:58:19 | def- | it works with seq instead of openarray |
19:59:04 | def- | for example this one: https://github.com/Araq/Nim/issues/1834 |
19:59:17 | RegisterOn | yeah, changing to seq works |
19:59:29 | def- | I guess you should report it |
19:59:38 | RegisterOn | index error at runtime, but compiles |
19:59:50 | def- | for me it runs fine |
19:59:55 | * | OnO joined #nim |
20:00:21 | RegisterOn | def-: clang? |
20:00:24 | def- | gcc |
20:00:31 | RegisterOn | weird |
20:00:36 | def- | clang fine to |
20:00:40 | def- | too* |
20:00:42 | RegisterOn | all i did was take his code and change to seq |
20:00:47 | RegisterOn | anything else? |
20:01:03 | def- | i changed both instances of openarray to seq |
20:03:26 | * | vendethiel joined #nim |
20:03:37 | Xaseron | works for me with gcc and clang |
20:04:19 | * | Matthias247 joined #nim |
20:04:20 | RegisterOn | well, probably because i'm on 0.10.2 because brew isn't updated |
20:04:36 | def- | Right, 0.10.2 is probably broken |
20:04:47 | RegisterOn | nope, it works some of time |
20:04:51 | RegisterOn | some race condition? |
20:05:02 | RegisterOn | run it lots of times, breaks some of the time |
20:05:12 | RegisterOn | Error: unhandled exception: index out of bounds [IndexError] |
20:05:14 | RegisterOn | @[-31, 0, 2, 2, 4, 65, 83, 99, 782] |
20:05:29 | * | fizzbooze joined #nim |
20:05:55 | RegisterOn | seems completely random |
20:06:23 | RegisterOn | SIGBUS: Illegal storage access. (Try to compile with -d:useSysAssert -d:useGcAssert for details.) |
20:06:26 | RegisterOn | some of time... |
20:09:48 | loz1 | hi guys, i'm trying to swap two ref's, and i think this doesn't work: |
20:09:48 | loz1 | let tmp = field |
20:09:48 | loz1 | field = field2 |
20:09:51 | loz1 | field2 = tmp |
20:09:59 | loz1 | am i right? |
20:10:31 | RegisterOn | Xaseron: does it fail sometimes if you run many times quickly? |
20:11:01 | Xaseron | RegisterOn: nope |
20:11:11 | RegisterOn | weird |
20:11:35 | Xaseron | hmm |
20:11:45 | RegisterOn | maybe if you increase the array size so it gets more work |
20:11:50 | RegisterOn | seems like a race somewhere |
20:11:52 | Xaseron | sorting 1000 elements takes forever in the debug build |
20:12:22 | BlaXpirit | loz1, u can probably use `swap field, field2` |
20:12:49 | BlaXpirit | but your code should work too |
20:12:52 | def- | loz1: swap their contents? then swap field[], field2[] |
20:13:04 | BlaXpirit | right.. |
20:13:20 | Xaseron | RegisterOn: looks like a deadlock to me |
20:13:21 | loz1 | def-: good question, the type of field is Field which is ref FieldObj |
20:13:40 | loz1 | def-: and i want to swap pointers |
20:13:40 | def- | loz1: if you swap them like that, you just swap their addresses, not the contents |
20:13:47 | def- | oh, then that should be fine |
20:13:59 | * | gokr_ quit (Ping timeout: 245 seconds) |
20:13:59 | loz1 | how can i print the addresses? |
20:14:06 | BlaXpirit | maybe repr |
20:14:13 | BlaXpirit | not sure though |
20:14:24 | BlaXpirit | where's Mimbus? :( |
20:14:46 | def- | cast[ByteAddress](field) if repr doesn'T like it |
20:15:11 | Xaseron | RegisterOn: SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
20:15:41 | RegisterOn | right |
20:15:59 | RegisterOn | parallel seems rather buggy |
20:16:15 | Xaseron | qsort: ../nptl/pthread_mutex_lock.c:81: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed. |
20:16:17 | Xaseron | SIGABRT: Abnormal termination. |
20:16:21 | BlaXpirit | D: |
20:16:30 | RegisterOn | and IndexError from time to time |
20:16:37 | RegisterOn | all sorts of random failures |
20:16:53 | * | gokr_ joined #nim |
20:17:02 | def- | RegisterOn: you really shouldn't test with 0.10.2, it's known to be buggy |
20:17:15 | def- | Xaseron: what system are you on, I can't reproduce any crashes |
20:17:31 | RegisterOn | def-: brew has 0.10.2 so that's what I am using |
20:17:56 | Xaseron | arch linux or what do you mean by system? |
20:18:08 | def- | Xaseron: hm, but it seems to deadlock |
20:18:21 | RegisterOn | Xaseron: i'm on OSX |
20:18:34 | RegisterOn | def-: ^ |
20:18:50 | def- | I have to say i've never used parallel stuff in Nim |
20:19:17 | RegisterOn | it's the first thing that meet users on the home page, so it better work :) |
20:19:32 | Xaseron | ^^ |
20:19:58 | * | fizzbooze quit (Ping timeout: 272 seconds) |
20:20:04 | def- | I agree, no idea why it's there |
20:20:35 | RegisterOn | concurrency 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:49 | RegisterOn | chicken-shit approach, but boy, does it always work |
20:20:50 | * | HakanD joined #nim |
20:22:24 | loz1 | oh ok, if i remove parallel stuff everything works |
20:22:33 | * | loz1 sad |
20:25:26 | * | vendethiel quit (Ping timeout: 252 seconds) |
20:25:35 | def- | Xaseron: I guess a bug report would be good |
20:25:43 | dalarmmst | def-: I'm building a disassembler just for fun |
20:26:02 | def- | dalarmmst: that sounds fun! |
20:26:46 | Xaseron | even if i limit the thread pool size to 1 it deadlocks |
20:27:14 | Xaseron | def-: about the parallel deadlock or the compile error with openarray? |
20:27:15 | dalarmmst | def-: Yeah it is :) I'm working as a compiler engineer so it helps me in my work as well |
20:27:17 | Xaseron | or both? |
20:27:27 | def- | Xaseron: both of course |
20:28:40 | RegisterOn | "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:01 | OnO | Araq: 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:58 | reactormonk | OnO, I just hope it works |
21:53:23 | OnO | test, see for youself |
21:53:48 | OnO | thnx |
21:55:48 | OnO | still would be nice to have *.o ignored in csources repo |
21:55:53 | OnO | *.obj too |
21:56:34 | OnO | see https://github.com/nim-lang/csources/pull/16 |
21:56:53 | OnO | otherwise after build csources are shown by Git as dirty |
21:58:30 | gokr | def-: Don't we consider the lambda syntax in future to "be lambdas"? |
22:00:08 | def- | 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:24 | gokr | But you tried the ones in future, right? |
22:00:48 | gokr | The new restriction that all params must be typed does make them slightly verbose again though. |
22:02:32 | def- | and that they don't always work |
22:03:09 | Jehan_ | I'd honestly consider making them part of the compiler proper rather than macros. |
22:03:14 | reactormonk | lambdas are procs with {.closure.} or {.procvar.} from what I understand |
22:03:20 | * | vendethiel joined #nim |
22:04:06 | def- | gokr: https://github.com/Araq/Nim/issues/2179 |
22:04:19 | Jehan_ | reactormonk: They're just syntactic sugar for the proc(...): auto = ... notation. |
22:04:44 | gokr | def-: But... doesn't that already work? |
22:04:55 | def- | gokr: I wish |
22:05:37 | gokr | I think I did several lambdas like that in this article: http://goran.krampe.se/2014/12/03/nim-seq/ |
22:05:39 | def- | we're rather going in the opposite direction, argument types are now mandatory |
22:05:51 | gokr | yes, that is a bit annoying I agree. |
22:07:34 | gokr | This works just fine: echo(@[1,2,3].map((x:int) => x * 2)) |
22:08:09 | gokr | So I am unsure what 2179 means. |
22:08:40 | def- | it means I'd prefer @[1,2,3].map(x => x*2) |
22:09:10 | gokr | So x instead of (x:int) ? |
22:09:15 | Jehan_ | 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:22 | def- | yes, and no return type and for it to work more consistently |
22:09:36 | gokr | def-: I didn't use a return type |
22:09:42 | Jehan_ | def-: Last I tried, you could omit the return type? |
22:09:49 | def- | gokr: not in this case, but in some it fails to compile |
22:10:08 | gokr | I agree that it seems to be a bit... varying. |
22:10:17 | gokr | I think my comments in my article also notes this. |
22:10:22 | Jehan_ | 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:37 | gokr | I 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:58 | gokr | But for lambdas, it would be nice to get it working without types. |
22:12:23 | def- | hat we have all these procs ending with It in sequtils shows that lambdas don't work that well yet |
22:12:43 | gokr | def-: I think its fairly old code though. |
22:12:58 | gokr | And they aren't procs are they? |
22:13:15 | gokr | They are templates. |
22:13:30 | Jehan_ | def-: The advantage of mapIt() and such is that they provide better performance. |
22:14:04 | gokr | Right |
22:14:34 | Jehan_ | You could get the same performance out of lambdas, but that would require the compiler to do the necessary inlining analysis. |
22:15:51 | Jehan_ | Which is not entirely trivial and part of the reason why Scala's for statement tends to have poor performance. |
22:17:33 | Jehan_ | (Scala's for is basically syntactic sugar for a composition of foreach, map, flatMap, and filter operations working on lambdas.) |
22:17:36 | gokr | At least the precedence of => is tweaked now so that you can avoid the ( ) around the body. |
22:18:24 | Jehan_ | 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:56 | def- | gokr: Ah, here was the example which I tried with lambdas instead of *It: https://github.com/Araq/Nim/pull/2175 |
22:20:05 | def- | and you needed the return type there |
22:23:43 | * | pregressive quit () |
22:25:43 | reactormonk | anyone know where the compiler resolves symbols? |
22:25:51 | * | vendethiel quit (Ping timeout: 256 seconds) |
22:27:59 | gokr | def-: I seemed to get away without return types in that code. |
22:28:13 | gokr | This works: us.filter((x:User) => x.active).sortedByIt(it.id).map((x:User) => x.lastName) |
22:28:25 | gokr | But there is no sortedBy :) |
22:29:30 | def- | it's just called sorted now |
22:29:48 | gokr | Ehm... no... |
22:29:53 | gokr | That takes a compare proc |
22:30:19 | gokr | I was thinking something like sortedBy((x:User) => x.id) |
22:33:06 | fowl | reactormonk: 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:37 | sick | does 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:05 | sick | using 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:25 | sick | no clue what to do :( |
22:45:59 | ldlework | sick: don't worry someone will know what the problem is |
22:47:33 | reactormonk | fowl, ok |
22:47:47 | reactormonk | fowl, I'm looking for global variables. |
22:49:27 | * | grncdr quit (Quit: Leaving.) |
22:52:05 | Jehan_ | An alternative way to do filter and map with macros: https://gist.github.com/rbehrends/c7127c8e61344bb1dadc |
22:52:42 | def- | Jehan_: nice |
22:52:43 | Jehan_ | Wondering if this can be regularized without having all the boilerplate all the time. |
22:53:46 | reactormonk | Jehan_, neat. do you get useful error messages? |
22:54:14 | reactormonk | with types etc. |
22:54:17 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
22:54:42 | Jehan_ | reactormonk: No idea. Just a quick hack. |
22:55:05 | Jehan_ | Macro-related error messages can be anywhere from very good to "what the hell does that mean"? |
22:55:20 | Jehan_ | 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:27 | reactormonk | fowl, |
23:21:30 | reactormonk | ehh |
23:21:41 | reactormonk | semVarOrLet is executed once per var/let statement group? |
23:22:46 | fowl | I'm not a good person to ask about the compiler >.> |
23:23:21 | reactormonk | >:) |
23:24:11 | reactormonk | I'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:14 | reactormonk | should be the same |
23:24:48 | reactormonk | one of them gets added to the sigmatch module... *scratches head* |
23:24:57 | reactormonk | I don't even mention that one in that module |
23:30:14 | reactormonk | -.- |
23:30:23 | reactormonk | there's an include somewhere in the compiler that screwed me up. |
23:35:02 | reactormonk | I 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:14 | filwit | gokr: 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:23 | filwit | where 'handleInt' is a `proc(i:int): string`, etc |
23:40:51 | filwit | err, make that `proc handleInt(i:int): JObject` |
23:41:03 | filwit | anyone have opinions? |
23:41:10 | gokr | I have only skimmed that code |
23:42:29 | filwit | okay, 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:58 | fowl | Does marshal even work with variant objects |
23:43:25 | filwit | idk.. |
23:43:31 | * | sick quit (Ping timeout: 246 seconds) |
23:43:41 | filwit | but I don't need it for variant objects right now, so not going to worry about that |
23:44:53 | reactormonk | pigmej, ok, got epc running with nim. Wanna hook it into nim-mode? |
23:45:45 | filwit | fowl: wait, i misunderstood what you meant by that.. I'm not sure how marshal handles case-objects.. one sec, let me test |
23:45:56 | filwit | cause I do want to support those |
23:49:18 | filwit | fowl: yeah it handles variant objects fine |
23:51:33 | fowl | Ah ok |