00:15:24 | * | vendethiel joined #nim |
00:36:33 | * | vendethiel quit (Ping timeout: 240 seconds) |
00:46:28 | * | filwit joined #nim |
00:48:59 | * | gyeates quit (Ping timeout: 245 seconds) |
00:51:33 | * | gsingh93 quit (Ping timeout: 276 seconds) |
00:51:54 | * | xanadulives joined #nim |
00:52:44 | * | vendethiel joined #nim |
00:54:33 | reactormonk | Araq, can't move it over, the type dependencies go haywire. |
00:55:01 | Araq | reactormonk: couse you can, you only need to move the 'var' to there |
00:55:28 | reactormonk | Araq, nope, it depends on the Suggest type, an when I import suggest in msg I get compiler/ast.nim(630, 11) Error: undeclared identifier: 'TLineInfo' |
00:55:58 | reactormonk | ah fuck it, let's move that one over too |
00:56:56 | reactormonk | nope, can't move it over. I need ast.nim because I use TSymKind which requires msg.nim TLineInfo, so the import gets nasty. Wanna go down that route? |
00:57:23 | reactormonk | I don't. |
00:58:39 | Araq | good night |
00:58:43 | reactormonk | kk |
00:58:47 | reactormonk | o/ |
01:00:58 | * | lakurei quit (Quit: lakurei) |
01:03:35 | * | TEttinger joined #nim |
01:12:33 | * | xanadulives quit (Read error: Connection reset by peer) |
01:14:31 | * | vendethiel quit (Ping timeout: 264 seconds) |
01:28:55 | filwit | dom96: you around? |
01:29:57 | filwit | dom96: just wondering if Aporia is deliberately stripping whitespace from blank lines at save for some reason and, if so, why? |
01:36:05 | fowl | That sounds like a great feature |
01:43:32 | filwit | fowl: eh? it's annoying when trying to add a line between indented code and have to re-tab first |
01:44:08 | def- | filwit: that's because there's lots of trailing whitespace in the Nim repo and it's slowly getting removed now |
01:44:17 | def- | I'd guess that it can be disabled in the settings |
01:44:36 | filwit | it's not like it's going to save much HDD space or something by removing the spaces.. I could understand something like intelligently cropping whitespace to surrounding indent levels or something |
01:44:54 | filwit | def-: yeah i see, i'll look for a setting (think i already did, but maybe i missed it) |
01:45:25 | def- | filwit: It's quite annoying for some people. Sometimes I want to append to a line and suddenly I'm at an unexpected position because of trailing whitespace |
01:46:40 | filwit | def-: i can't tell if you mean it's annoying the way Aporia is now, or if it's annoying without it deleting whitespace. |
01:47:04 | def- | it's annoying that there are up to 60 chars of trailing whitespace in some lines |
01:47:20 | filwit | oh yes, i see |
01:47:41 | filwit | but that's easy to strip out.. stripping whitespace from blank lines doesn't make sense IMO |
01:49:21 | * | saml_ joined #nim |
01:50:48 | * | darkf joined #nim |
02:20:31 | * | zzach quit (Ping timeout: 255 seconds) |
02:20:53 | * | zzach joined #nim |
02:27:35 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
02:29:02 | * | BitPuffin|osx quit (Ping timeout: 272 seconds) |
02:29:53 | filwit | does anyone know if/where there's been discussion on seq len/xlen/add recently? I'm wondering why 'len' does nil-checks but not 'add', also I dislike 'xlen'.. it should be 'uncheckedLen' or 'rawLen' or something with an 'uncheckedAdd()' to go with it.. but maybe I'm out of the loop and these things have already been discussed? |
02:35:22 | * | jefus quit (Ping timeout: 255 seconds) |
02:37:58 | def- | filwit: I remember Araq mentioning something about that. I think the plan is to add nil-checked add as well. I guess the x prefix is for convenience, writing "uncheckedLen" is a bit long |
02:38:35 | * | gsingh93 joined #nim |
02:39:08 | fowl | it is planned |
02:39:14 | fowl | maybe safeAdd/add could just be switched |
02:40:00 | filwit | it would make sense to switch those since len now defaults to 'safe' |
02:40:39 | filwit | 'xlen' isn't a huge deal, though I always prefer things be clearly labeled (and just alias them if you use it often |
02:41:03 | filwit | either way, i guess len/xlen and add/xadd would work. thanks for the info |
02:43:48 | * | jefus joined #nim |
02:43:56 | * | ddl_smurf quit (Quit: ddl_smurf) |
03:03:03 | filwit | does anyone know how to iterate over the fields of a type from within a macro? |
03:03:36 | def- | filwit: i'd pass it to a proc and build it there I guess |
03:04:29 | filwit | well unfortunately I am not passing a instance, but the actual Type, eg: `impl Foo: ...` where impl is the macro and 'Foo' is the type |
03:05:18 | filwit | 'getType' and 'fields' only seem to work on instances.. which I really don't want to alloc an instance just to get type field info |
03:05:42 | fowl | filwit, yea |
03:07:05 | fowl | filwit, https://gist.github.com/fowlmouth/3c74409c30533bb0a5b4#file-showty-nim and https://gist.github.com/fowlmouth/9b9010397ad5fe4b9872#file-xeq-nim |
03:08:09 | filwit | awesome fowl, you rock! lots of code there for me to pick through |
03:11:25 | filwit | err, your code doesn't appear to work, fowl |
03:11:27 | filwit | for instance: https://gist.github.com/fowlmouth/3c74409c30533bb0a5b4#file-showty-nim-L125 |
03:11:42 | filwit | when I try to do this, I get "Error: node has no type" |
03:11:56 | fowl | filwit, ah i will update it |
03:12:18 | fowl | filwit, oh if you invoke it from a macro you have to use showtyperec |
03:14:06 | filwit | fowl: i'm not even calling the macro, but that line I linked to doesn't even compile for me |
03:14:39 | filwit | i just copied the first to lines of your 'showType' macro, but it doesn't work |
03:19:28 | * | saml_ quit (Quit: Leaving) |
03:22:01 | fowl | filwit, dunno what to tell you, it works for me |
03:22:07 | fowl | i just updated nim |
03:24:57 | filwit | so did i (0.11.1), odd... |
03:26:02 | filwit | oh pfft.. my mistake |
03:26:15 | filwit | looking at the wrong thing.. sigh.. |
03:26:16 | fowl | it has to be stmt (or "typed" as its called now) |
03:26:45 | fowl | lol |
03:29:54 | reactormonk | anyone know where exported symbols of a module are stored? |
03:29:56 | filwit | fowl: sweet it works! thanks |
03:32:07 | fowl | good |
03:34:02 | filwit | doesn't seem to work in {.immediate.} macros though.. hmmm... |
03:34:29 | filwit | though i suppose i need to figure this out, since that pragma is being depreciated anyways |
03:35:12 | filwit | nevermind, was easy to do (just removed the pragma, and made the 'body' `untyped`) |
03:35:48 | fowl | it wont where there aren't types (immediate macros, untyped (eager) expression) |
03:37:04 | * | gyeates joined #nim |
03:48:25 | * | gsingh93 quit (Ping timeout: 264 seconds) |
04:03:23 | * | vikaton quit (Quit: Connection closed for inactivity) |
04:27:51 | * | NimBot joined #nim |
04:28:50 | * | solidsnack joined #nim |
04:33:08 | reactormonk | Araq, should semIdentDef return the same symbol in case there's two global usages? or shouldn't it be called twice in the first place? |
04:36:08 | * | vendethiel joined #nim |
05:04:47 | * | NimBot joined #nim |
05:05:27 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
05:27:46 | * | gyeates quit (Ping timeout: 272 seconds) |
05:52:55 | * | vendethiel quit (Ping timeout: 264 seconds) |
05:53:40 | * | solidsnack joined #nim |
06:15:03 | * | vendethiel joined #nim |
06:37:26 | * | vendethiel quit (Ping timeout: 272 seconds) |
06:52:11 | * | Trustable joined #nim |
07:06:01 | * | yglukhov_ joined #nim |
07:11:02 | * | yglukhov_ quit (Ping timeout: 246 seconds) |
07:12:48 | * | vendethiel joined #nim |
07:16:00 | * | yglukhov_ joined #nim |
07:16:31 | * | gokr_ joined #nim |
07:23:17 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
07:34:19 | * | vendethiel quit (Ping timeout: 265 seconds) |
07:36:34 | * | OnO joined #nim |
08:22:06 | * | NimBot joined #nim |
08:26:41 | * | bjz joined #nim |
08:26:57 | filwit | "morning" gokr :) |
08:27:09 | gokr | :) |
08:28:33 | gokr | Just verified that the guy helping me with my taxes has gotten more time from the swedish IRS - phew. Otherwise last day today ;) |
08:28:52 | gokr | filwit: So doing anything fun? |
08:29:35 | filwit | hmmm.. not exactly "fun".. working on an event/object-scene system right now |
08:29:52 | * | ddl_smurf joined #nim |
08:30:33 | * | akiradeveloper joined #nim |
08:31:54 | filwit | getting it to load arbitrary Nim types from a file right now (can't use marshal, not enough options), and auto-wire up events/object-links of known "game objects" (those that use my 'impl' macro to declare events). |
08:33:40 | * | JinShil joined #nim |
08:33:48 | filwit | pretty fun actually, i enjoy this kind of thing.. and now that `getType()` actually works with typedesc inside macros (i need to scan the records of the types in order to distinguish references to known game objects) things are going great. |
08:36:39 | filwit | gokr: you? |
08:36:43 | * | bjz quit (Ping timeout: 264 seconds) |
08:37:36 | gokr | Mmmm, we are working on integrating Urh3D in our system. So I have some issues to work on |
08:39:24 | gokr | When you write "load arbitrary Nim types" - you refer to serialization? |
08:39:59 | filwit | yes |
08:40:30 | gokr | So you wrote your own? |
08:40:44 | filwit | well i'm writing that part of it now, yes |
08:42:00 | filwit | i've it working with marshal already, but I need to do some special processing on the instances before storing them (their ref-type records of known "game object" types are treated specially) |
08:46:42 | OnO | oh, good morning everyone |
08:47:48 | filwit | morning |
08:48:00 | * | akiradeveloper quit () |
08:49:17 | * | vendethiel joined #nim |
08:51:40 | filwit | it's pretty great that you can use procs as global variable generators for generic parameter sets... I'm not sure if that's possible in C++ or not, but it's really useful. |
08:52:35 | gokr | I looked at marshal - is that the "only" serialization we have in stdlib? |
08:52:55 | gokr | Just wondering if we have more |
08:53:21 | filwit | well the only one that does all the heavy lifting for you. You can use typeinfo yourself which is easy. |
08:54:49 | filwit | but yeah, marshal should get some updates too.. and I really don't like the `$$` name personally... it's too rare a procedure to justify such a easy-to-miss-cause-it-looks-just-like-$ name. |
08:55:36 | gokr | I read through it - and its easy code. But ... no special hooks or support for migrating stuff. It does handle cycles right? I thought I saw that. |
08:56:14 | filwit | i haven't tested for cycles actually... |
08:56:39 | gokr | It seems to keep track of everything stored - and writes out a pointer int instead if already written. |
08:57:49 | filwit | it does "deep" serialization.. always, which is my problem with it. |
08:58:07 | gokr | Right, no "hooks" |
08:58:23 | gokr | So you can override what to store. |
08:58:44 | filwit | right |
08:59:29 | filwit | i'm not familiar with other serialization libs.. i did a tad of it with C# a few years ago, but I can't remember what features where available |
08:59:42 | filwit | and a little with D too |
09:00:55 | * | bjz joined #nim |
09:03:36 | gokr | Pharo has a very good one these days called Fuel. |
09:04:14 | gokr | I just clicked through the original presentation of it - one thing it does in order to be fast is to cluster instances by type. |
09:05:04 | * | milosn quit (Quit: leaving) |
09:05:54 | filwit | well for my purposes using typeinfo and macros directly works just fine.. it's really pretty easy to serialize Nim objects yourself |
09:06:45 | filwit | i found this out awhile ago and it's really cool: |
09:06:45 | gokr | So you store the actual type too? |
09:06:45 | filwit | proc enabledItems(T:typedesc, eventName:static[string]): var seq[T] = var data {.global.} = newSeq[T](); data |
09:07:14 | filwit | what do you mean by "store the type" ? |
09:07:39 | gokr | I mean... what about objects and inheritance etc? |
09:08:13 | gokr | If you always know the exact type of every field - and don't bother with migration - then sure, no need to store the type. |
09:09:27 | filwit | hmm.. that doesn't help me understand what you're asking really.. i don't know what you mean by "migration" exactly (though I can guess) |
09:09:52 | gokr | Migration as in loading data into a program in which types have changed. |
09:10:06 | gokr | Say objects that now have more or less fields etc |
09:10:41 | filwit | i see, well that's not really applicable to my situation (I don't think) |
09:11:10 | gokr | And if you have an object that has a field of type Fruit - which can ref an Apple or Banana, how do you store it? |
09:11:51 | gokr | I presume you need to store somehow the type of the fruit - or else, how do you know what to create when you load? |
09:12:13 | filwit | basically I'm trying to store a game's "scene", which is just a list of arbitrary Nim types registered as a "game object".. each scene is entirely self-contained (game objects shouldn't ever reference other's outside a given scene, at least not for initialization) |
09:13:19 | * | vendethiel quit (Ping timeout: 264 seconds) |
09:13:31 | filwit | and I load the entire scene at once.. each object instance in the scene has an index, and each object reference to any other game object in that scene will store reference by that index |
09:15:07 | filwit | so the step's I'm planning are: Allocate each instance in scene -> wire together known game-object references by index -> wire events for known game object's (and their known events) -> ready to execute |
09:16:24 | OnO | need help: how do I get T type's name having arg of T : typename |
09:16:30 | filwit | ^ steps for loading from a scene* |
09:16:57 | filwit | OnO: repr(T) |
09:17:58 | OnO | Error: internal error: expr(skType); unknown symbol |
09:18:05 | OnO | type User = object |
09:18:05 | OnO | echo repr(User) |
09:18:17 | BlaXpirit | OnO, so it's a macro? |
09:18:56 | OnO | I have a: template `.`(T: typedesc[Model], f: string): ORMStmt = |
09:19:00 | filwit | OnO: well this works: proc sayName(T:typedesc) = echo repr T |
09:19:03 | OnO | I want turn T into its type name |
09:19:06 | OnO | a string |
09:19:54 | filwit | err.. sorry, you need to make a const equal 'repr(T)' |
09:19:54 | OnO | filwit: hmm... crashes here |
09:19:57 | BlaXpirit | OnO, typetraits.name |
09:20:10 | filwit | OnO: yeah, it's a bug, my bad. Do this instead |
09:20:20 | filwit | proc sayName(T:typedesc) = |
09:20:25 | filwit | const name = repr T |
09:20:28 | filwit | echo name |
09:21:01 | BlaXpirit | does not appear to work either |
09:21:09 | BlaXpirit | typetraits.name just works -_- |
09:21:16 | * | vendethiel joined #nim |
09:21:28 | OnO | yes... typetraits! |
09:21:29 | OnO | thanks |
09:21:36 | filwit | OnO: wtf.. that doesn't seem to work either.. i was just doing this, one sec |
09:23:57 | filwit | but yeah, typetraits is probably best anyways |
09:24:05 | OnO | is there any way to prevent symbol from module to be declared without suffix, I want use typetraits.name but not name |
09:24:22 | OnO | since name collides with mine |
09:24:41 | BlaXpirit | from typetraits import nil |
09:25:24 | BlaXpirit | this is the annoying part about nim. import nil only works well for modules that don't have any classes |
09:25:50 | OnO | BlaXpirit: ok, works, thanks |
09:28:28 | OnO | Araq: did I understood correctly that you are working on making seq[T] concat operation work on compile time? |
09:30:30 | BlaXpirit | but it works normally! |
09:33:20 | OnO | I am sorry, what? |
09:34:11 | * | Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:40:37 | * | RegisterOn joined #nim |
09:40:54 | RegisterOn | sup |
09:41:07 | filwit | hi |
09:46:39 | RegisterOn | is it possible to cross-compile nim programs? e.g. make freebsd binaries from osx or windows? |
09:47:01 | RegisterOn | i understand it's a c++ compiler underneath, so maybe it's just how i pass flags to that? |
09:47:30 | filwit | RegisterOn: http://nim-lang.org/0.11.0/nimc.html#cross-compilation |
09:48:07 | gokr | RegisterOn: Personally I would just use Vagrant or something. |
09:49:57 | filwit | on second thought.. i may just use marshal to do all serialization, then just scan that tree and register known 'game objects' after allocation (to wire state/events and trigger setup) |
09:52:41 | filwit | i think i can do it if I just append a typename to each root instance |
09:53:42 | filwit | er.. duh, that's obviously what marshal was intended for, now that I think about it.. |
09:54:39 | gokr | Its indeed a common pattern - get it into memory first, shape it up. |
09:55:08 | dom96 | filwit: I don't see why removing empty lines of whitespace would be a problem. |
09:55:15 | OnO | RegisterOn: for Linux cross compiling from OSX I use http://crossgcc.rts-software.org/doku.php |
09:55:25 | OnO | also for windows |
09:55:26 | filwit | yeah.. for some reason I was thinking marshal wasn't going to work because it didn't store the names or something.. but I think it does, so I'm not sure where I got that idea |
09:55:39 | gokr | The names of? |
09:56:18 | filwit | dom96: it's only annoying to have to retab to the correct place when trying to add code into the middle of a procedure |
09:56:30 | filwit | which happens a ton, so yeah |
09:57:49 | * | HakanD joined #nim |
09:57:57 | filwit | def mentioned it was to remove excessive whitespace from projects, which is cool, but IMO it should leave empty lines alone. Anyways, I wasn't just trying to complain about something, it's not a huge deal or anything.. i just didn't know if you'd done it intentionally or not. |
09:58:07 | dom96 | I usually just press enter and the next line is at the correct indentation level. |
09:58:30 | dom96 | I think there is an option to disable it though. |
09:59:42 | * | HakanD_ joined #nim |
09:59:46 | filwit | i looked through raw options and didn't see anything, but maybe it was just missing from the existing name (i noticed "scrollPastEnd" was in rawPrefs and not prefs). I'll look through the source code later and find out |
10:03:15 | * | HakanD quit (Ping timeout: 256 seconds) |
10:03:58 | filwit | dom96: any idea what the option would be called? (looking at aporia/cfg.nim right now) |
10:04:55 | dom96 | hrm, I guess there isn't one. Sorry. |
10:05:20 | * | vendethiel quit (Ping timeout: 252 seconds) |
10:05:54 | filwit | no problem, do you know where it's handled in aporia.nim by any chance? I'll look into adding one. |
10:07:55 | * | antranigv joined #nim |
10:13:32 | filwit | nevermind, found it in utils.nim:normalize |
10:15:15 | * | HakanD_ quit (Quit: Be back later ...) |
10:19:51 | antranigv | is there a newsgroup for nim? (: |
10:20:20 | repax | antranigv: There's a forum. |
10:20:23 | repax | http://forum.nim-lang.org/ |
10:21:18 | RegisterOn | thanks, seems like cross-compiling works just fine |
10:22:18 | filwit | dom96: okay, I changed it to keep whitespace of empty lines, but I'll add an option for it before I make a PR... I want to add de-indent on backspace in 2-or-more-whitespace chars too while I'm here |
10:23:09 | filwit | make that `tabcount`-or-more-whitespace chars of course |
10:23:38 | dom96 | antranigv: there is also a mailing list http://nim-lang.org/community.html |
10:24:18 | RegisterOn | any well-known software written in Nim out there? |
10:25:11 | dom96 | filwit: yes, add an option for both. |
10:25:19 | filwit | well known? I don't know of any. But have you seen def-'s NES emulator? it's pretty cool (and runs in the web too) |
10:25:29 | filwit | dom96: k |
10:26:31 | RegisterOn | anyway, well done guys, so far Nim looks really good for systems programming |
10:26:34 | filwit | RegisterOn: plus there's the Urho3D bindings as well, which is pretty cool |
10:26:42 | RegisterOn | i'll check it out |
10:26:56 | dom96 | the nim forum is written in Nim too |
10:27:03 | RegisterOn | nice |
10:28:11 | * | HakanD_ joined #nim |
10:30:07 | * | Ven_ joined #nim |
10:34:23 | * | ingsoc joined #nim |
10:35:53 | * | ingsoc quit (Client Quit) |
10:36:05 | antranigv | nice :) the only reason I like newsgroups more than forums is the web (: so yay for the mailing list |
10:36:16 | * | banister joined #nim |
10:36:47 | RegisterOn | wait... what? |
10:41:36 | antranigv | in short. i love doing everything in alpine (: |
10:42:14 | RegisterOn | hah, just went back to mutt from alpine |
10:51:20 | * | vendethiel joined #nim |
11:02:14 | * | Kingsquee quit (Quit: Konversation terminated!) |
11:06:11 | antranigv | RegisterOn: out of topic. which one do you like better? |
11:10:59 | RegisterOn | antranigv: i like both, but mutt is just more configurable for the things I do, and it's has started to get some serious maintenance love lately, accepting my patches quickly |
11:11:18 | RegisterOn | antranigv: http://dev.mutt.org/hg/mutt/ |
11:11:34 | RegisterOn | that's right, 11 hours ago :) |
11:13:56 | * | vendethiel quit (Ping timeout: 256 seconds) |
11:14:16 | antranigv | o~ nice (: did you write the patch in nim? |
11:14:31 | RegisterOn | heh, alas |
11:29:49 | * | TEttinger quit (Ping timeout: 245 seconds) |
11:40:21 | def- | http://hookrace.net/blog/nim-binary-size/ |
11:40:40 | def- | ^ New article, hope it's fun to read |
11:41:01 | RegisterOn | by you? |
11:41:36 | def- | yes |
11:42:23 | RegisterOn | awesome, i'm going to use Nim in a freestanding kernel project, just the stuff I love reading about :) |
11:44:18 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
11:44:34 | jefus | i've yet to actually dive into nim, but indeed that was a fun and interesting read; thanks def- |
11:47:54 | RegisterOn | are there plans to provide a pure standard networking library (only wrappers now)? |
11:48:10 | * | seymour_ joined #nim |
11:49:34 | dom96 | RegisterOn: have you seen the net module? |
11:50:06 | RegisterOn | dom96: ah, missed that, thanks! |
11:50:36 | * | seymour quit (Ping timeout: 240 seconds) |
11:50:40 | RegisterOn | oh, there's an asyncdispatch/net too |
11:50:41 | RegisterOn | niiiice |
11:54:14 | RegisterOn | ugh, seems like brew only has 0.10.2, i hope this gets updated soon |
11:54:36 | def- | RegisterOn: yes, they have an issue about it I saw yesterday |
11:54:49 | RegisterOn | yeah? |
11:55:00 | def- | https://github.com/Homebrew/homebrew/pull/39272 |
11:55:19 | RegisterOn | aha, thanks! |
11:55:31 | def- | Where they say they want to wait for 0.11.2, which should should be released today if Araq hasn't changed plans |
11:55:55 | RegisterOn | Araq: plan on? :) |
11:58:07 | * | Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:07:28 | * | iamd3vil joined #nim |
12:26:45 | FDGFGFGDFD | http://www.reddit.com/r/programming/comments/34tb7r/nim_binary_size_from_160_kb_to_150_bytes/cqxvm1j |
12:28:52 | Araq | RegisterOn: yes. |
12:34:17 | thotypous | FDGFGFGDFD: nice article :D |
12:35:48 | FDGFGFGDFD | its from def- , i just wrote the stupid comment ;) |
12:39:38 | OnO | Araq: just to ensure that you've said yesterday evening, are you working on compile-time folding (concat) of seq[T]? |
12:39:56 | Araq | OnO: yes but not for 0.11.2 |
12:40:12 | Araq | OnO: try --implicitStatic:on with your code, it might help |
12:40:39 | OnO | okay.... here's my experiment updated: https://gist.github.com/nanoant/ce1428eee5d009fdf3eb |
12:41:05 | r-ku | def-: thats pretty cool article. was interesting read |
12:41:14 | OnO | I am still not sure whether I should use templates or macros for generating SQL + argument variables seq from stmt |
12:41:40 | OnO | templates seem to be more natural, but so far I can't make strings fold this way |
12:42:02 | Araq | you're doing it wrong ;-) |
12:42:03 | ddl_smurf | you probably can't do everything with templates, but what you can you should |
12:42:49 | * | OnwardEuler joined #nim |
12:42:59 | OnO | Araq: tell me more :) |
12:43:38 | Araq | you're building some AST from Nim's AST via templates, that's not necessary, you only need a single toSql macro |
12:43:57 | Araq | or maybe not, but that's what I would try |
12:44:07 | OnO | yes, this is what I was asking :> so I'll try with macros |
12:44:09 | gokr | def-: Fun article |
12:44:13 | Araq | macro toSql(x: untyped) |
12:44:43 | OnO | just one Q everything that comes as "s" to macro(s:stmt) is already pre-optimized? |
12:45:08 | OnO | I mean calling toSql(v == 1 + 1) I will get AST for 1+1 or just 2 |
12:45:09 | OnO | ? |
12:45:31 | Araq | that's what --implicitStatic:on tries to do and what I'm working on |
12:46:19 | Araq | but well for 'untyped' you won't get this |
12:46:33 | Araq | but it's not necessary for this I think |
12:48:04 | * | vikaton joined #nim |
12:48:25 | r-ku | gokr: poke. just so you know.. urhonimo github repo wasnt synced in a month. maybe whenever you are bored and have nothing else to do..? ;) |
12:49:48 | * | kulelu88 joined #nim |
12:51:39 | * | NimBot joined #nim |
12:51:46 | kulelu88 | vikaton: yes. |
12:51:50 | kulelu88 | let me find it for you |
12:51:59 | vikaton | thanks |
12:52:21 | kulelu88 | vikaton: https://github.com/idlewan/nawak |
12:52:23 | RegisterOn | but is it nimble? :D |
12:52:43 | kulelu88 | the guys who work on Nim don't seem to be too eager to make nim a web-ready language |
12:52:58 | kulelu88 | the scope is probably too narrow for just web stuff |
12:53:12 | kulelu88 | so they prefer to stay on a gaming/systems kind of level |
12:53:20 | Araq | IMO def- did destroy the point of web framework benchmarks yesterday night |
12:53:22 | vikaton | o |
12:53:40 | vikaton | Araq, what did he say? |
12:53:43 | OnwardEuler | Araq: how so? |
12:54:29 | kulelu88 | and they may also be shooting themselves in the foot by making Nim web-ready. Python and Ruby are just so much easier to use for web stuff and it kind of seems irrational to choose nim/go/rust for your small webapp |
12:54:48 | * | iamd3vil left #nim ("Leaving") |
12:55:54 | vikaton | I benchmarked Rust vs Crystal yesterday https://gist.github.com/Vikaton/3102c16ee14ef3d76244 |
12:56:01 | vikaton | and I was looking forward for benchmarking Nim |
12:56:24 | vikaton | though maybe I should wait since dom96 informed me that jesters isnt quite optimized yet |
12:56:48 | * | EXetoC joined #nim |
12:57:14 | kulelu88 | vikaton: I think the ideal benchmark would be to handle +1 million requests per second? |
12:57:17 | dom96 | kulelu88: I certainly want to make Nim web ready. |
12:57:43 | vikaton | kulelu88: this is a 512 mb RAM vps, kinda hard to get it to hit 1mil |
12:58:10 | vikaton | though it does show a rough image between the 2 |
12:58:49 | kulelu88 | dom96: even with a genius like yourself behind Jester, the momentum seems to be with Go for fast webapps |
12:58:56 | * | HakanD_ quit (Quit: Be back later ...) |
12:59:08 | dom96 | kulelu88: Hah. I wouldn't consider myself a genius but thank you :) |
12:59:16 | vikaton | I really dont like Go |
12:59:18 | dom96 | I guess the biggest problem is that I have very little time nowadays. |
12:59:32 | kulelu88 | what's Crystal? |
12:59:38 | Araq | he said he got 1-2 requests per second when his article was the top at hacker news and reddit |
12:59:39 | vikaton | I would def go with Crystal rather than Go, think of it as a blazing fast rails app |
13:00:11 | vikaton | kulelu88: compiled Ruby (basically, though not literally) |
13:00:32 | Araq | not 1000 requests per second, not 100, not 10, but perhaps 2. |
13:01:18 | vikaton | Araq, Def-'s website is personal is it not? |
13:01:41 | EXetoC | 2 :p |
13:01:59 | kulelu88 | a game like agar.io in Nim would be the ultimate test to see if it can compete with C++ |
13:02:08 | EXetoC | oh |
13:02:12 | kulelu88 | I've never heard of Crystal before. I know Pypy |
13:02:46 | vikaton | kulelu88: its barely 1 year old |
13:02:47 | pigmej | kulelu88: pypy is 'python' not the same group |
13:03:28 | * | HakanD_ joined #nim |
13:03:29 | vikaton | Crystal/Nim/Rust/C++/C are all in the same window of performance |
13:03:40 | antranigv | I am amazed that github recognizes Nim, but not Oberon-2 :) |
13:03:43 | kulelu88 | pigmej: I know Pypy is python +P I'm just trying to say that I've never heard of compiled Ruby before |
13:04:17 | kulelu88 | at least you guys welcome these discussions. Try asking these questions in Go :D |
13:04:21 | pigmej | kulelu88: pypy is not 'compiled' python |
13:04:26 | thotypous | antranigv: there is a linguist repository for recognizing languages which accepts PRs, so basically it is collaborative |
13:04:36 | vikaton | Go is before my time |
13:04:43 | kulelu88 | it's JIT and 'faster' than Cython (apparently) |
13:04:56 | pigmej | kulelu88: cpython, |
13:05:00 | vikaton | Crystal is AOT |
13:05:03 | pigmej | cython is also different language |
13:05:13 | kulelu88 | aah yes. i'm confused again |
13:05:17 | pigmej | kulelu88: the thing is, you can't compare apples and oranges :) |
13:05:46 | * | mpthrapp joined #nim |
13:05:55 | pigmej | pypy have awesome JIT, it's starting to have STM, it's generally very cool project |
13:06:04 | kulelu88 | pigmej: true. that's why Im no longer fighting it. I'll use Python for now and dream of a nim-py-go blazing fast, easy to write, web language someday |
13:06:10 | pigmej | and rpython does the job very well in other langauges (ruby, php) |
13:06:39 | vikaton | whats |
13:06:52 | vikaton | nim-py-go blazng fast? |
13:07:38 | kulelu88 | vikaton: in simple terms, convulated bullshit +) |
13:07:40 | kulelu88 | =) |
13:08:44 | vikaton | kulelu88: if u want that, maybe this will interest u, https://github.com/dhruvrajvanshi/Moonshine |
13:09:59 | kulelu88 | would it be possible to write the underlying workings of a web-framework in nim and use Python on top of it for the basic stuff? |
13:10:21 | kulelu88 | something like: https://github.com/StarfruitStack/guava |
13:12:12 | * | banister joined #nim |
13:12:32 | thotypous | kulelu88: does python act like a glue language for plugging C modules in guava? |
13:12:47 | thotypous | imho python is not the most adequate language for this kind of task |
13:13:40 | thotypous | lua is usually better as a glue for lowlevel code |
13:13:49 | kulelu88 | I think the core of the work is written using the Python-C API and this framework is rest-like, so you write what I would call the "fluff" code on top |
13:14:05 | kulelu88 | I could be wrong |
13:14:12 | kulelu88 | Always assume I am wrong |
13:14:15 | kulelu88 | =) |
13:18:08 | Araq | kulelu88: the point of compiling things is not only speed, it's also security |
13:18:24 | Araq | Nim has no 'eval', Python does |
13:19:18 | Araq | Nim tries to prevent SQL injection attacks via its type system, Python doesn't even have a type system |
13:19:32 | antranigv | Araq: agree (: |
13:21:08 | thotypous | well, one could argue the same for java or .net :P |
13:22:32 | Araq | thotypous: Java and .NET are heavily used for web development but have reflection which weakens these systems in practice to be hardly better than dynamically typed, ymmv |
13:23:25 | thotypous | (i purposefully said .net in order to include F# in the list :P) |
13:24:03 | vikaton | could Nim implement n eval command tool/ |
13:24:15 | vikaton | 'nim eval 'echo "hi"` |
13:24:20 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
13:24:34 | thotypous | if you link to the compiler and to libtcc, it would be possible |
13:25:55 | Araq | yes and there is also os.execShellCmd anyway. but you can use Nim's effect system to prove "this section of code doesn't exec external stuff" |
13:27:16 | thotypous | which gets us to the point that, unless you strictly enforce W^X memory protection, you can treat the cpu as being as vulnerable to "reflection" as the java or .net VMs ;D |
13:28:27 | Araq | er ... no. why do you think that? |
13:30:07 | thotypous | yes, you are right, not really with nim, unless there is a bug in unsafe code |
13:31:07 | * | vendethiel joined #nim |
13:36:20 | pigmej | kulelu88: the thing is if you want fast python 'api' then just use it |
13:36:34 | pigmej | you will need uwsgi / nginx in front anyway, so ... |
13:36:37 | pigmej | it's C level, |
13:46:26 | RegisterOn | that said, reflection is a wonderful tool for writing serialization and ORM frameworks :) |
13:47:06 | thotypous | metaprogramming ftw |
13:47:11 | RegisterOn | while in the C world, stuff like s11n has to resort to pretty lame linker tricks |
13:47:27 | * | darkf quit (Quit: Leaving) |
13:47:32 | Araq | RegisterOn: these things are better done with a macro system |
13:47:55 | OnwardEuler | Are there any examples of how to use the socket libraries? |
13:48:33 | RegisterOn | Araq: how can you discover facts about types at runtime with a macro system? Bear with me, I'm a total Nim noob :) |
13:48:53 | RegisterOn | from time to time, that's mighty useful |
13:49:07 | RegisterOn | load in plugins dynamically, discover stuff |
13:49:27 | Araq | you don't, that's the point. instead you generate specialized serializers at compile-time with the type knowledge you have at compile-time |
13:49:38 | RegisterOn | heh |
13:56:16 | * | vendethiel quit (Ping timeout: 240 seconds) |
13:59:12 | dom96 | OnwardEuler: What would you like to do? |
14:00:32 | dom96 | The net docs really do need more examples. |
14:00:35 | OnwardEuler | dom96: I'm trying to make a simple client/server based app |
14:00:40 | dom96 | The asyncnet docs have an example. |
14:00:51 | dom96 | of exactly that |
14:01:04 | dom96 | http://nim-lang.org/asyncnet.html |
14:01:19 | OnwardEuler | Awesome, thanks! |
14:02:18 | OnwardEuler | I hadn't even looked at the asyncnet pages... that's exactly what I needed =) |
14:02:20 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:09:36 | * | ddl_smurf quit (Quit: ddl_smurf) |
14:11:17 | * | banister joined #nim |
14:14:27 | * | gsingh93 joined #nim |
14:16:21 | * | saml joined #nim |
14:18:12 | kulelu88 | proc is the same thing as func right? |
14:18:45 | BlaXpirit | kulelu88, func does not exist |
14:18:49 | BlaXpirit | yet |
14:19:19 | kulelu88 | but isn't proc equivalent to a function? |
14:19:27 | BlaXpirit | but yes, you can use `proc` for procedures that return values |
14:19:48 | thotypous | as in "equivalent to the concept of function in other languages"? |
14:19:49 | thotypous | yes |
14:19:51 | * | superfunc joined #nim |
14:19:54 | BlaXpirit | long story short, proc is a function |
14:22:08 | * | gsingh93 quit (Ping timeout: 244 seconds) |
14:22:14 | * | jsudlow joined #nim |
14:22:17 | kulelu88 | in the case of optimizing jester, where is the optimization lacking? In the algorithms or in the use of outdated features? |
14:22:49 | thotypous | is jester slow at all? i think it is pretty fast |
14:23:06 | superfunc | haven't been around in a bit, have typeclasses changed much, or are they still mostly experimental? |
14:23:28 | BlaXpirit | superfunc, they work better |
14:23:30 | Araq | superfunc: they kind of work now and are called 'concept's now |
14:23:39 | superfunc | cool |
14:23:43 | superfunc | also, hey Araq |
14:24:00 | * | kulelu88 superfunc should be known as superproc |
14:25:01 | * | milosn joined #nim |
14:26:00 | OnwardEuler | dom96: that example in the docs won't compile, says I've got an Error: unhandled exception, ivalid format string [ValueError] |
14:26:17 | * | Ven joined #nim |
14:28:04 | * | HakanD_ quit (Quit: Be back later ...) |
14:28:15 | dom96 | OnwardEuler: works for me on Windows. |
14:28:37 | * | HakanD_ joined #nim |
14:28:38 | OnwardEuler | I'm on windows, latest nim and everything |
14:28:38 | * | HakanD_ quit (Read error: Connection reset by peer) |
14:28:52 | * | mhi^ joined #nim |
14:30:17 | * | ChrisMAN joined #nim |
14:30:48 | dom96 | OnwardEuler: weird |
14:30:48 | OnwardEuler | " Error: unhandled exception: invalid format string [ValueError] " |
14:30:59 | dom96 | Is the compiler crashing? |
14:31:06 | OnwardEuler | No line info or anything, could it be a macro thing? |
14:31:19 | * | BitPuffin|osx joined #nim |
14:31:22 | Araq | more likely your config is borked |
14:32:01 | * | Jehan_ joined #nim |
14:32:29 | OnwardEuler | I'll take a look at my cfg |
14:34:27 | filwit | def-: nice article |
14:34:48 | OnwardEuler | Araq: I'm pretty sure I'm using the default config |
14:35:25 | OnwardEuler | Should I look for anything in particular? |
14:35:25 | def- | Araq: any idea how I can set codegenDecl on the declaration of a proc only and not the definition? I'm trying {.codegenDecl: "$# $# $# __attribute__((noreturn))".} because {.noReturn.} doesn't seem to do that |
14:35:26 | * | gokr quit (Quit: Leaving.) |
14:35:51 | OnwardEuler | oh, dom96: yeah, I'm pretty sure the compiler's crashing |
14:36:13 | Araq | yeah well... that doesn't work, def- :-/ |
14:36:30 | def- | Araq: alright, too bad. would have saved another byte ;) |
14:36:48 | dom96 | OnwardEuler: Can you compile hello world? |
14:38:24 | OnwardEuler | dom96 - Nope that crashes too, same error |
14:38:46 | OnwardEuler | should have tried that sooner, I only just installed 0.11 |
14:41:02 | OnwardEuler | reinstalling, will report back |
14:44:18 | * | gsingh93 joined #nim |
14:48:14 | OnwardEuler | dom96, Araq: Don't know what happened, reinstalled, works now. Thanks! |
14:48:36 | dom96 | OnwardEuler: That's good to hear. |
14:49:06 | superfunc | I wonder what happened |
14:50:23 | * | HakanD_ joined #nim |
14:50:58 | Araq | bbs |
14:57:02 | def- | t |
15:04:11 | * | Ven quit (Disconnected by services) |
15:04:32 | OnwardEuler | dom96: though telnetting into the server yields some weird results hahah |
15:04:51 | * | Ven_ joined #nim |
15:06:01 | * | OnO joined #nim |
15:10:48 | * | gyeates joined #nim |
15:21:13 | kulelu88 | dom96: do you have enough time to write an app similar to this one: http://tangowithdjango.com ? |
15:22:44 | dom96 | kulelu88: I am planning on writing something similar for Jester. Whether I have the time... nope, at least not right now with exams coming up... |
15:23:16 | * | ddl_smurf joined #nim |
15:25:42 | * | ingsoc joined #nim |
15:26:58 | kulelu88 | dom96: perhaps you can skip the tutorial part and write the app only. I'd like to see a proper crud app in jester that i can do cookie-cutter work with |
15:28:08 | dom96 | kulelu88: Isn't the forum already a good enough example app? |
15:28:31 | kulelu88 | dom96: not really. there needs to be a simpler tutorial using basic crud workflow |
15:28:46 | kulelu88 | a forum is a big application with lots going on |
15:28:55 | * | mhi^ left #nim (#nim) |
15:29:36 | * | ddl_smurf quit (Quit: ddl_smurf) |
15:29:39 | * | jholland joined #nim |
15:30:09 | dom96 | sure |
15:30:22 | * | aboisvert joined #nim |
15:31:48 | kulelu88 | but if you're busy your studies should take priority, not some silly webapp :P |
15:38:22 | * | superfunc quit (Ping timeout: 246 seconds) |
15:41:00 | * | vendethiel joined #nim |
15:45:51 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
15:49:42 | HakanD_ | def-: your article at front page of HN again \o/ |
15:53:02 | * | Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:53:35 | * | aboisvert quit (Quit: aboisvert) |
15:54:56 | * | ingsoc quit (Quit: Leaving.) |
16:00:12 | * | aboisvert joined #nim |
16:06:04 | * | vendethiel quit (Ping timeout: 245 seconds) |
16:09:48 | * | OnO joined #nim |
16:10:34 | * | ddl_smurf joined #nim |
16:11:25 | Araq | please test: http://nim-lang.org/download/nim-0.11.2_x32.exe |
16:11:33 | Araq | please test: http://nim-lang.org/download/nim-0.11.2_x64.exe |
16:11:47 | Araq | please test: http://nim-lang.org/download/nim-0.11.2.zip |
16:13:28 | Araq | bbs |
16:15:14 | * | UberLambda joined #nim |
16:19:18 | Jehan_ | Araq: Doesn't build for me. |
16:19:48 | Jehan_ | Well, the initial build.sh run works, but "bin/nim cc koch.nim" does the following: |
16:20:03 | Jehan_ | Eh, ./koch boot -d:release |
16:20:06 | Jehan_ | compiler/sem.nim(19, 43) Error: cannot open 'plugins/active' |
16:20:10 | BlaXpirit | try update csources |
16:20:39 | BlaXpirit | Araq, all my code works. regression fixed. |
16:20:59 | Jehan_ | BlaXpirit: That's directly from the nim.zip that Araq wanted tested. |
16:21:14 | Jehan_ | So, updating csources is sort of beside the point. |
16:21:14 | BlaXpirit | oh... |
16:21:25 | BlaXpirit | yeah, i just checkout devel :/ |
16:23:18 | Jehan_ | BlaXpirit: So do I normally. :) |
16:23:36 | * | ddl_smurf quit (Quit: ddl_smurf) |
16:25:01 | BlaXpirit | i thought build.sh is all that's needed |
16:25:43 | Jehan_ | Ah, it looks like the plugins directory is simply not included in the zip file. |
16:26:25 | Jehan_ | BlaXpirit: Yeah, that gets the compiler running, but I wanted to test it, and tried to do that by having it build itself. |
16:26:37 | * | solidsnack joined #nim |
16:27:02 | BlaXpirit | so... the compiler can't build itself but will work anyway? |
16:27:43 | BlaXpirit | nim from archive works well |
16:28:35 | Jehan_ | BlaXpirit: Yeah, because part of the compiler sources are missing. |
16:32:11 | Jehan_ | It's nice how fast a codebase can progress when the author can actually work fulltime on it. :) |
16:33:16 | * | solidsnack quit (Ping timeout: 255 seconds) |
16:33:55 | * | vendethiel joined #nim |
16:37:32 | gyeates | q |
16:37:56 | * | gsingh93 quit (Ping timeout: 264 seconds) |
16:39:59 | OnwardEuler | haha are we getting a new release already? |
16:40:26 | BlaXpirit | yes |
16:40:44 | OnwardEuler | sweet =) |
16:45:43 | * | DKordic left #nim ("ERC Version 5.3 (IRC client for Emacs)") |
16:56:00 | * | BitPuffin|osx quit (Ping timeout: 252 seconds) |
16:57:16 | * | dalarmmst quit (Ping timeout: 240 seconds) |
16:57:20 | * | solidsnack joined #nim |
17:02:09 | def- | Araq: runs fine for me, but some tests fail because of missing files still, for example tests/testdata/jsontest.json |
17:02:38 | ldlework | Why new release? |
17:03:06 | def- | ldlework: 0.11.0 broke existing code with a risky change |
17:03:20 | ldlework | ouch |
17:05:22 | OnO | help pls, why: macro where(T: typedesc[Model]): stmt {.immediate.} = accepts any type as 1st param, not only Model and subclasses? |
17:05:38 | OnO | if I remove {.immediate.} then it behaves as desired |
17:06:22 | ldlework | OnO: that's what immediate means |
17:07:12 | ldlework | OnO: immediate macros are applied lexically. it doesn't know what the type of the thing you're passing to your macro is. |
17:08:01 | OnO | I would expect that only for expr/stmt arguments, NOT all arguments |
17:08:07 | OnO | it does not make sense |
17:08:57 | OnO | acutally I have: macro where(T: typedesc[Model], st: expr): stmt {.immediate.} = |
17:09:29 | fowl | Immediate is getting removed |
17:09:30 | OnO | I want it match Model.where(any non-evaluated expression) |
17:09:32 | ldlework | OnO: there's no typing involved in an immediate macro |
17:09:35 | ldlework | fowl: woah really? |
17:09:43 | fowl | Yea |
17:09:48 | ldlework | why? |
17:09:58 | fowl | You'll use expr/untyped insteas |
17:10:36 | OnO | ldlework: again, I understand {.immediate.} can apply to stmt/expr aguments, but no reason it should apply to all |
17:10:51 | ldlework | OnO: it applies to the entire macro |
17:11:00 | ldlework | its a different type of macro application -all together- |
17:11:26 | OnO | ldlework: okay, but does it make sense? I don't see any |
17:12:23 | ldlework | OnO: immediate macros are lexical. If you can't write your macro only making lexical transformation, you need a non-immediate macro. |
17:13:07 | ldlework | That it supports syntax such as type classes is unfortunate, but it sounds like the whole thing is being removed from the language. |
17:13:22 | * | gsingh93 joined #nim |
17:13:24 | OnO | ldlework: I understand that, but you are not trying to understand me.... immediate should apply only to stmt/expr arguments of macro/template, NOT all arguments |
17:13:38 | ldlework | OnO: no |
17:13:56 | ldlework | a macro applied immediate *can't possible know* *any type information* |
17:14:05 | ldlework | regardless of what kin of parameter is is. |
17:14:08 | ldlework | it *can't* know |
17:14:47 | ldlework | if I understand correctly, anyway. |
17:15:47 | ldlework | (its applied for type information is established by the compiler) |
17:15:51 | ldlework | before* |
17:15:57 | OnO | ldlework: sorry, but I completely don't follow that, how it can't know, compiler is just deciding if it is going to parse AST or not prior passing it to macro |
17:16:19 | OnO | but this makes sense only for stmt/expr arguments |
17:16:37 | OnO | why NOT parse argument of type typedesc[Model] !? |
17:17:06 | BlaXpirit | immediate macros completely ignore types |
17:17:45 | fowl | Oh well the idiot who wrote that part of the compiler couldn't figure it out and that's something we live with. Some excuse about not wanting the compiler to have to do a hundred passes |
17:17:46 | ldlework | OnO: because that's what ________,.-> immediate <-.,________ means |
17:18:26 | ldlework | "Apply this macro, before any type information has been figured anywhere in the program, lexically, no questions asked." |
17:18:29 | * | fowl left #nim ("Leaving") |
17:18:54 | BlaXpirit | good explanation |
17:19:23 | * | HakanD_ quit (Quit: Be back later ...) |
17:19:37 | OnO | okay, I understand that any argument to immediate macro is just NimNode and any type spec is silently ignored |
17:20:13 | OnO | the problem I have is that cannot bind such a macro to certain type, becaue it is all or nothing |
17:20:30 | BlaXpirit | yup |
17:20:35 | OnO | :( |
17:21:00 | BlaXpirit | i think this will be solved with changes mentioned by fowl |
17:22:03 | BlaXpirit | but OnO, maybe you don't need different macros |
17:22:25 | BlaXpirit | do you realize that you can put a big if/case around it all and... |
17:22:49 | OnO | I need: macro where(T: typedesc[Model], st: expr): stmt {.immediate.} = <- where T is parsed existing subtype of Model and st is non-parsed expression |
17:23:01 | BlaXpirit | why do you need it |
17:23:23 | OnO | to type User.where(@name = somename) |
17:23:38 | OnO | and know what was the 1st T type |
17:23:49 | BlaXpirit | riiight... making a global "where" macro that works for everything is not nice |
17:23:53 | OnO | because where macro will eventually lead to constructing such object |
17:24:15 | OnO | BlaXpirit: that's right :) |
17:24:18 | * | JinShil quit (Quit: Konversation terminated!) |
17:24:30 | OnO | it is very very not nice ;) |
17:24:39 | BlaXpirit | i ran into this very recently |
17:25:13 | OnO | I think it should be the arguments annotated as {.immediate.} not whole macro |
17:25:24 | OnO | macro where(T: typedesc[Model], st: expr {.immediate.}): stmt = |
17:25:40 | OnO | so st is unparsed, but everything else is |
17:25:44 | BlaXpirit | [:20:58] <BlaXpirit> i think this will be solved with changes mentioned by fowl |
17:26:02 | BlaXpirit | who knows, it might even work already |
17:26:30 | OnO | oh... fowl can you elaborate this? |
17:26:47 | OnO | is this what "untyped" is for? |
17:28:11 | BlaXpirit | i have good news for u, OnO |
17:28:35 | OnO | yess.... it works with untyped |
17:28:38 | OnO | sweeeeet |
17:28:41 | BlaXpirit | OnO, https://bpaste.net/show/0b4084a32fc4 |
17:29:08 | OnO | awesome.... {.immediate.} must die! |
17:29:54 | ldlework | OnO: congrats! |
17:30:11 | yglukhov_ | Hello. Can anyone help with vararg forwarding please? Details: http://forum.nim-lang.org/t/1186 |
17:31:11 | BlaXpirit | yglukhov_, varargs might not even work at all in templates |
17:32:06 | BlaXpirit | yglukhov_, https://github.com/Araq/Nim/issues/1862 |
17:32:20 | BlaXpirit | oh wait.. this is about immediate, sorry |
17:33:19 | BlaXpirit | but how do you expect to pass an array of expressions??? |
17:35:09 | Jehan_ | OnO: Immediate will be deprecated eventually. |
17:35:33 | BlaXpirit | i dont know why everyone isn't talking about this "untyped" |
17:36:07 | * | filcuc joined #nim |
17:36:08 | OnO | huh, I am almost there with compile type expr to SQL :) |
17:36:19 | OnO | I miss compile time toLower and toUpper for strings |
17:36:57 | yglukhov_ | BlaXpirit, simplified my example. |
17:37:35 | Jehan_ | yglukhov_: There's an outstanding issue with varargs[expr] for templates. |
17:37:57 | Jehan_ | I'll have to look closer at it, but that might be it. |
17:38:33 | BlaXpirit | yglukhov_, replied to simplified example |
17:38:56 | * | OnwardEuler quit (Ping timeout: 240 seconds) |
17:42:30 | yglukhov_ | BlaXpirit, but that's not fair. I want to expand varargs so that $ will be called again on every argument, when passed to echo. But with your suggestion that's not the case, right? |
17:42:53 | BlaXpirit | just call it yourself |
17:43:08 | * | posix4e joined #nim |
17:43:28 | posix4e | Howdy. I am new to nim. I am curious why I should consider nim vs rust |
17:44:19 | BlaXpirit | there are enough such comparisons. |
17:44:30 | posix4e | I felt they only hit the surface |
17:44:42 | posix4e | Would it make sense to write an OS in nim? |
17:44:52 | Jehan_ | Different goals, really. |
17:44:55 | posix4e | Is the runtime libc? |
17:45:18 | Araq | somebody is doing just that. moved from Rust over to Nim for OS kernel development. |
17:45:31 | Araq | iirc he also blogged about it |
17:45:31 | BlaXpirit | https://news.ycombinator.com/item?id=9049698 |
17:45:52 | Jehan_ | Nim attempts to bridge the gap between the expressiveness of a high-level language such as Python and the performance of a system-programming language such as C. |
17:46:09 | BlaXpirit | what |
17:46:14 | BlaXpirit | what language doesn't nowadays |
17:46:30 | Jehan_ | BlaXpirit: Umm, plenty? |
17:46:50 | Jehan_ | Rust aims more at being a more rigorous and disciplined alternative to C++. |
17:47:47 | Jehan_ | BlaXpirit: Go, for example, aims for simplicity over expressiveness. |
17:48:23 | posix4e | Jehan_: But go isn't really comparable to rust right? More java or python or something |
17:48:49 | posix4e | aren't going to write a memory allocator in go |
17:48:50 | Jehan_ | posix4e: Not really, either. |
17:49:05 | Jehan_ | It's not like Rust, but it's not like Java or Python, either. |
17:49:23 | BlaXpirit | worst of both worlds |
17:49:24 | Jehan_ | It's still meant for code that's pretty "close to the metal". |
17:49:38 | Araq | posix4e: iirc they rewrote their GC and memory allocator in Go |
17:49:55 | posix4e | Araq: I think it's still using libvc |
17:49:56 | posix4e | libc |
17:50:24 | posix4e | So let's talk gc |
17:50:30 | posix4e | it seems as though there's a rt gc in nim |
17:50:37 | posix4e | I have no idea why no one else does that |
17:50:44 | posix4e | sans azul |
17:51:06 | Araq | there is also Jamaica and a couple of others |
17:51:21 | posix4e | What if i set the max pause time to 10ms |
17:51:33 | Araq | what if you don't? |
17:51:35 | posix4e | am i going to be trading a ton of perf? |
17:51:40 | posix4e | Araq: sorry two part question |
17:54:45 | Araq | posix4e: if the GC can put up with the number of allocations that you do, or rather the amount of garbage the mutator produces, there is no perf overhead |
17:55:16 | Araq | in fact, it's more like: there is no perf overhead, but if the time slice is too short, it starts to leak |
17:55:46 | Araq | well not really "leak" but memory usage grows without boundary |
17:55:57 | Araq | and you either die with OOM |
17:56:04 | Araq | or you need to give it more time |
17:56:09 | * | gyeates quit (Ping timeout: 240 seconds) |
17:56:30 | Araq | Jehan_: can you test the download again please? |
17:56:42 | Jehan_ | Araq: Second. |
17:57:04 | BlaXpirit | when to expect git tag and merge to master? |
17:57:08 | OnO | okay I am getting closer, how do I convert typedesc into NimNode of nnkSym type? |
17:57:24 | OnO | not found any proc for that in macros |
17:57:34 | r-ku | newNimNode()? |
17:57:53 | Araq | depends on the details |
17:58:40 | OnO | #proc `typ=`*(n: NimNode, typ: typedesc) {.magic: "NSetType".} <- commented in macros |
17:59:42 | OnO | macro where(T: typedesc[Model], st: untyped): stmt = newCall(newDotExpr(T, bindSym"execQuery"), newLit(genSQLQuery(T.repr, st, args))) |
17:59:47 | Jehan_ | Araq: Hmm, still missing plugins/active |
18:00:01 | Jehan_ | Eh, second. |
18:00:05 | OnO | however newDotExpr(T, bindSym"execQuery") is invalid, I need to turn T into NimNode |
18:00:11 | Jehan_ | Download messed up, may have used the old zip file. |
18:00:13 | OnO | but no idea how |
18:01:09 | * | filcuc quit (Read error: No route to host) |
18:01:23 | * | filcuc joined #nim |
18:02:32 | Jehan_ | Araq: Okay, compiler builds now. |
18:02:34 | * | filcuc quit (Remote host closed the connection) |
18:02:48 | Jehan_ | And tests seem to be performing as before. |
18:03:45 | * | gsingh93 quit (Ping timeout: 240 seconds) |
18:04:43 | OnO | okie newIdentNode(T.repr) seems to work |
18:06:48 | Jehan_ | Hmm, longish discussion about null references on HN. |
18:06:54 | * | dalarmmst joined #nim |
18:10:54 | posix4e | Well I have to admit I can't imagine times when i'd choose go over nim then. If for no other reason then the GC. |
18:11:46 | Araq | posix4e: well Go has a shared memory GC, Nim uses thread local heaps instead. there are plenty of different tradeoffs made in these languages |
18:12:55 | posix4e | Araq: that's very nice of you. It'll be interesting to see how go gc perf changes with a concurrent collector. |
18:13:57 | Araq | posix4e: well if Go becomes too good at one day, we'll likely grow a codegen for it ;-) |
18:14:10 | posix4e | that's funny |
18:14:27 | posix4e | Maybe I should be thinking of nim as a meta code gen language |
18:15:01 | posix4e | I mean when I first heard about nim-> c I was all like "What's so special c++ did this for years" But perhaps i didn't get it |
18:15:03 | * | stefantalpalaru joined #nim |
18:15:25 | * | dalarmmst quit (Ping timeout: 255 seconds) |
18:17:11 | * | dalarmmst joined #nim |
18:18:43 | stefantalpalaru | Hi! What's the best way to use Ident nodes as keys for a table? I need this for a macro that may be called from multiple modules and the idents may be procedures with the same name for which the string representation I get with $ is the same. The probmlem with using NimNode as key is that there's no defines hash proc for them. |
18:19:57 | Araq | stefantalpalaru: dunno, have you considered a different approach? I like to get away from these compileTime global vars which break modularity |
18:20:09 | BlaXpirit | stefantalpalaru, i think ident nodes don't carry any magical extra identification than the names themselves |
18:20:19 | Araq | and by different approach I mean staticExec plus static marshal calls |
18:20:47 | BlaXpirit | Araq, sometimes it is necessary to have state..... |
18:21:27 | Araq | also you can get a different "name" for the proc via getType() |
18:22:11 | BlaXpirit | this getType seems like the be-all-end-all |
18:22:18 | stefantalpalaru | I don't see how. I need to create and use a new var for each targeted function from 2 different macros that may be called in any order. My plan is to have a global (compile time) table with function idents as keys and these new gensymed variables as values. |
18:23:32 | BlaXpirit | Araq, are you seriously going to keep documentation at old version? |
18:23:33 | * | brson joined #nim |
18:23:55 | BlaXpirit | I only accidentally found out that it moved |
18:24:56 | * | dalarmmst quit (Ping timeout: 240 seconds) |
18:25:27 | yglukhov_ | Another template related question. How do I do type matching here: https://gist.github.com/yglukhov/9a2a66074b67053a53da#file-gistfile1-nim-L6-L7 |
18:26:31 | BlaXpirit | inb4 someone says that the answer here is also getType |
18:26:51 | Araq | yglukhov_: you can use 'T is seq' instead but it's futile, typetraits already exists and there is also macros.getType to get real type inspection facilities |
18:27:00 | BlaXpirit | called it |
18:27:52 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
18:29:27 | stefantalpalaru | I was looking at nim-lang.org/macros.html instead of nim-lang.org/0.11.0/macros.html and didn't find what getType. Not cool. |
18:30:03 | BlaXpirit | that's what i said too |
18:30:08 | Araq | funny that you say that, I'm removing the old stuff |
18:30:27 | BlaXpirit | you can't just 404 all of the links.......... |
18:30:43 | stefantalpalaru | do a HTTP redirect instead |
18:30:58 | BlaXpirit | problem is it's not so easy |
18:31:08 | stefantalpalaru | or point them to the most recent version |
18:31:13 | BlaXpirit | some dynamic logic would be best |
18:31:22 | BlaXpirit | and it is definitely not an option to not have a link to latest docs |
18:31:24 | Araq | they do point to the most recent version |
18:31:37 | dom96 | there needs to be a nim-lang.org/latest/ |
18:31:43 | dom96 | and or better yet |
18:31:47 | dom96 | nim-lang.org/docs/ |
18:31:49 | Araq | dom96: I thought you did that? |
18:31:50 | * | gokr joined #nim |
18:31:52 | dom96 | just put the docs there. |
18:31:56 | dom96 | not yet |
18:32:04 | Araq | -.- |
18:32:08 | dom96 | I think you should put docs in nim-lang.org/docs/ |
18:32:16 | Araq | ok |
18:32:29 | stefantalpalaru | they don't point to the most recent version unless you just removed getType: http://nim-lang.org/macros.html#getType,NimNode |
18:32:33 | BlaXpirit | that's all fine but what's going to happen to old links? |
18:32:50 | dom96 | As far as I can see redirecting all those links is not trivial. |
18:33:04 | BlaXpirit | [:30:56] <BlaXpirit> problem is it's not so easy |
18:33:05 | * | gyeates joined #nim |
18:33:43 | BlaXpirit | well if some dynamic logic can be applied, then in case of 404 under root, it can look inside 0.11.2 folder instead |
18:33:55 | stefantalpalaru | it's nginx, how hard can it be to write some redirection rules? |
18:34:16 | thotypous | http://nim-lang.org/0.11.0/documentation.html <-- fun, language manual points to /0.11.0/0.11.0/manual.html |
18:34:24 | * | aboisvert quit (Quit: aboisvert) |
18:34:30 | * | dalarmmst joined #nim |
18:34:42 | BlaXpirit | uh, thotypous, i don't think that address is supposed to be used |
18:34:59 | * | solidsnack joined #nim |
18:35:14 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
18:35:15 | Araq | thotypous: it's called a "relative" path |
18:35:22 | dom96 | stefantalpalaru: There is a lot of docs. |
18:35:35 | BlaXpirit | [:33:41] <BlaXpirit> well if some dynamic logic can be applied, then in case of 404 under root, it can look inside 0.11.2 folder instead |
18:35:40 | dom96 | Guess I can write a script to do it for me. |
18:35:42 | def- | dom96: make a script to make a rewrite rule for each? this should be a one-time thing i guess |
18:35:53 | dom96 | yep |
18:35:56 | BlaXpirit | ............... |
18:36:12 | Araq | google should be smart enough to learn about the new structure within minutes |
18:36:16 | def- | and then google will be happy once they see that the pages moved and index the new ones |
18:36:17 | * | OnO joined #nim |
18:36:41 | Araq | google only needs to follow the links properly ... |
18:36:44 | def- | Araq: maybe if you removed the old ones |
18:36:46 | BlaXpirit | ok but could you not make hundreds of redirect rules? |
18:36:57 | Araq | that's a bizarre webcrawler |
18:36:59 | dom96 | perhaps we should just let Google figure it out. |
18:37:02 | def- | BlaXpirit: that sounds hacky, to try redirecting everything |
18:37:42 | BlaXpirit | so hundreds of redirect rules is the proper way now |
18:38:51 | * | gyeates quit (Ping timeout: 276 seconds) |
18:39:45 | * | posix4e left #nim (#nim) |
18:39:45 | * | aboisvert joined #nim |
18:39:49 | * | posix4e joined #nim |
18:39:54 | flaviu | def-: Your articles are always nice to read :) |
18:39:58 | * | posix4e left #nim (#nim) |
18:40:04 | def- | flaviu: Great to hear, thanks! |
18:41:00 | antranigv | def-: yes, nice article (: |
18:41:11 | * | brson quit (Ping timeout: 256 seconds) |
18:47:24 | * | havenwood joined #nim |
18:54:50 | gokr | filwit: Hehe, full war on hackernews ;) |
18:56:43 | filwit | gokr: haha |
18:57:19 | filwit | gokr: i wasn't trying to start a ton of discussions, but now I've spent a couple hours just responding to everyone.. |
18:57:22 | gokr | Funny that... every article about Nim ends up discussing nil and Rust's memory model. |
18:57:29 | gokr | Yeah |
18:58:44 | filwit | well it's the main significant practical difference between these two up-n-coming systems languages.. makes sense it's the hot topic |
19:01:54 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
19:02:04 | antranigv | I hate when people start compairing languages. |
19:03:34 | filwit | it's an unavoidable consequence of our pattern seeking minds... on the plus side, that same ability allows us to write these languages in the first place :) |
19:04:47 | Araq | bbl |
19:05:48 | * | Matthias247 joined #nim |
19:06:22 | OnO | okie macro implementation of expr to SQL works now like a charm, thanks for great "untyped" type: https://github.com/nanoant/nim-orm/blob/master/orm.nim |
19:07:05 | ldlework | nice |
19:07:22 | ldlework | OnO: working on an ORM? |
19:08:00 | OnO | yup, something like Ruby's but most work to be done on compile time |
19:08:09 | OnO | and lazy evaluation if possible |
19:08:16 | flaviu | http://goo.gl/forms/W9XDgby8a4 < quick 5 second poll about API syntax. |
19:09:46 | filwit | flaviu: can't decide between #2 and #5.. |
19:10:27 | flaviu | filwit: I can't help you there, #2 and #5 are different for everyone :) |
19:10:48 | flaviu | I was hoping that would prevent bias from people choosing options closer to the top. |
19:11:30 | filwit | well i certainly don't like the other ones.. if that's any help.. maybe i'll write that in 'other' |
19:11:48 | * | gsingh93 joined #nim |
19:11:58 | flaviu | Sounds good to me. |
19:12:02 | BlaXpirit | the problem with this poll is people don't see any merit at all in a few of the options |
19:12:18 | BlaXpirit | but there is a reason for them to be like this. the "anycrlf" part is rare |
19:12:34 | BlaXpirit | and some of the options are just consistent with PCRE's syntax |
19:12:53 | BlaXpirit | (?i) can appear in the middle of the string |
19:13:05 | BlaXpirit | and (*ANYCRLF) is a syntax that is already supported by PCRE |
19:13:46 | BlaXpirit | and (?i) too |
19:15:02 | flaviu | filwit: My point was that I don't know which answers #2 and #5 are. Everyone has a different #2 and #5. |
19:15:40 | * | BitPuffin|osx joined #nim |
19:15:41 | filwit | oh crap, lol.. then you really wont understand what I wrote in the 'other' box... |
19:15:48 | flaviu | yep. |
19:16:11 | filwit | re(r"..", "..") and re"..".opts".." |
19:16:39 | flaviu | I've fixed it. |
19:16:44 | filwit | ^ those where my choices.. other's where really obscure and left me wondering what the actually expr was doing |
19:17:22 | flaviu | Well, responses have tapered off a bit. https://docs.google.com/spreadsheets/d/1y_Co5OV3MIkH9l4MFe-F9-ouB9gIhP8aixGz3yy8pqk/edit?usp=sharing if anyone is interested. |
19:17:57 | flaviu | If you're going to answer the poll, I'd appreciate it if you don't click that link until afterwards to avoid bias. |
19:18:16 | * | gsingh93 quit (Ping timeout: 240 seconds) |
19:20:37 | * | iamd3vil joined #nim |
19:21:41 | stefantalpalaru | What's the best way to insert NimNodes before the top level node passed to a statement macro? Would it be a problem if I create a new StmtList, make the previous top node a child and return that? |
19:22:01 | BlaXpirit | stefantalpalaru, that last part is good |
19:22:06 | stefantalpalaru | ok |
19:22:11 | BlaXpirit | i'm pretty sure |
19:22:55 | OnO | is it possible to inject some module into other module? or pass a parameter to some module? |
19:23:00 | * | mischanix joined #nim |
19:23:09 | BlaXpirit | you wish |
19:23:48 | * | mischanix quit (Client Quit) |
19:23:52 | BlaXpirit | there is no way to pass settings to modules, the only way is to pass compiler flags |
19:24:03 | BlaXpirit | and inject... isn't that just include? |
19:24:40 | BlaXpirit | oh you mean it in the context of configuring it |
19:28:41 | * | mischanix joined #nim |
19:44:41 | * | gsingh93 joined #nim |
19:44:49 | * | iamd3vil quit (Ping timeout: 264 seconds) |
19:49:09 | flaviu | Can someone with access to the website add a symlink from /latest/ to whatever the latest release is? |
19:50:40 | * | brson joined #nim |
19:51:54 | flaviu | Also, what exception do I throw for a NPE? |
19:52:32 | BlaXpirit | for a what |
19:53:34 | flaviu | Well, I need to throw an exception if I get a null parameter. |
19:57:41 | * | gsingh93 quit (Ping timeout: 256 seconds) |
19:57:53 | * | mpthrapp quit (Remote host closed the connection) |
20:00:47 | * | posix4e joined #nim |
20:01:10 | posix4e | Araq: so nim's gc is conservative-ish? |
20:02:03 | stefantalpalaru | why am I getting a linking error from the tables module? nimcache/tables.o: In function `HEX24_77242': tables.c:(.text+0x592): undefined reference to `HEX24_51813' |
20:02:12 | * | mpthrapp joined #nim |
20:03:08 | def- | stefantalpalaru: strange, works here. tried removing nimcache? |
20:03:14 | BlaXpirit | that might just be a compiler bug |
20:03:36 | stefantalpalaru | yes, I removed nimcache |
20:08:59 | flaviu | AccessViolationError is basically a NPE, right? ;) |
20:10:19 | flaviu | Hmm, InternalError would also be nice. |
20:12:59 | * | BitPuffin|osx quit (Ping timeout: 256 seconds) |
20:13:16 | * | repax_ joined #nim |
20:15:04 | * | repax quit (Ping timeout: 246 seconds) |
20:16:08 | dalarmmst | Is it not possible to compare uints? |
20:16:19 | def- | dalarmmst: import unsigned |
20:16:49 | dalarmmst | Thanks |
20:16:58 | dalarmmst | Where do I find this info? |
20:17:06 | * | mpthrapp quit (Remote host closed the connection) |
20:17:07 | dalarmmst | I'm reading the nim tutorials |
20:17:18 | dalarmmst | But I didn't see it there. Maybe I missed it |
20:17:44 | stefantalpalaru | I found the cause of the error. I was printing an empty table at compile time with unstringifiable values. This worked, printing {:} but apparently generated that undefined function. |
20:18:49 | def- | dalarmmst: Looks like it's missing in the tutorial. I'm suggesting to make unsigned operations available by default because everyone runs into this problem at some point |
20:19:02 | dalarmmst | I agree |
20:19:45 | OnO | doing newNimNode(nnkCall) with .add(newIdentNode("fetch")), if fetch is a proc then it works, if fetch is an interator I get Error: undeclared identifier: 'fetch' |
20:19:50 | stefantalpalaru | and deprive Nim users from finding out about Araq's strong dislike of unsigned integers? :-) |
20:19:59 | OnO | how to return an iterator from macro? |
20:20:33 | * | mpthrapp joined #nim |
20:22:06 | * | Jehan_ quit (Quit: Leaving) |
20:22:48 | BlaXpirit | OnO, yeah, calling an iterator is indeed invalid |
20:23:25 | BlaXpirit | a normal iterator can only be used in the context of a `for` |
20:23:38 | BlaXpirit | not sure if that means it's impossible to return from a macro |
20:23:39 | OnO | okie so: for u in macro(....): echo u <- how do I return iterator in macro? |
20:24:09 | OnO | trying to do a call in macro, but it does not work |
20:24:16 | * | CARAM__ quit (Ping timeout: 265 seconds) |
20:24:30 | OnO | I guess iterator has different AST, but what ? :) |
20:25:30 | * | CARAM__ joined #nim |
20:25:32 | BlaXpirit | appears it doesn't have different ast |
20:27:33 | OnO | hmm... but it is not a nnkCall |
20:29:40 | BlaXpirit | yeah, it definitely doesn't work, and I don't see a way to make it work |
20:29:48 | BlaXpirit | maybe i can suggest some alternatives |
20:30:45 | * | vikaton quit (Read error: Connection reset by peer) |
20:30:45 | * | NhanH quit (Read error: Connection reset by peer) |
20:30:47 | * | CARAM__ quit (Read error: Connection reset by peer) |
20:31:01 | BlaXpirit | maybe you can settle for returning just the iterator without calling it in advance |
20:31:16 | BlaXpirit | maybe you can use a closure iterator, no need to shy away from them |
20:32:22 | flaviu | Hmm, how about some sort of InvalidUnicodeError? |
20:32:55 | * | Kingsquee joined #nim |
20:33:28 | * | NhanH joined #nim |
20:33:38 | * | CARAM__ joined #nim |
20:34:00 | flaviu | I'm not sure that belongs in nre, it might be better in the unicode module. |
20:34:53 | BlaXpirit | standard library never checks for invalid unicode |
20:36:00 | * | zahary joined #nim |
20:36:29 | * | vikaton joined #nim |
20:36:47 | * | Kingsquee quit (Client Quit) |
20:36:48 | flaviu | I know, but I don't want there to be two different unicode exceptions. |
20:40:17 | * | vikaton quit (Client Quit) |
20:40:30 | * | vikaton joined #nim |
20:41:19 | * | aboisvert quit (Quit: aboisvert) |
20:42:10 | * | aboisvert joined #nim |
20:44:54 | * | gsingh93 joined #nim |
20:45:15 | * | UberLambda quit (Quit: Leaving) |
20:49:59 | BlaXpirit | dom96, 0.11.2 tags to devel, master is not updated |
20:50:46 | Araq | flaviu: if you do if x.isNil: raiseNilException() you're doing it wrong |
20:51:03 | flaviu | Araq: I know, but PCRE does it for me. |
20:51:26 | Araq | ah ok |
20:51:26 | flaviu | "PCRE_ERROR_NULL" on man pcreapi. |
20:51:55 | Araq | does it do PCRE_ACCESS_VIOLATION too? ;-) |
20:52:08 | * | ddl_smurf joined #nim |
20:52:09 | Araq | PCRE_INVALID_POINTER |
20:52:39 | BlaXpirit | google now sends to 404. just great. |
20:52:46 | flaviu | Well, PCRE_ERROR_BADMAGIC and PCRE_ERROR_UNKNOWN_OPCODE are other indications that a pointer is bad. |
20:53:41 | BlaXpirit | please someone make redirects from /system.html etc |
20:55:27 | BlaXpirit | even for me here http://blaxpirit.github.io/nim-random/random.html the links broke |
20:55:37 | BlaXpirit | (imports section links) |
21:00:12 | * | mpthrapp quit (Remote host closed the connection) |
21:01:13 | dalarmmst | How do I make a type T have it's data inlined in another type X? in C++ this would be struct X { T t; }, instead of struct X { T* t; } |
21:02:38 | def- | dalarmmst: just don't make it a ref type, then that happens in Nim |
21:03:25 | dalarmmst | Nice, thanks! |
21:04:29 | * | solidsnack joined #nim |
21:05:09 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
21:09:07 | * | solidsnack quit (Ping timeout: 255 seconds) |
21:13:50 | vikaton | does reem come here often? |
21:15:21 | * | jsudlow quit (Remote host closed the connection) |
21:15:23 | Araq | vikaton: why is that an important question? |
21:15:45 | vikaton | Araq: it isnt, I havent seen him and wanted to talk to him |
21:18:19 | * | OnO joined #nim |
21:28:43 | * | banister is now known as banisterfiend |
21:32:35 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:35:45 | OnO | FYI: https://github.com/Araq/Nim/issues/2656 iterators with vaargs arguments and {.closure.} cause invalid code :( |
21:38:22 | BlaXpirit | damn |
21:40:19 | * | biz joined #nim |
21:40:26 | biz | hello |
21:40:42 | * | biz is now known as Guest91971 |
21:40:57 | BlaXpirit | hello |
21:41:07 | * | Guest91971 is now known as bizn |
21:41:15 | bizn | biz was registered :( |
21:41:17 | bizn | what's up |
21:41:48 | bizn | well you see i came to irc to ask for a bit of help |
21:41:56 | bizn | i need help communicating with skype api Skype4Com |
21:42:01 | bizn | zero idea where to start |
21:42:14 | BlaXpirit | uh i think they're gonna remove it |
21:42:29 | bizn | so useless to mess with? |
21:42:36 | bizn | will be outdated in a month~ i assume |
21:42:37 | bizn | ? |
21:43:13 | * | zahary quit (Quit: Leaving.) |
21:43:57 | BlaXpirit | hmm skype api was supposed to be killed 1.5 years ago... |
21:44:03 | bizn | lmfao |
21:44:14 | bizn | what's with all the current skype bots? |
21:44:18 | bizn | manual possibly? |
21:44:22 | * | zahary joined #nim |
21:44:26 | bizn | clownfish still works and that's one of the main ones |
21:51:28 | * | Kingsquee joined #nim |
21:53:16 | * | vendethiel quit (Ping timeout: 240 seconds) |
21:54:50 | * | milosn quit (Ping timeout: 256 seconds) |
21:58:05 | * | bizn quit (Quit: Page closed) |
21:59:14 | * | Senketsu quit (Quit: Leaving) |
21:59:57 | stefantalpalaru | is there any way to get "ref T" from an instance y of T without doing "var x: ref T; new(x); x[] = y" ? |
22:01:36 | flaviu | stefantalpalaru: Of course! Pull that code into a procedure! |
22:01:37 | flaviu | https://gist.github.com/1ae1d7deac4c57d0a84c |
22:02:26 | stefantalpalaru | I meant without the copying step |
22:03:48 | stefantalpalaru | something simple like getting a ptr with addr. don't we have something like that for refs? |
22:04:11 | * | BlaXpirit is now known as BlaXpirit_ |
22:04:14 | * | BlaXpirit_ is now known as BlaXpirit |
22:05:25 | def- | Ha, with this I can get the binary 1 byte smaller: https://github.com/Araq/Nim/pull/2657 |
22:06:16 | * | BlaXpirit quit (Remote host closed the connection) |
22:06:34 | * | BlaXpirit joined #nim |
22:06:47 | * | BlaXpirit quit (Client Quit) |
22:07:01 | * | wtw quit (Ping timeout: 264 seconds) |
22:10:27 | flaviu | Is the noReturn pragma really necessary? |
22:11:43 | renesac | w/o it your binary may be 1 bit bigger! |
22:12:02 | * | yglukhov_ quit (Quit: Be back later ...) |
22:12:07 | renesac | well, I guess there is some use for it, as the three main compilers have some sort of support for it |
22:12:21 | renesac | *three main C compilers |
22:13:23 | flaviu | If people want it, then they should use C. |
22:13:47 | flaviu | Because if they get to the level where that sort of stuff is important, then they are effectively writing C in Nim anyway. |
22:14:21 | renesac | don't araq always says that you can use Nim as a better C if you want? |
22:14:22 | renesac | :D |
22:15:32 | def- | flaviu: noreturn allows optimizations, even for totally normal code that just never returns. i don't see why we should have a noReturn pragma, but not pass that information to the C compiler |
22:15:35 | renesac | http://stackoverflow.com/questions/10538291/what-is-the-point-of-the-noreturn-attribute |
22:18:03 | flaviu | "need not save and restore any volatile state around the call" - write it in assembly if a function call is too much overhead for you. |
22:18:04 | flaviu | "dead-code eliminate any code that would otherwise follow the call" - Too minor of an advantage. |
22:18:17 | flaviu | I'm sure that the compiler could infer that it'd never return from the code. |
22:19:07 | renesac | not if it don't have the full source of the called code, and even then I'm not sure if it can be infered |
22:19:56 | def- | of course it can't infer that. Why would the compiler know whether a syscall kills your program (for example) |
22:20:01 | renesac | it is a pragma, an obscure pragma that most people don't need to know |
22:20:39 | gokr | "I'm sure that the compiler could infer that it'd never return from the code." - doesn't that sound like the stopping problem? :) |
22:21:13 | gokr | Or "Halting problem" I mean. |
22:21:18 | flaviu | gokr: Sure, but methods tend to be short. |
22:21:33 | flaviu | And I'm assuming there is no non-local control flow like exceptions. |
22:21:33 | * | BitPuffin|osx joined #nim |
22:23:04 | flaviu | https://codesearch.debian.net/results/__attribute__((noreturn))/ |
22:23:11 | flaviu | I'm not convinced noreturn is useful. |
22:24:14 | flaviu | It seems that the only programs that have any mention of noreturn are development tooling, and that's not because they actually use noreturn. |
22:24:26 | * | yglukhov_ joined #nim |
22:24:29 | * | brson quit (Quit: leaving) |
22:26:09 | renesac | the cost of keeping it in nim seems very low, even though the benefit may be low too |
22:28:04 | renesac | you didn't search right |
22:28:17 | renesac | https://codesearch.debian.net/results/noreturn/page_0 |
22:28:50 | * | yglukhov_ quit (Ping timeout: 256 seconds) |
22:28:58 | renesac | 2088 pages |
22:29:32 | flaviu | hmm, looks like everyone defines a macro for their noreturns. |
22:29:48 | flaviu | fair enough then. |
22:30:12 | def- | flaviu: yeah, because it's not platform independent. same thing as I did in the PR. In C11 noreturn is finally in the standard |
22:37:20 | * | Jesin quit (Quit: Leaving) |
22:44:19 | stefantalpalaru | how do I convince Nim do type convert every member of a tuple literal in an assignment? I get "Error: conversion from (int, int, nil) to f8_args_tuple is invalid" for a tuple defined as "type f8_args_tuple = tuple[a: int32, b: int64, c: pointer]". If I convert individually each of the members, it works. |
22:46:53 | * | Jesin joined #nim |
22:51:14 | * | Matthias247 quit (Read error: Connection reset by peer) |
22:54:57 | * | gsingh93 quit (Ping timeout: 240 seconds) |
22:59:06 | * | solidsnack joined #nim |
22:59:43 | filwit | stefantalpalaru: 'int' in Nim is a pointer size, and it does not implicitly convert to either int32 or int64 IIRC. So you'd need to pass (int32, int64, nil). So somethinglike (0'i32, 0'i64, nil) |
23:00:43 | stefantalpalaru | as the error says, I'm passing (int, int, nil) into a (int32, int64, pointer) |
23:01:19 | stefantalpalaru | the compiler fails to automatically convert the first int to int32 and the second to int64 |
23:01:20 | filwit | so (int32(a), int64(b), c) |
23:02:08 | stefantalpalaru | I know the workaround, but I'm working on a macro and it would make my life a lot easier if it would just convert each tuple member |
23:03:15 | filwit | that isn't really a 'workaround'.. you have to explicitly convert an int -> int32/64.. however you can make this happen implicitly with a converter |
23:05:47 | * | Jesin quit (Quit: Leaving) |
23:05:48 | filwit | converter toIntIntPtrTuple(t:tuple[a, b:int, c:pointer]): tuple[a:int32, b:int64, c:pointer] = (int32(a), int64(b), c) |
23:07:26 | flaviu | Isn't this basically a problem of contra/covariance? |
23:08:29 | flaviu | Hmm, not really I guess. |
23:09:37 | * | gsingh93 joined #nim |
23:10:46 | * | aboisvert quit (Quit: aboisvert) |
23:11:22 | * | Trustable quit (Remote host closed the connection) |
23:11:38 | stefantalpalaru | I'm dealing with generic tuples |
23:11:47 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
23:11:56 | filwit | you can define a generic converter |
23:12:23 | stefantalpalaru | for any tuple with any number of members which have any combination of types? |
23:12:35 | * | aboisvert joined #nim |
23:12:58 | filwit | i doubt it.. but i also doubt you really want to do that |
23:13:30 | filwit | but you could make a macro which did that |
23:13:33 | stefantalpalaru | I do. I keep proc parameters in hose tuples. |
23:14:35 | stefantalpalaru | I'm taking a generic proc and transforming it into a proc that takes a tuple ref cast into a pointer and in that tuple ref are the original parameters |
23:16:11 | stefantalpalaru | can I look inside a tuple and see its member types from a macro, given only the tuple ident? |
23:16:26 | * | asdf joined #nim |
23:16:36 | filwit | sounds like you want a macro or template. Note, you can run through tuple vars by index, someTuple[0] |
23:16:54 | asdf | how can I get an ast of some code at runtime |
23:18:47 | filwit | asdf: const x = getAst someTemplateCall() |
23:18:57 | filwit | should work i believe |
23:19:00 | filwit | 'getAst' is in 'macros' |
23:20:21 | filwit | stefantalpalaru: you should be able to do what you want with macros, or maybe even directly inside your proc at runtime via tuple len/indexing.. either way, I can't much help without seeing more context, and I need to work on stuff now, sorry. |
23:22:00 | asdf | I need to do this at runtime though, as in read in a string that represents nim code and get its AST |
23:24:18 | flaviu | asdf: That's a *little* more complicated ;) |
23:25:32 | asdf | flaviu: haha I know, it doesn't need to be easy |
23:25:44 | filwit | asdf: if you mean read arbitrary strings at runtime (from actual runtime vars), you basically looking at using the compiler as a dependency (which is actually possible).. but yeah, it's not so straight forward, and unless you're writing a REPL, probably not needed. |
23:26:16 | flaviu | well, if you want to parse nim code, then you have to link to the compiler like filwit says. |
23:26:22 | filwit | if you look at your problem though, you might find you just need to process string literals into Nim ast, which is much more straight forward. |
23:26:25 | flaviu | see compiler/parser, compiler/ast. |
23:27:34 | asdf | alright, in I go |
23:29:24 | k1i | any idea if/when a shared, GC'd heap will make its way into nim? |
23:31:49 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
23:31:51 | k1i | btw the nim manual is 404ing |
23:31:51 | flaviu | I don't think it'll happen, but there are assignment operators. |
23:31:57 | flaviu | http://nim-lang.org/0.11.0/manual.html#type-bound-operations-operator |
23:32:04 | k1i | ah, nvm, relocated |
23:32:42 | * | solidsnack joined #nim |
23:33:40 | * | elbow_jason quit (Quit: Leaving) |
23:34:36 | renesac | k1i: the boehm GC option collects shared memory |
23:34:55 | renesac | it seems |
23:35:09 | k1i | without boehm |
23:36:43 | renesac | maybe sometime post 1.0? |
23:36:47 | renesac | don't hold your breath |
23:45:10 | * | TEttinger joined #nim |
23:45:27 | ldlework | hi asdf ! |
23:45:34 | * | Jesin joined #nim |
23:45:41 | ldlework | wait a minute.. you're not the asdf I know. |
23:56:59 | asdf | ldlework: sorry to disappoint |
23:58:34 | ldlework | asdf: the other asdf is happy to hear you exist |
23:58:52 | ldlework | as a real person, rather than a forgotten registered nick |
23:59:25 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |