00:06:28 | * | BitPuffin|osx joined #nim |
00:09:24 | * | X67r_ quit (Quit: leaving) |
00:25:38 | * | drewsrem quit (Quit: Leaving) |
00:53:43 | * | jaco60 quit (Ping timeout: 256 seconds) |
01:07:03 | * | umurgdk joined #nim |
01:10:01 | * | Guest27764 quit (Quit: Leaving) |
01:11:13 | * | elbow_jason quit (Remote host closed the connection) |
01:11:17 | * | umurgdk quit (Ping timeout: 240 seconds) |
01:24:07 | * | strcmp2 joined #nim |
01:26:35 | * | strcmp1 quit (Ping timeout: 252 seconds) |
01:38:40 | * | pregressive joined #nim |
01:47:22 | * | nvs7_ joined #nim |
01:47:41 | * | nvs7_ left #nim ("Leaving") |
01:53:14 | * | vasher_ joined #nim |
02:00:36 | * | vendethiel quit (Ping timeout: 276 seconds) |
02:06:02 | * | vendethiel joined #nim |
02:14:15 | * | pregressive quit (Ping timeout: 252 seconds) |
02:19:36 | * | gyeates quit (Ping timeout: 264 seconds) |
02:27:18 | * | zach_ joined #nim |
02:29:28 | zach_ | Question about case insensitivity in Nim: I understand that cases don't matter, but for things like documentation and example code, I frequently see camel case. Is that the best practice, or is the community kinda ok with doing whatever you want if you're making a library? I know it's mostly a matter of taste, but I'm kinda used to using underscores to divide words in code |
02:35:10 | * | darkf joined #nim |
02:38:12 | fowl | zach_, X_X is the same identifier as Xx |
02:38:39 | fowl | araq calls it style insensitivity |
02:38:54 | fowl | the case sensitivity we have is "partial", it only applies to the first letter of the identifier |
02:39:03 | fowl | so x_x is the same identifier as xX |
02:39:08 | fowl | but different than Xx |
02:45:57 | Varriount_ | zach_: https://github.com/nim-lang/Nim/wiki/Style-Guide-for-Nim-Code |
02:46:24 | * | Varriount_ is now known as Varriount |
02:46:50 | Varriount | zach_: And before you get all outraged by the case-sensitivity rules, know that they work surprisingly well. |
02:48:05 | Varriount | Multiple styles can coexist together, which is good, with the number of C bindings Nim has. |
02:48:27 | zach_ | Oh I love the idea of the case-sensitivity rules |
02:48:51 | zach_ | I just want to not be hated if I go with non_camel_case for my blog examples / libraries I write |
02:49:45 | zach_ | Although it looks like the style guide defaults to camelCase as the default style |
02:53:13 | * | elbow joined #nim |
02:54:12 | Varriount | zach_: Feel free to use whatever style you want. |
02:54:36 | Varriount | zach_: The style guide is enforced for the standard library, but it's only a suggestion for others. |
02:55:47 | * | umurgdk joined #nim |
02:58:12 | zach_ | ok thanks! |
03:00:08 | * | umurgdk quit (Ping timeout: 250 seconds) |
03:09:15 | * | zach_ left #nim ("Leaving") |
03:17:36 | * | gyeates joined #nim |
03:26:48 | * | BitPuffin|osx quit (Ping timeout: 264 seconds) |
03:32:38 | * | vendethiel quit (Ping timeout: 250 seconds) |
03:33:30 | * | vendethiel joined #nim |
03:42:31 | * | gyeates quit (Ping timeout: 246 seconds) |
04:19:59 | * | vendethiel quit (Ping timeout: 265 seconds) |
04:21:58 | * | vendethiel joined #nim |
04:37:27 | * | FedeOmoto quit (Quit: Leaving) |
04:38:16 | * | milosn quit (Quit: Lost terminal) |
04:44:38 | * | umurgdk joined #nim |
04:49:27 | * | umurgdk quit (Ping timeout: 256 seconds) |
04:58:17 | * | ioctl_ quit (Quit: Lost terminal) |
04:58:49 | * | vasher_ quit (Quit: Connection closed for inactivity) |
05:32:49 | * | vendethiel quit (Ping timeout: 264 seconds) |
05:34:32 | * | vendethiel joined #nim |
05:44:46 | * | EXetoC quit (Ping timeout: 248 seconds) |
05:50:58 | * | EXetoC joined #nim |
05:55:43 | * | Kingsquee joined #nim |
06:08:07 | * | johnsoft joined #nim |
06:54:23 | * | ChrisMAN quit (Ping timeout: 252 seconds) |
07:12:13 | * | Trustable joined #nim |
07:13:34 | * | umurgdk joined #nim |
07:30:01 | * | umurgdk quit (Remote host closed the connection) |
07:31:41 | * | umurgdk joined #nim |
07:33:22 | * | woadwarrior joined #nim |
07:38:09 | * | umurgdk quit (Ping timeout: 265 seconds) |
07:44:25 | * | johnsoft quit (Ping timeout: 246 seconds) |
07:45:03 | * | johnsoft joined #nim |
07:57:59 | * | dgellow joined #nim |
07:59:49 | dgellow | can I use a tuple as a hashmap (or dictionary in some language) ? |
08:03:27 | dgellow | I just want to iterate on key/value pairs |
08:04:24 | EastByte | you could simply use a hash table: http://nim-lang.org/docs/tables.html |
08:09:45 | * | coffeepot joined #nim |
08:10:32 | * | yglukhov__ joined #nim |
08:12:20 | dgellow | EastByte: Yeah, that's what I am looking for. Thank you. |
08:20:17 | * | jszymanski joined #nim |
08:32:34 | * | Arrrr joined #nim |
08:32:58 | Arrrr | Hello, is there a way to print the ast of a defined proc ? |
08:34:36 | Arrrr | Hello, is there a way to print the ast of a defined proc ? |
08:34:41 | Arrrr | ops, sorry. |
08:37:07 | Arrrr | Ok, dumpTree, i found it |
08:39:26 | federico3 | any plan for the new release? :) |
08:42:47 | Araq | Varriount: "The style guide is enforced for the standard library, but it's only a suggestion for others." we really needs this and the style guide on the website |
08:43:12 | * | xcombelle joined #nim |
08:43:25 | Araq | federico3: meh I dunno |
08:46:39 | dgellow | I have this error `Error: type mismatch: got (tuple[name: string, value: string, desc: string]) but expected 'ConfigField'`. ConfigField is defined as `type ConfigField = tuple[name: string, desc: string, value: string]`. Do you have an idea why those types mismatch ? |
08:47:12 | Araq | if you use field names they need to agree |
08:47:30 | dgellow | ah ! order is important ? |
08:47:42 | dgellow | so, why the named field ? |
08:50:28 | Arrrr | Because someone started it and thought "ok, i'll finish this for 2.0, maybe" |
08:51:22 | Araq | hrm? |
08:52:49 | Araq | dgellow: so should the compiler re-order the fields behind your back *even though* a tuple is naturally ordered? |
08:53:08 | Araq | if you don't want the order, use an object |
08:54:11 | dgellow | Araq: Yeah, I understand now. I made a false asumption based on other languages I work with. |
09:00:30 | * | johnsoft quit (Ping timeout: 248 seconds) |
09:00:58 | * | johnsoft joined #nim |
09:04:52 | * | xcombelle quit (Remote host closed the connection) |
09:08:29 | * | woadwarrior quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
09:10:53 | r-ku | Araq: i figured out frames stuff me thinks |
09:11:09 | r-ku | at least now testcase exits properly and seems to track frames fine ^_^ |
09:11:40 | r-ku | hardest thing left figuring out why gc doesnt love main app stack any more |
09:16:06 | dgellow | I have another noob question for you guys. |
09:16:32 | dgellow | var |
09:16:32 | dgellow | fields = @[(name: "sam", value: ""), |
09:16:33 | dgellow | (name: "andre", value: ""), |
09:16:33 | dgellow | (name: "sarah", value: "")] |
09:16:33 | dgellow | for field in fields: |
09:16:34 | dgellow | field.name = stdin.readLine() # Error: 'field.name' cannot be assigned to |
09:17:16 | Arrrr | mitems |
09:17:23 | dgellow | mutable items |
09:17:25 | dgellow | thanks |
09:17:49 | dgellow | ah yeah! for with only one arg call items |
09:19:38 | Arrrr | I suppose this is not possible in nim: "class A<T> { void a(t T) {/*...*/} }" |
09:21:21 | Araq | Arrrr: c2nim can translate template <typename T> class A { void a(T t); } |
09:22:57 | Arrrr | What is the result? |
09:23:23 | Arrrr | It was java, but anyway. |
09:24:03 | r-ku | Araq: please run this https://glot.io/snippets/e554vu46jc and tell me if its my fuckup or bug. i got a feeling its bug but want to make sure before making bug report with giant macro code |
09:24:36 | * | xcombelle joined #nim |
09:25:33 | Araq | so ... you think it's less work for me without a proper bug report? |
09:26:48 | r-ku | i just want to make sure if its really a bug |
09:26:50 | * | umurgdk joined #nim |
09:27:05 | r-ku | but i suppose compiler (gcc) errors should never be possible right? |
09:27:05 | * | yglukhov___ joined #nim |
09:28:07 | Araq | er ... kinda |
09:28:13 | Araq | but yeah it's a bug |
09:29:12 | r-ku | okie, ill see if i can narrow it down |
09:29:43 | Araq | no, don't mess with constructors. give me my proper coroutines |
09:30:15 | r-ku | uncle sam wants constructors, i must obey :( |
09:30:21 | r-ku | and im stuck with coroutines for the moment :p |
09:30:47 | * | yglukhov__ quit (Ping timeout: 240 seconds) |
09:30:48 | * | umurgdk quit (Remote host closed the connection) |
09:30:52 | r-ku | i got a feeling string gets gc'ed before echoing if main stack is added to gc |
09:31:00 | r-ku | but it makes no sense |
09:31:14 | * | infinity0 quit (Remote host closed the connection) |
09:31:19 | * | yglukhov___ quit (Ping timeout: 252 seconds) |
09:31:21 | * | infinity0 joined #nim |
09:31:29 | * | woadwarrior joined #nim |
09:31:39 | Araq | btw the 'custom_new' bug is hard to fix |
09:32:02 | Araq | in fact |
09:32:10 | r-ku | where would be fun if it was easy ;) any workaround available for it maybe? |
09:32:27 | Araq | I don't think this will work, instead we need to get rid of new with finalizer |
09:32:39 | * | umurgdk joined #nim |
09:32:40 | Araq | and replace it by proc `=finalize`() |
09:32:58 | r-ku | oh that sounds awesome |
09:33:45 | r-ku | i can already imagine =finalize() calling =destroy(), having =destroy() basically cover both cases for object destruction. that be awesome |
09:34:29 | * | strcmp2 quit (Ping timeout: 256 seconds) |
09:36:59 | * | yglukhov___ joined #nim |
09:39:30 | r-ku | i hate to ask but within what timeframe we can expect to get =finalize? |
09:40:17 | Araq | bah, just implement it, I can tell you how |
09:42:32 | r-ku | i bet its just as easy as coroutines :D |
09:42:48 | Araq | nah, easier, I think |
09:43:04 | fowl | Do ittt plz |
09:43:06 | r-ku | well do tell, ill save that info for the time when im terminally stuck w/ gc :D |
09:43:55 | Araq | compiler/semstmts, edit semOverride |
09:44:09 | Araq | add a new field finalizer* to the TType in ast.nim |
09:44:32 | Araq | look at how deepcopy is implemented |
09:44:42 | Araq | where it's used and instantiated |
09:45:01 | Araq | cause `=finalize` needs to works with generics too |
09:45:08 | Araq | so that's a slight complication |
09:45:20 | Araq | but actually just grep for "deepcopy" |
09:45:40 | Araq | it's all there for it |
09:45:47 | Araq | generic instantation magic |
09:46:00 | * | vasher_ joined #nim |
09:46:00 | Araq | codegen type info slot |
09:49:00 | * | Kingsquee quit (Quit: Konversation terminated!) |
09:51:08 | r-ku | saved. btw Araq dont you think =finalize and =destroy kind of do exact same thing? is it not wasteful to have both? ofc in my macro i would work it around but still |
09:51:40 | Araq | no, =finalize is well defined and =destroy is not |
09:52:23 | Araq | finalize is battle tested and works, destroy doesn't even work with overloaded assignment for now |
09:53:28 | r-ku | but when eventually it does work there will be this awkward moment where two identical destructors are being defined for one type |
09:54:51 | Araq | seems much worse to conflate the 2 only to find out that it cannot work |
09:55:31 | Araq | "Warning: Ignoring '=finalize' because you already defined '=destroy'." is much easier to do in the long run |
09:56:15 | * | jaco60 joined #nim |
09:56:41 | r-ku | and if no =finalize exits then =destroy(x[]) used in place of finalize? |
09:57:59 | Araq | meh nah |
09:59:01 | Araq | perhaps but it feels wrong |
09:59:06 | r-ku | then i dont quite understand meaning of warning |
09:59:48 | Araq | I don't know ok? :P |
10:00:06 | Araq | but having 2 things for 2 different mechanisms is surely not wrong |
10:00:32 | Araq | and having only 1 for 2 is much more dangerous |
10:06:04 | * | yglukhov____ joined #nim |
10:06:04 | * | yglukhov___ quit (Read error: Connection reset by peer) |
10:06:37 | * | yglukhov____ quit (Remote host closed the connection) |
10:07:08 | * | yglukhov____ joined #nim |
10:10:54 | * | umurgdk quit (Remote host closed the connection) |
10:23:08 | * | umurgdk joined #nim |
10:26:02 | * | EXetoC quit (Ping timeout: 250 seconds) |
10:30:46 | r-ku | hah Araq that main stack problem was actually very simple problem.. and you (i think) hinted me a fix even. setStackBottom() had c_fprintf() call. and since GC_addStack() did some debug echoing it crashed the thing. apparently it was too early to do echoing. so changing echo to c_fprintf() in GC_addStack() made it magically work. |
10:30:52 | r-ku | so now the thing appears to be working |
10:31:31 | r-ku | you should review changes to markStackAndRegisters() and make sure i did not break then thing |
10:31:33 | r-ku | https://github.com/nim-lang/Nim/compare/devel...r-ku:coroutines |
10:31:58 | * | umurgdk_ joined #nim |
10:35:24 | * | umurgdk quit (Ping timeout: 276 seconds) |
10:39:32 | * | umurgdk_ quit (Remote host closed the connection) |
10:57:54 | * | raza joined #nim |
11:17:46 | * | zahary1 joined #nim |
11:17:46 | * | zahary quit (Read error: Connection reset by peer) |
11:18:34 | * | umurgdk joined #nim |
11:31:23 | * | Arrrr quit (Quit: WeeChat 1.2) |
11:38:05 | * | gunn quit (Quit: Textual IRC Client: www.textualapp.com) |
11:38:30 | * | gunn joined #nim |
11:43:19 | * | aziz joined #nim |
11:46:55 | * | johnsoft quit (Ping timeout: 246 seconds) |
11:47:16 | * | johnsoft joined #nim |
11:48:49 | * | vasher_ quit (Quit: Connection closed for inactivity) |
12:04:29 | * | woadwarrior quit (Quit: Textual IRC Client: www.textualapp.com) |
12:41:23 | * | xcombelle quit (Remote host closed the connection) |
12:43:38 | * | strcmp1 joined #nim |
12:59:58 | * | Learath2 quit (Ping timeout: 248 seconds) |
13:00:20 | * | jj2baile quit (Ping timeout: 252 seconds) |
13:00:26 | * | jj2baile joined #nim |
13:01:25 | * | Learath2 joined #nim |
13:06:14 | * | sepisoad joined #nim |
13:06:41 | sepisoad | can i write something like this in nim? |
13:06:59 | sepisoad | var value = json["id"].str or "" |
13:07:27 | sepisoad | so in case json["id"].str returns nil "" goes to value |
13:07:32 | * | arnetheduck joined #nim |
13:12:49 | * | umurgdk quit (Remote host closed the connection) |
13:16:42 | sepisoad | ok i found some workaround |
13:16:51 | sepisoad | like this: |
13:17:30 | sepisoad | var value = if nil == json["id"]: "" else: json["id"].str |
13:19:23 | def- | sepisoad: like this? https://gist.github.com/def-/f044fae89036abbf66a9 |
13:20:08 | sepisoad | yes |
13:20:22 | def- | but just using .str already fails because j["id"] is nil when there is no "id" in it |
13:21:03 | sepisoad | yes |
13:21:09 | sepisoad | that was my main concern |
13:21:17 | def- | Updated it to be json specific but work |
13:21:26 | sepisoad | trying to stringify a nil would crash |
13:21:42 | sepisoad | anyways it's still nice |
13:21:58 | def- | nono, it's not about stringifying a nil, it's about accessing the str field of a nil |
13:22:08 | sepisoad | correct |
13:22:19 | sepisoad | accessing nil |
13:22:23 | sepisoad | my mistake |
13:22:55 | def- | If you make `or` generic it could actually be nice, so you don't have to specify the type of what you want out, but instead specify the default value, and by that default value the type is inferred |
13:24:05 | sepisoad | yup ;) |
13:24:22 | def- | not sure it's worth it, probably easier to just write 5-6 `or` procs |
13:37:22 | * | BitPuffin joined #nim |
13:47:58 | * | umurgdk joined #nim |
13:51:35 | * | umurgdk quit (Remote host closed the connection) |
14:00:03 | * | pregressive joined #nim |
14:13:02 | * | lokulin quit (Ping timeout: 264 seconds) |
14:14:33 | * | drewsrem joined #nim |
14:28:07 | * | umurgdk joined #nim |
14:31:16 | * | lokulin joined #nim |
14:41:04 | * | anthgur joined #nim |
14:57:20 | * | EXetoC joined #nim |
15:01:09 | * | yglukhov_____ joined #nim |
15:01:37 | * | shevy joined #nim |
15:01:40 | * | shevy left #nim ("I'll be back ... maybe") |
15:02:58 | * | yglukhov_____ quit (Client Quit) |
15:04:26 | * | yglukhov____ quit (Ping timeout: 256 seconds) |
15:09:58 | * | ChrisMAN joined #nim |
15:10:31 | * | saml quit (Remote host closed the connection) |
15:12:59 | * | saml joined #nim |
15:20:09 | Araq | r-ku: well how about using an external assembler? |
15:21:06 | r-ku | that would work if someone implements it ;) |
15:23:53 | * | vasher_ joined #nim |
15:24:04 | r-ku | i would just have to rewrite that asm a bit, stick it into a call |
15:24:13 | r-ku | fix stack magic etc |
15:25:17 | Araq | further directions: Port this to the refc GC |
15:25:53 | r-ku | after i clean it up cause now its a mess |
15:26:58 | r-ku | btw Araq why did you tell me to loop stacks in markStackAndRegisters()? is it not enough to scan current active stack? whenever allocations happen on other stacks gc will run there. i dont see much point in looping all of stacks all the time. unless im not aware of something |
15:27:54 | Araq | well that's not how a non-incremental mark-and-sweep GC works at all |
15:28:27 | Araq | in this GC setting there is only "alive now" and "dead" |
15:28:43 | Araq | and if you don't mark it, it's dead. |
15:29:02 | Araq | so everything that's only referenced from yielded stacks would be declared "dead". |
15:29:33 | r-ku | hmm i see, now it makes sense |
15:31:00 | Araq | however what you describe would work for the refc'ing GC |
15:31:29 | Araq | but I don't think enforcing a GC collection on every "yield" is wise either |
15:32:37 | r-ku | btw did you review my changes? somehow i get a feeling youll be merge-happy and shit will break again :p |
15:32:56 | Araq | I only skim things |
15:33:19 | Araq | reading is rather hard, I tend to avoid it |
15:34:11 | Araq | but seriously, it's not an official PR yet :P |
15:34:19 | r-ku | makes me wonder if you picked wrong profession then ;) nah but rly. I64 PR was awesome. shit worked and tests passed (!!) and still it was bad thing to do lol |
15:34:42 | r-ku | we need code-review slaves. |
15:35:35 | Araq | as long as we spend an enormous amount of work on the official releases (and we do...) things are IMHO just fine |
15:36:26 | * | umurgdk quit (Remote host closed the connection) |
15:38:20 | Araq | I don't develop with "gcc from origin master" either |
15:42:55 | drewsrem | Is it discouraged to build ASTs in macros by concatenating strings together and then parseStmt'ing them? |
15:52:34 | Araq | yes, it sucks |
15:52:49 | Araq | sometimes it's unavoidable |
15:57:08 | * | johnsoft quit (Ping timeout: 256 seconds) |
15:57:41 | * | johnsoft joined #nim |
16:00:11 | * | gyeates joined #nim |
16:00:14 | drewsrem | Just seems really comfortable to use |
16:01:22 | * | Ven joined #nim |
16:01:45 | Araq | well the same applies what I said about LLVM |
16:02:24 | drewsrem | Namely? - I missed that |
16:02:31 | Araq | when generating the textual representation is more convenient than using the API you expose, you know your API sucks |
16:04:45 | drewsrem | hmmm... I think it's more like you already have to know the textual representation in order to use the language at all, so you're naturally always going to be more familiar with it |
16:05:33 | Araq | generate foo(bar, baz, boo) |
16:05:59 | Araq | you need a comma after the first and the second, but not after the third argument |
16:06:37 | Araq | you need to ensure you got the quoting rules right, so that "xyz" produces "\"xyz\"" |
16:07:19 | drewsrem | true, this can easily become more complex then it needs to be |
16:07:45 | Araq | and that's just the ordinary call |
16:08:04 | Araq | add "indentation based syntax" on top of it and it quickly becomes a PITA |
16:08:42 | Araq | you construct trees, so use a trees based API, not string concats |
16:09:42 | EXetoC | trees are cool |
16:10:24 | Araq | also when you have (a+b)*c as a tree and produce a string you need to emit the () or else subtle bugs arise |
16:12:11 | Araq | string based programming -- slow, fragile, bug-prone. (Hi, Unix!) |
16:13:10 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
16:13:42 | drewsrem | Why did you say its sometimes unavoidable tho? |
16:14:27 | Araq | when you extract Nim code out of a string for a string interpolation library: |
16:14:35 | Araq | echo "foo {nim code here} bar" |
16:14:55 | Araq | you really want to use the compiler's parser for the "nim code here" substring |
16:16:18 | drewsrem | ah makes sense |
16:19:18 | * | rgv151 joined #nim |
16:20:46 | rgv151 | anybody know why AsyncSocket state is not closed by defaut? |
16:21:00 | rgv151 | https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncnet.nim#L73 |
16:22:35 | * | Arrrr joined #nim |
16:22:37 | rgv151 | `isClosed` proc returns `true`, even I didnt make a connection yet |
16:23:47 | Araq | sounds right to me? |
16:24:02 | Araq | it starts as closed until you open a connection? |
16:24:47 | rgv151 | it's `false` by default, and I think it should be `true` |
16:24:54 | * | dewdrop quit (Ping timeout: 256 seconds) |
16:25:43 | EXetoC | no connection has been established at that point |
16:26:40 | rgv151 | I didnt open a connection yet, and isClosed returns false |
16:27:00 | * | Jesin joined #nim |
16:27:26 | rgv151 | in that case, I can't deterine socket is already connected or not |
16:27:41 | EXetoC | you said it returned true, which confused me |
16:28:10 | rgv151 | sorry, my bad |
16:28:14 | EXetoC | false as the initial state does indeed seem wrong |
16:28:59 | Araq | the flag should be isOpen |
16:30:01 | rgv151 | how to determine if a socket is connected? |
16:30:34 | EXetoC | it's false at first and is then only modified when calling 'close' apparently |
16:32:52 | dgellow | how can I convert a seq into an array ? |
16:33:10 | Araq | you cannot |
16:33:32 | * | xtagon joined #nim |
16:33:41 | Araq | except for the manual a[i] = s[i] for all i, possibly hidden in a macro |
16:33:53 | dgellow | okay |
16:33:55 | EXetoC | what about slice assignment? |
16:34:54 | Araq | slices return seqs |
16:36:20 | * | vbtt joined #nim |
16:36:36 | rgv151 | once we close a socket, isClose will always return true, even when we open another connection |
16:37:57 | * | milosn joined #nim |
16:40:34 | Araq | rgv151: please make a real bug report |
16:41:24 | rgv151 | I just want to make sure it's a bug or not. I can fix it |
16:41:47 | Araq | well dom96 decides |
16:41:55 | Araq | but to me it looks like a bug |
16:41:55 | EXetoC | dgellow: arr[0^1] = ...? |
16:42:06 | rgv151 | ok, thx |
16:42:20 | EXetoC | Araq: []= |
16:43:39 | EXetoC | oops |
16:44:02 | EXetoC | 0..^1 (0..arr.high) |
16:45:25 | Arrrr | It would be a fantastic project to have some kind of visual macro builder |
16:48:11 | Araq | Arrrr: just use templates and getAst. Still my favourite tool. :-) |
16:48:30 | Araq | bbl |
16:49:37 | * | zahary_ joined #nim |
16:53:52 | EXetoC | a lot of things would be great to have :p |
16:56:06 | * | xtagon quit (Read error: Connection reset by peer) |
16:57:53 | EXetoC | with that said, it's very easy to create macros after a little bit of trial and error |
16:58:59 | EXetoC | Arrrr: do it :p |
16:59:32 | Arrrr | Yes, im exactly with a some bits of trials and a lot of errors |
16:59:38 | Arrrr | But little by little .. |
17:00:17 | EXetoC | also, have you read the various macro tutorials? |
17:00:55 | Arrrr | Not a single one, and i didnt know there were any, but i'm reading the source code of the OOP macro, and the one that Andrea uses for variants |
17:01:19 | Learath2 | while debugging nim code how would i go about printing a nim string |
17:01:42 | * | darkf quit (Quit: Leaving) |
17:01:58 | EXetoC | Arrrr: speaking of OOP macros: https://nim-by-example.github.io/oop_macro/ |
17:02:29 | Arrrr | Yes, im exactly in that page |
17:02:40 | Arrrr | It is well documented |
17:02:50 | Arrrr | Learath2: you mean echo "blabla" ? |
17:03:49 | EXetoC | I think he means when executing the program using a debugger |
17:04:09 | Learath2 | nah suppose i have var x = "I like cake" how would I go about getting :"I like cake" while breaked in gdb |
17:04:45 | Arrrr | isnt debugging like in any other program compiled with c ? |
17:05:30 | EXetoC | well, a string in nim is a length followed by a pointer |
17:06:29 | EXetoC | I dunno if there's support for it |
17:10:35 | EXetoC | are the steps necessary for proper debugging documented anywhere? |
17:11:24 | def- | Learath2: let's see, that should be easy |
17:12:13 | Learath2 | tried examining it gave me a weird structure that starts with a 0x08 and many 0x00 then my string |
17:12:21 | * | Jesin quit (Quit: Leaving) |
17:13:12 | EXetoC | yep, length + pointer... no wait, there's the capacity too |
17:15:28 | def- | Learath2: looks good: https://gist.github.com/def-/778ade3ef78a1da7a071 |
17:15:43 | def- | The main pitfall was having to continue once |
17:17:13 | * | Jesin joined #nim |
17:19:49 | * | anthgur quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:21:32 | dom96 | rgv151: Araq: well... that's a tough one. When you create a socket it has not been "closed". |
17:21:34 | dom96 | It was never opened. |
17:21:50 | dom96 | So isClosed returning true doesn't make sense |
17:24:16 | * | anthgur joined #nim |
17:25:23 | Araq | dom96: hence the rename to isOpen |
17:25:32 | Araq | def-: since 0.11.2 you can just use --debugger:native |
17:25:39 | def- | Araq: right, keep forgetting |
17:25:43 | Araq | not that it matters much |
17:26:01 | EXetoC | that'd be hasBeenClosed then |
17:27:05 | dom96 | meh |
17:27:10 | rgv151 | dom96: what does closed mean? socket can not be used anymore? |
17:27:22 | dom96 | Closed means close() has been called on it |
17:27:32 | * | anthgur quit (Client Quit) |
17:27:42 | dom96 | rgv151: what are you using isClosed() for? |
17:28:47 | EXetoC | hence my suggestion |
17:28:49 | rgv151 | I determine if socket is already connected by `not s.isClosed()` |
17:29:04 | EXetoC | what about a convenience for "am I still connected?" |
17:29:16 | dom96 | You should be tracking that yourself |
17:29:43 | dom96 | @EXetoC |
17:29:48 | * | sepisoad quit (Ping timeout: 240 seconds) |
17:29:57 | dom96 | rgv151: Can I see your code? |
17:30:05 | rgv151 | send a ping? |
17:30:21 | dom96 | hrm? |
17:30:55 | dom96 | gist it and paste the link here |
17:31:04 | dom96 | or PM me it if it's private code |
17:31:41 | rgv151 | ah, I just asking how to track the connection |
17:32:40 | dom96 | recv will return "" if the socket was disconnected |
17:34:17 | EXetoC | I suppose someone could create a lib on top if necessary, with things like timeout management |
17:35:04 | Arrrr | Why am i getting 'illformed AST: a' with this line> myMacro HelloWorld(a, b: int) |
17:35:33 | Learath2 | thx def- would have never found .data :D |
17:35:46 | def- | Learath2: just write x_bla. and hit TAB |
17:35:46 | EXetoC | there's both asyncnet and asyncdispatch though, but abstractions on top of asyncdispatch would make more sense to me |
17:36:07 | dom96 | EXetoC: timeouts are trivial with asyncdispatch already |
17:36:34 | def- | Learath2: also shows the Sup field which contains {len = 11, reserved = 11} |
17:38:16 | EXetoC | well what do I know |
17:39:48 | * | apense joined #nim |
17:40:27 | rgv151 | dom96: I just try to use asyncnet and `closed` field confused me |
17:40:56 | rgv151 | now it work fine w/ asyncdispatch and I tracked it myself |
17:42:02 | rgv151 | here is my code if you want to see https://github.com/rgv151/rethinkdb.nim/blob/master/connection.nim |
17:45:26 | * | def- quit (Ping timeout: 250 seconds) |
17:46:01 | dom96 | why not use asyncnet? |
17:47:13 | rgv151 | lol, just cuz asyncdispatch is working for me |
17:50:30 | EXetoC | wait, why did I switch to asyncdispatch? I can't remember |
17:50:59 | * | yglukhov_____ joined #nim |
17:51:01 | * | milosn quit (Ping timeout: 265 seconds) |
17:51:58 | dom96 | that's not a good sign... |
17:53:25 | Araq | Arrrr: because that is not valid Nim syntax, proc p(x, y: int) {.m.} cannot be written as m p(x, y: int) |
17:53:27 | * | filcuc joined #nim |
17:53:50 | EXetoC | aren't they kind of similar? *shrug* |
17:54:11 | Araq | Arrrr: I wanted to enable this via template `func` = m; func p(x, y: int) but people don't like it :P |
17:54:25 | dom96 | The big difference is that asyncnet supports buffering |
17:54:31 | dom96 | and SSL |
17:54:32 | rgv151 | I think some think like `isConnected` should be added to asyncnet, cuz it's a high-level module then.. |
17:55:38 | Araq | dom96: wanna rewrite the async core with r-ku's proper coroutines stuff? |
17:55:57 | dom96 | proper? |
17:55:59 | dom96 | Proper how? |
17:56:22 | Araq | can yield in a recursion |
17:56:34 | Araq | since it has its own stack |
17:56:37 | BitR | Araq: I finally understand why the lambda lifting issues arrive. The :env var is being reused even though it's already owned by another proc / scope. An 'easy' way to fix the problem would be to change the hash of PEnv lookups to include the owner as well as the symbol being looked up. But that would require changing the data structure of the idTable from TIdPair or changing TIdPair. Am I missing an obvious solution for this? |
17:56:50 | dom96 | Araq: Why do I need to rewrite things for it? |
17:57:24 | Araq | dom96: hrm ... good question. maybe you don't have to. |
17:57:50 | dom96 | also, yielding in a recursion isn't very useful... |
17:57:56 | dom96 | unless I am missing something. |
17:58:03 | Araq | BitR: er sorry, but that's what I wrote in the LL description? |
17:58:16 | dom96 | What would be useful is yielding in a try statement |
17:58:22 | dom96 | rgv151: hrm, maybe... |
17:58:24 | * | Demos joined #nim |
17:58:38 | Araq | dom96: oh but it is |
17:58:55 | Araq | think about iterators that iterate over trees |
17:59:31 | dom96 | ok, not useful in an async context :P |
17:59:52 | Araq | I think it's useful in an async context as well |
18:00:12 | Araq | no more templates instead of procs because you cannot 'yield' in a proc |
18:00:12 | EXetoC | I'm using asyncnet again. I just needed to disable buffering... or do I want buffering? let's see.. :p |
18:00:24 | dom96 | rgv151: you can make a PR if you want |
18:00:43 | rgv151 | k, I will |
18:00:46 | dom96 | Araq: what |
18:00:58 | dom96 | You can now yield in a proc? |
18:01:25 | Araq | BitR: just use a hash table from the stdlib. the TIdPair stuff predates working generics and the stdlib |
18:01:49 | Araq | dom96: yes |
18:02:35 | dom96 | how can that possibly work? |
18:03:20 | Araq | as I said, it uses proper stack switching |
18:04:22 | Araq | uses assembler code to switch stacks |
18:04:47 | dom96 | proc x(): int = yield 56; yield 42; return 52 |
18:04:52 | dom96 | echo(x()) |
18:05:00 | dom96 | Where do the 56 and 42 go? |
18:05:42 | EXetoC | I wanted buffering, but in conjunction with a timeout, but.. does buffering implies an underlying socket that blocks until a certain amount of data has been received? |
18:06:01 | * | jszymanski quit (Read error: Connection reset by peer) |
18:06:09 | Araq | EXetoC: it buffers and is async at the same time. :P |
18:06:24 | * | jszymanski joined #nim |
18:07:21 | Araq | dom96: it prints 56 and then you need to resume it explicitly. Or something like that, r-ku's code doesn't yet support procs with return values |
18:08:05 | dom96 | so any proc I call can just suddenly stop? |
18:08:09 | dom96 | That doesn't sound like a good idea |
18:08:24 | BitR | Araq: Ah nice, so I should be able to port it to a hash table with hashes being generated from (owner, symbol) tuples, just need to find the best way to refer to the owner of an env that isn't three references deep |
18:08:25 | dom96 | no return values is a deal breaker for async |
18:09:17 | Araq | lol I don't think so. I think you're just too used to the "old way" now |
18:09:35 | dom96 | ehh yeah |
18:09:39 | dom96 | I need to return the Future |
18:10:15 | EXetoC | Araq: so, non-blocking underlying socket in any case? as in, you could just have the functions take a "shouldBlock" parameter? |
18:11:16 | dom96 | EXetoC: if something in an *async* module blocked then it wouldn't be async now would it? |
18:12:30 | EXetoC | right, it's *that* type of blocking. nevermind. no need to get into that discussion again :p |
18:13:11 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:14:10 | Araq | BitR: did you read my notes on the LL issues? |
18:14:59 | BitR | Araq: I've read some from various issues on github |
18:15:18 | BitR | Mostly references to issue 672 |
18:16:54 | BitR | Wrote a gdb command that's able to see through the kindU mess and show info about PNodes and Symbols btw :) |
18:17:01 | Araq | dude, I wrote this for guys like you: https://gist.githubusercontent.com/Araq/7f1eaacb68a5c49f73bc/raw/3cb1fbdea485c301ea92d837c06598ab5a7f4819/LL |
18:17:24 | Araq | also debugging the compiler can be done more effective than via gdb: |
18:17:33 | BitR | aye you told me about gdb :) |
18:18:14 | BitR | it's just rather nice to break into some code in gdb and be able to inspect variables without having to recompile |
18:18:15 | Araq | http://nim-lang.org/docs/intern.html#debugging-the-compiler |
18:18:36 | BitR | aye read that one |
18:18:51 | Araq | gdb cannot go back in time. I can. Kind of. :P |
18:19:12 | Araq | via the ID mechanism in the compiler |
18:19:31 | Araq | print the offensive ID, re-run and check where this ID is generated |
18:19:47 | Araq | IDs are deterministic, pointers are not |
18:20:17 | BitR | hmm not bad, was thinking of using the gdb 'call' command to do further inspections, should be able to call printTree from there, but aye you'd need to know the proc id name |
18:20:29 | BitR | ah, that's a nice use case |
18:21:04 | Araq | when you enable -d:usenodeIds nodes get IDs too |
18:21:36 | Araq | the compiler can even tell you "this ID comes from this copy" |
18:22:10 | Araq | cause often the original node is already messed up ;-) |
18:22:22 | BitR | cool, really liked the lineDir:on, but this will help immensely too |
18:23:20 | Araq | often it takes more time to write the test case than to fix the bug in the first place |
18:23:38 | apense | Araq, that gist might be a little easier to read if you made it LL.rst |
18:23:44 | * | def- joined #nim |
18:23:55 | apense | only a little bit haha |
18:25:22 | apense | https://gist.github.com/apense/3c90631869b4442204da |
18:26:42 | Araq | thanks, good point, https://gist.github.com/Araq/7f1eaacb68a5c49f73bc |
18:28:54 | * | rgv151 left #nim ("Killed buffer") |
18:29:06 | * | yglukhov_____ quit (Quit: Be back later ...) |
18:29:33 | * | rgv151 joined #nim |
18:30:06 | Araq | BitR: the recompiles for debugging are bad but otherwise I need to resort to conditional breakpoints which are simply too slow |
18:30:39 | Araq | so in the end custom debug code + recompiles wins for me over gdb |
18:30:56 | BitR | Your post mentions changing the PSym->PEnv mapping to TLineInfo->PEnv. Wouldn't this create too many PEnv instances? Should it not rather be (Owner, PSym)->PEnv? |
18:31:33 | BitR | aye sure, I've had to make use of breaking on processModule, continuing past system.nim, then having it break, remove the breakpoint and then I'm in test.nim land :) |
18:31:53 | BitR | but yeah, it all boils down to preferrence really |
18:32:21 | Araq | I think you need to attach the env to the callsite, independent of any owners |
18:32:38 | BitR | Aye, but you only need one env per owner right? |
18:32:38 | Araq | but I could be wrong |
18:32:56 | Araq | per owner and scope perhaps |
18:33:14 | Araq | scope is important too, you need to recreate envs in a for-loop |
18:33:22 | Araq | but better or worse |
18:33:35 | Araq | lots of languages get this wrong though |
18:33:49 | BitR | Well in this case the owner field on the object looking for an env is actually the proc / scope |
18:34:34 | Araq | zahary argued vehemently for the "per scope" capturings and so that's what Nim uses |
18:35:05 | Araq | I think the "broken" behaviour of other languages has more merit in a systems programming setting |
18:35:14 | BitR | Yep, it makes sense |
18:36:13 | Araq | especially since the "per scope" implementation is such a clusterfuck to maintain :-/ |
18:37:41 | Araq | btw the language doesn't use "per scope" capturings for closure iterators cause that made my head explode |
18:38:30 | BitR | Hehe yeah I saw some comments in the code |
18:38:40 | * | unclechu joined #nim |
18:39:12 | EXetoC | the "use your brain" approach didn't cut it in this case? :p |
18:40:05 | BitR | Well if your brain has no problem with recursive code substitutions, I guess you'll be just fine |
18:44:52 | Araq | EXetoC: "read papers about it" doesn't really help either |
18:45:59 | EXetoC | shotgun programming solves everything |
18:47:58 | Araq | BitR: actually it took me 2 weeks to understand why the recursive code subsitution does *not* work |
18:48:16 | Araq | and you need to handle arbitrary nestings all in one pass |
18:48:49 | * | vasher_ quit (Quit: Connection closed for inactivity) |
18:49:08 | BitR | Yeah I'd image you'd want to create a new proc containing all the levels of iterator substitutions and then hope to handle the heavy lambda lifting |
18:49:47 | BitR | But in that case you might be able to make due with one monster scope |
19:14:11 | * | OnO quit (Ping timeout: 256 seconds) |
19:14:50 | * | OnO joined #nim |
19:15:28 | * | dgellow left #nim (#nim) |
19:16:00 | * | Strikecarl joined #nim |
19:19:33 | * | unclechu1 joined #nim |
19:20:25 | * | unclechu quit (Ping timeout: 256 seconds) |
19:24:28 | Strikecarl | Is it possible to compile a .nim into a .dll? and what param(s) do i compile with? |
19:25:46 | reactormonk | Strikecarl, try --lib |
19:26:00 | reactormonk | Strikecarl, ah wait, it's --app:lib |
19:26:10 | Strikecarl | lemme tr |
19:26:13 | Strikecarl | try* :P |
19:26:17 | * | umurgdk joined #nim |
19:26:25 | * | Demos quit (Remote host closed the connection) |
19:26:57 | Araq | Strikecarl: http://nim-lang.org/docs/nimc.html#dll-generation |
19:27:20 | Araq | sometimes I wonder why people claim our docs are bad |
19:27:41 | dom96 | because they are :P |
19:28:07 | Strikecarl | roast |
19:28:27 | Araq | they are not, they are superb. |
19:28:38 | Strikecarl | reactormonk, that just returns "command expects a filename argument" |
19:28:41 | Araq | ... except for all the stuff that isn't documented |
19:31:15 | Strikecarl | Weird |
19:31:21 | Strikecarl | Araq, why do i have to specify the filename |
19:31:25 | Strikecarl | when i use --app:dll |
19:31:26 | Strikecarl | lib* |
19:31:32 | Strikecarl | "Error: command expects a filename argument" |
19:32:02 | Araq | for the same reasons you need to specify a filename for general compilations |
19:32:08 | Araq | nim c -r foo.nim |
19:32:17 | Araq | nim c --app:lib foo.nim |
19:32:25 | Strikecarl | aight |
19:32:31 | Strikecarl | is it the .nim's location |
19:32:34 | Strikecarl | or nim.exe location? |
19:33:38 | Araq | foo.nim is a text file with Nim source code in it |
19:34:16 | Strikecarl | Worked. ty. |
19:34:56 | Strikecarl | how do i compile it as a 32bit dll? |
19:36:22 | * | rgv151 quit (Quit: rcirc on GNU Emacs 24.5.1) |
19:40:04 | Araq | there are a couple of options, --cpu:i386, but the easiest is to use the 32bit Nim installation |
19:41:26 | Strikecarl | E:\Programming\Nim\dist\mingw\bin\gcc.exe -c -w -O3 -fno-strict-aliasing -IE:\Programming\Nim\lib -o c:\users\carl\desktop\nimcache\test.o c:\users\carl\desktop\nimcache\test.c |
19:41:26 | Strikecarl | Error: execution of an external program failed |
19:41:36 | Strikecarl | used --cpu:i386 :^( |
19:44:55 | Araq | you also need to tell GCC to use 32bits |
19:45:17 | reactormonk | via --passC |
19:45:52 | apense | why are the comments for some templates (see http://nim-lang.org/docs/pegs.html#letters.t,) showing up? seems like the documentation was updated a while after the comments were there |
19:46:47 | * | filcuc quit (Quit: Konversation terminated!) |
19:47:15 | Araq | hrm? |
19:48:19 | Araq | apense: ah so the bug is still here :P |
19:50:26 | apense | haha right. I should have said "not showing up." Didn't make sense the way I wrote it. |
19:50:45 | Strikecarl | reactormonk, nim doesnt like that command |
19:51:09 | reactormonk | Strikecarl, hm, ok. Never compiled something for 32bit. Linux masterrace checking in :-P |
19:51:30 | Strikecarl | :P |
19:51:51 | Strikecarl | Never actually used a linux machine before, i'm that young ye, gotta need this .dll for csgo cheats tho |
19:51:57 | reactormonk | it's --passC:-march=<something> |
19:52:00 | Strikecarl | well fuck 32bit, guess im injecting into a 64bit. |
19:52:59 | * | filcuc joined #nim |
19:54:06 | BitR | Isn't it just --passC:-m32? |
19:54:55 | * | umurgdk quit (Remote host closed the connection) |
19:55:03 | * | BitPuffin quit (Ping timeout: 276 seconds) |
19:56:36 | * | yglukhov joined #nim |
20:01:00 | apense | Araq, I just made a little issue for the template doc (https://github.com/nim-lang/Nim/issues/3087). I couldn't find the previous appearance of it. I can remove or reference if anybody knows what it is. |
20:01:10 | * | Matthias247 joined #nim |
20:01:39 | Araq | it's tagged with "tools" and should already be in the tracker |
20:03:02 | * | umurgdk joined #nim |
20:03:44 | * | umurgdk quit (Remote host closed the connection) |
20:03:52 | apense | ah |
20:03:56 | * | umurgdk joined #nim |
20:12:14 | apense | Araq, Got it. I think this is the same as #1528. (adding discard makes the docs show up) |
20:12:50 | * | Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
20:15:07 | * | yglukhov quit (Quit: Be back later ...) |
20:21:09 | * | yglukhov joined #nim |
20:26:32 | * | yglukhov quit (Quit: Be back later ...) |
20:27:30 | * | Demos joined #nim |
20:29:33 | apense | is libcurl gone? |
20:31:51 | * | Demos quit (Ping timeout: 256 seconds) |
20:33:27 | reactormonk | check nimble |
20:36:46 | Araq | uh oh |
20:37:25 | apense | no curl or libcurl in nimble search |
20:39:46 | Araq | it's in my "toNimble" directory |
20:40:14 | Araq | btw dom96 does Aporia work with the new dialogs package? |
20:42:07 | dom96 | Araq: Yeah, I think so |
20:44:20 | * | drewsrem quit (Quit: Leaving) |
20:47:06 | * | Arcanum_za joined #nim |
20:47:11 | * | Arcanum_za quit (Client Quit) |
20:58:08 | * | wu-lee quit (Remote host closed the connection) |
21:00:29 | * | aziz quit (Remote host closed the connection) |
21:11:00 | * | jszymanski quit (Quit: computer sleeps...) |
21:14:30 | * | raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
21:17:49 | * | Arrrr quit (Quit: WeeChat 1.2) |
21:22:22 | * | elbow quit (Ping timeout: 248 seconds) |
21:26:46 | * | zahary joined #nim |
21:27:56 | * | zahary1 quit (Read error: No route to host) |
21:28:08 | Araq | fowl: ha, I can beat you at macro hacking :-) |
21:28:14 | Araq | check this out: http://forum.nim-lang.org/t/1425/2#8871 |
21:28:33 | Araq | turns out ... we already have pattern matching for ASTs in the language |
21:29:03 | Araq | it's just that nobody noticed ;-) |
21:30:42 | fowl | nice |
21:30:56 | fowl | did you see that lib for pattern matching variant objects? |
21:31:18 | fowl | 'patty' |
21:31:53 | Araq | haven't looked at it yet |
21:31:59 | Araq | but I know it exists |
21:32:05 | EXetoC | neato |
21:32:07 | EXetoC | fowl: where |
21:32:36 | fowl | EXetoC, its on nimble |
21:33:30 | Araq | I especially like the template arg: expr = x; getAst(arg()) hack |
21:34:27 | Araq | reminds me of C preprocessor hacking where you need to nest stuff pointless to get a # toString compile-time operator that doesn't suck ... |
21:34:47 | Araq | or something like that |
21:35:06 | fowl | Araq but does it work from outside the module |
21:36:26 | EXetoC | fowl: I guess neither 'pattern' nor 'matching' appears in the package metadata |
21:36:27 | fowl | I had problems with templates using untyped not working from outside the module |
21:36:45 | Araq | fowl: yes, works |
21:36:55 | Araq | just added recursive and match to macros.nim |
21:36:55 | fowl | EXetoC its called patty and it was added a couplw days ago |
21:38:36 | EXetoC | I need to add update to my alias |
21:39:47 | Araq | Zahary: that 'getAst' builtin is so much better than 'quote'. ;-) |
21:42:22 | EXetoC | fowl: right, that one |
21:42:42 | EXetoC | I got a gazillion macro ideas |
21:43:35 | * | Matthias247 quit (Read error: Connection reset by peer) |
21:46:21 | * | filcuc quit (Quit: Konversation terminated!) |
21:59:47 | * | Xe quit (Quit: *.yolo *.swag) |
22:02:04 | * | Xe joined #nim |
22:06:41 | Varriount | Araq: You want me to put the style guide in the documentation and on the website? |
22:07:49 | Araq | Varriount: yeah and link from tut1 to it |
22:08:46 | * | n0vacane joined #nim |
22:10:53 | * | X67r joined #nim |
22:17:08 | * | thaless joined #nim |
22:17:55 | * | ufm joined #nim |
22:18:14 | ufm | Hi ppl. |
22:18:51 | EXetoC | hi.. human? |
22:18:51 | ufm | Can anyone answer on simple question? pragma benign - what is it? |
22:20:16 | EXetoC | benign? |
22:20:47 | Araq | {.pragma: benign, gcsafe, locks: 0.} |
22:21:14 | ufm | yes. In standart library many-many times used this pragma |
22:21:18 | EXetoC | oh right, aliases |
22:21:25 | Araq | in other words it's GC-safe and doesn't use locking |
22:22:56 | ufm | And this pragma really exists? I'm search it in nim compiler sources without success. |
22:23:16 | Araq | it's in lib/system/incrtl.nim |
22:23:28 | Araq | *inclrtl |
22:25:18 | ufm | hmm.. |
22:25:42 | * | pregressive quit (Remote host closed the connection) |
22:26:14 | EXetoC | pragmas can come in the form of macros too, and aliases as you can see |
22:27:14 | * | n0vacane quit (Quit: Leaving) |
22:27:42 | ufm | Ok. But where definition of this pragma? In inclrtl I see only {.pragma: benign, gcsafe, locks: 0.} |
22:27:58 | fowl | ufm that is the definition of it |
22:28:05 | fowl | See pragma pragma |
22:28:12 | Araq | the pragma pragma is used to introduce new pragmas |
22:28:28 | Araq | that's what you get when language designers are having fun ... |
22:29:01 | ufm | Oh... damn. Sorry for stupid question. |
22:29:39 | Araq | no, it's a perfectly fine question and .benign should be in the manual anyway |
22:30:59 | ufm | It's _another_ question. :) "Why mass usable alias not documented" :) |
22:31:51 | Araq | well "nim doc2" expanded it for you |
22:32:56 | Araq | the documentation is fine but you read the actual source code :P |
22:34:37 | * | unclechu1 quit (Remote host closed the connection) |
22:35:05 | * | Demon_Fox quit (Ping timeout: 252 seconds) |
22:39:48 | ufm | :) |
22:40:02 | * | zezba9000 joined #nim |
22:41:48 | * | Trustable quit (Remote host closed the connection) |
22:42:19 | ufm | Another question. D-lang have nice feature - lazy function arguments (http://dlang.org/lazy-evaluation.html). Nim has something like that? |
22:43:01 | * | umurgdk quit (Remote host closed the connection) |
22:43:45 | dtscode | I don't think nim is lazy evaluation like D or haskell, no |
22:44:42 | * | jszymanski joined #nim |
22:45:00 | Varriount | Nim doesn't have built-in lazy evaluation. It could be done though through use of structures and callbacks. |
22:45:16 | Xe | (thought the benefit of doing that is debatable) |
22:46:10 | Varriount | Xe: That's my feeling on the matter. |
22:46:32 | dtscode | I've never understood the need tbh |
22:46:53 | zezba9000 | Hey I was in here before asking about Nims GC being able to run on 2kb ram Arduino devices. The issue was the allocator can only work with devices that have at least 4mb ram. How hard would it be to update the GC's allocator to not manage its own memory heap in large blocks like it is now and to only allocate what is needed via malloc ect so it could run with minimal memory usage at the expense of performace |
22:47:16 | Xe | zezba9000: why not just disable the GC altogether? |
22:47:28 | zezba9000 | Because I need a GC for portable code |
22:47:35 | Xe | no I mean |
22:47:40 | Xe | only preallocate stuff in the stack |
22:47:44 | Xe | global mutable variables |
22:47:56 | Xe | normally that's a bad idea, but in embedded programming you kinda need to |
22:48:51 | EXetoC | or pre-allocate anywhere else |
22:49:03 | Xe | ^ |
22:49:04 | EXetoC | that works too |
22:49:06 | zezba9000 | Yes I know, thats not the issue. The Nim lang is cripled without a GC and the way you code consistant without it |
22:49:16 | apense | dtscode, it seems valuable with infinite lists, I guess |
22:50:29 | * | dalarmmst quit (Ping timeout: 252 seconds) |
22:50:41 | EXetoC | zezba9000: it's not prioritized right now |
22:51:18 | zezba9000 | What Nim file was used for allocation again I forget |
22:51:48 | EXetoC | the system module |
22:51:58 | Varriount | zezba9000: mmdisp.nim is part of the memory manager. |
22:52:34 | zezba9000 | aww yes and alloc.nim |
22:52:35 | Varriount | zezba9000: I believe you can tell the compiler to use malloc |
22:52:36 | * | dalarmmst joined #nim |
22:52:52 | ufm | omg. GC on embedded devices... Who would have told me that 15 years ago |
22:54:17 | EXetoC | but people just say "you'll probably always be dependent on the GC in practice" |
22:54:34 | zezba9000 | Varriount: Well part of the issue is it allocating more memory then needed. |
22:54:47 | EXetoC | I dunno why people are so pessimistic. A lot of code would have to be rewritten though |
22:55:15 | ufm | Well. ok. Thanx for answers! bye ppl. |
22:55:29 | zezba9000 | ufm: Its not about the GC being used in a big way but wrather giving Nim a good feature set on Arduino |
22:55:39 | zezba9000 | Java can run in 1kb ram with a GC |
22:55:53 | * | ufm quit (Quit: Page closed) |
22:56:10 | zezba9000 | http://haiku-vm.sourceforge.net/ |
22:56:22 | zezba9000 | Its interpreted though |
22:56:46 | * | CARAM__ quit (Ping timeout: 248 seconds) |
22:56:46 | * | endou___________ quit (Ping timeout: 248 seconds) |
22:56:46 | * | fowl quit (Ping timeout: 248 seconds) |
22:56:55 | * | fowl joined #nim |
22:56:55 | * | fowl quit (Changing host) |
22:56:55 | * | fowl joined #nim |
22:56:55 | * | fowl quit (Changing host) |
22:56:55 | * | fowl joined #nim |
22:57:24 | * | endou___________ joined #nim |
22:58:01 | * | jszymanski quit (Quit: computer sleeps...) |
22:58:14 | * | CARAM__ joined #nim |
22:58:25 | EXetoC | yay java |
22:59:21 | federico3 | -_- |
22:59:33 | zezba9000 | If its possible in Java it should be possible in Nim is the point and Nim would run way faster |
23:00:00 | Varriount | zezba9000: Well, there might be some constant you could change to lessen the amount of memory required. |
23:00:43 | zezba9000 | But it still uses mmap wich would also have to be replaced |
23:01:44 | * | vasher_ joined #nim |
23:01:45 | Varriount | On a side note: Anyone know how to generate the full Nim documentation? I need to test some changes out. |
23:02:10 | Varriount | zezba9000: And there's a switch to tell the gc to use malloc |
23:02:25 | * | Demon_Fox joined #nim |
23:02:40 | zezba9000 | Are you sure? Becuase malloc doesn't exist in alloc.nim |
23:02:50 | Varriount | zezba9000: Try '-d:useMalloc' |
23:03:38 | zezba9000 | That only works with gc:none. |
23:03:45 | Varriount | ? |
23:03:52 | zezba9000 | http://nim-lang.org/docs/nimc.html |
23:04:05 | zezba9000 | "Makes Nim use C's malloc instead of Nim's own memory manager. This only works with gc:none." |
23:04:20 | zezba9000 | So it disables the GC |
23:04:38 | Varriount | Hm. |
23:04:45 | * | thaless quit (Ping timeout: 255 seconds) |
23:04:50 | Varriount | I wish Araq were present. |
23:08:28 | zezba9000 | ya |
23:09:13 | Araq | zezba9000: the patches went into devel |
23:09:26 | Araq | you can use --os:standalone with the GC |
23:09:29 | zezba9000 | I see "osAllocPages" The page size just needs to be the size of the object each time maybe |
23:09:57 | Araq | however, it's not been tested at all and as I said for 2KB of RAM you need a much simpler allocator and GC |
23:09:58 | zezba9000 | Araq: Aww sweetness |
23:10:31 | Araq | but you're right that it can be done if Java can do it too ;-) |
23:11:02 | zezba9000 | I'm looking at the alloc.nim now. It it possible to just use malloc instead of mmap and only create pages at the size of a single object? Would that work |
23:12:05 | Araq | does the C runtime even have a malloc you could use? |
23:12:19 | zezba9000 | for Arduino? |
23:12:44 | zezba9000 | Yes it support C/C++ 4.8 without some library support of course |
23:13:54 | * | pregressive joined #nim |
23:13:57 | Araq | including c++ exceptions? |
23:14:23 | zezba9000 | Does Nim use those? Not sure I can test or look it up |
23:14:47 | Araq | it can use setjmp or C++'s exceptions |
23:14:59 | Araq | speaking of which ... does it have setjmp? |
23:15:28 | zezba9000 | I think it does |
23:16:51 | zezba9000 | ya it does, have the include file |
23:16:57 | EXetoC | will Foo[Bar|Baz] ever work? |
23:17:20 | Araq | EXetoC: I fixed lots of bugs for | |
23:17:48 | Araq | but I think it's a rather ill-defined concept |
23:17:50 | zezba9000 | Yep it compiles with setjmp |
23:18:10 | Araq | ok, well C's malloc doesn't support the features we need |
23:18:20 | Araq | which is why we have our own alloctor |
23:18:32 | zezba9000 | What feature is that? |
23:18:48 | EXetoC | it'd just be a simple shortcut |
23:19:29 | Araq | zezba9000: isAllocatedPointer() checking for instance. |
23:19:51 | Araq | or a realloc() that can zero out the additional memory |
23:20:09 | zezba9000 | Araq: memset could do that though |
23:20:16 | zezba9000 | Where is isAllocatedPointer located? |
23:20:20 | Araq | ha, you think so |
23:20:25 | Araq | but you're wrong. |
23:20:52 | Araq | you need to memset only the *new* part of the memory |
23:21:10 | Araq | what's the new part? oops, you cannot access the old size |
23:22:00 | zezba9000 | ok ic thought it was something else |
23:22:24 | Araq | isAllocatedPtr in alloc.nim |
23:22:38 | zezba9000 | Araq: realloc works in Arduino |
23:25:17 | Araq | it works but implements C's semantics |
23:25:50 | Araq | we require a bit more, but realloc is not the problem, we can always malloc; free instead |
23:26:10 | Araq | isAllocatedPtr is crucial though |
23:26:32 | zezba9000 | I see isAllocatedPtr is used for assets |
23:27:03 | Araq | but seriously. Implementing a memory manager for 2K of RAM is *not* hard. You cannot do better than singly-linked lists everything else takes up too much space anyway |
23:29:00 | Araq | for isAllocatedPtr you can speed up searches with a simple bloom filter |
23:29:47 | zezba9000 | Well because there isn't much ram to scan through it could be removed and wouldn't cause much issue I would think if thats the case |
23:30:59 | zezba9000 | You can sacrafice those typical scan optimisations when you only work with 2kb-32kb of ram |
23:37:32 | zezba9000 | What is the different between gc.nim and gc2.nim? |
23:40:42 | Araq | gc2 doesn't work. |
23:40:50 | zezba9000 | k |
23:41:01 | zezba9000 | some experiment? |
23:42:52 | zezba9000 | After looking at gc.nim i'm trying to find what methods of alloc.nim would have to be re-implemented. I see "allocInv" is used a lot. Are there any other nim files that reference alloc.nim |
23:45:03 | Araq | sysstr perhaps |
23:45:26 | Araq | allocInv is just checking the invariant, just debug code |
23:46:38 | Araq | btw I hope your brother is well |
23:47:17 | zezba9000 | Ya he is |
23:48:05 | zezba9000 | has he not been on? |
23:48:23 | EXetoC | what happened? |
23:49:04 | zezba9000 | What do you mean? |
23:49:56 | zezba9000 | EXetoC: Did you ask because you thought somthing bad happend? |
23:50:28 | EXetoC | nevermind |
23:52:11 | Araq | haven't seen him since a while |
23:52:13 | Araq | https://code.google.com/p/arduino/issues/attachmentText?id=468&aid=5395422094860745517&name=malloc.c&token=ABZ6GAczZFDnrc5vIHAEQJQzOxk9beLpYw%3A1434589240487 |
23:54:52 | zezba9000 | Araq: What was the malloc link for? |
23:58:14 | * | vendethiel quit (Ping timeout: 256 seconds) |