00:01:44 | EXetoC | I meant, carry on as normal if not explicitly caught. --optimism would be fitting too. or would exception handling have to be omitted completely? |
00:04:58 | * | jholland quit (Quit: Connection closed for inactivity) |
00:07:19 | * | gsingh93 quit (Ping timeout: 255 seconds) |
00:13:14 | * | bretthart quit (Ping timeout: 265 seconds) |
00:16:59 | * | dhasenan joined #nim |
00:19:26 | BlaXpirit_ | amazing |
00:19:44 | def- | BlaXpirit_: what's amazing? |
00:19:50 | BlaXpirit_ | Jehan gives amazing ideas |
00:20:20 | * | boydgreenfield joined #nim |
00:22:02 | boydgreenfield | Has anyone else had trouble with threads and passing a ptr to a channel to them? (as in here: http://forum.nim-lang.org/t/959#5825) I’m having an issue where I get segfaults on ubuntu but everything works very nicely with no warnings on OS X. Are there any known issues here? |
00:23:41 | * | HakanD________ joined #nim |
00:24:53 | fowl | boydgreenfield, it works on the web repl thing |
00:25:31 | fowl | it also works for me (windows) |
00:25:58 | * | irrequietus quit () |
00:27:37 | boydgreenfield | fowl: What’s the web repl thing!? |
00:27:40 | boydgreenfield | (that sounds fantastic) |
00:27:44 | fowl | http://185.56.186.94/#/ |
00:27:51 | boydgreenfield | Ya… it works for me on OS X too, but it crashes on CircleCI |
00:27:53 | fowl | ekarlso's project |
00:28:07 | * | HakanD________ quit (Ping timeout: 256 seconds) |
00:28:12 | * | gokr quit (Quit: Leaving.) |
00:28:26 | def- | boydgreenfield: same Nim compiler version on CircleCI? |
00:28:58 | * | CryptoToad quit (Quit: Leaving) |
00:29:00 | boydgreenfield | def-: Appears to be, though I can’t find the exact commit on my local install. 0.10.2. |
00:30:07 | boydgreenfield | Incidentally, the linked to ptr example does work… but mine doesn’t and that’s the only place I use a ptr, and the addition of the channel is the only change. Error is the following: `*** Error in `./mg': free(): invalid pointer: 0x00007fff358829a0 ***` |
00:30:15 | boydgreenfield | i’ll try installing the latest devel to see what happens |
00:36:13 | * | a5i joined #nim |
00:37:23 | * | gsingh93 joined #nim |
00:38:18 | * | brson quit (Quit: leaving) |
00:47:26 | boydgreenfield | Well, definitely segfaults reliably on Ubuntu (just reproduced locally in a Docker container). Now for some debugging… Is there a recommended best practice for passing Channels to Threads? |
00:57:39 | * | BlaXpirit_ quit (Quit: Quit Konversation) |
00:58:32 | * | brson joined #nim |
00:59:51 | * | brson quit (Client Quit) |
01:21:57 | * | johnsoft quit (Ping timeout: 256 seconds) |
01:22:17 | * | johnsoft joined #nim |
01:23:42 | boydgreenfield | is this more detail on how `joinThreads` works internally, or best to just dive into the source? appears that my free() error is occurring there. |
01:37:58 | boydgreenfield | def- / fowl: Any good recommendations on how to try to debug a double free issue? Fairly certain it relates to these channels, but having trouble pin-pointing it. |
01:38:48 | * | Demos joined #nim |
01:43:39 | * | bretthart joined #nim |
01:51:38 | * | saml_ joined #nim |
02:08:16 | * | bretthart quit (Ping timeout: 265 seconds) |
02:11:42 | * | banisterfiend quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
02:12:33 | * | HakanD________ joined #nim |
02:17:04 | * | HakanD________ quit (Ping timeout: 252 seconds) |
02:17:06 | * | bcinman_ joined #nim |
02:18:37 | * | bcinman quit (Ping timeout: 256 seconds) |
02:22:20 | * | darkf joined #nim |
02:36:24 | fowl | boydgreenfield, sauce? |
02:38:40 | fowl | boydgreenfield, you can pass the channel id to the thread https://gist.github.com/fowlmouth/5cd8e28d513cd5b6ca20 |
02:45:49 | * | ChrisMAN quit (Remote host closed the connection) |
02:46:32 | * | ChrisMAN joined #nim |
03:09:14 | * | jefus_ joined #nim |
03:10:59 | * | reem quit (Remote host closed the connection) |
03:11:16 | * | reem joined #nim |
03:11:20 | * | jefus quit (Ping timeout: 252 seconds) |
03:12:53 | * | reem quit (Remote host closed the connection) |
03:28:25 | * | Woflox quit (Ping timeout: 252 seconds) |
03:28:38 | * | untitaker quit (Ping timeout: 246 seconds) |
03:28:38 | * | federico3 quit (Ping timeout: 246 seconds) |
03:28:55 | * | federico3 joined #nim |
03:29:33 | * | dv- quit (Remote host closed the connection) |
03:29:50 | * | dv- joined #nim |
03:30:12 | * | untitaker joined #nim |
03:44:46 | * | fizzbooze joined #nim |
03:58:22 | * | HakanD________ joined #nim |
04:02:35 | * | HakanD________ quit (Ping timeout: 244 seconds) |
04:39:50 | * | Demos quit (Read error: Connection reset by peer) |
04:53:11 | * | a5i quit (Quit: Connection closed for inactivity) |
04:59:06 | * | HakanD________ joined #nim |
05:03:30 | * | HakanD________ quit (Ping timeout: 250 seconds) |
05:21:27 | reactormonk | any way to make an API like parse[int] vs. parseInt? |
05:27:25 | * | fizzbooze quit (Ping timeout: 264 seconds) |
05:30:44 | boydgreenfield | fowl: That’s useful, maybe I can get that to work. Oddly just letting the program exit is fine on Linux, but when I try to terminate the thread by passing a special “abort” message and then calling joinThreads is when I get the segfault. Perhaps refactoring to use the IDs vs. thread pointers will help. (I have a bunch of complicated other objects getting passed, but I believe they’re all being properly deep copied, so I |
05:30:45 | boydgreenfield | hope that’s not the issue) |
05:39:53 | * | silven joined #nim |
05:54:17 | fowl | reactormonk, implying you can parse an arbitrary T from a string? |
05:54:27 | reactormonk | fowl, yup |
05:54:46 | reactormonk | fowl, something similar to return type overloading, except explicitly |
06:00:28 | * | boydgreenfield quit (Quit: boydgreenfield) |
06:05:19 | reactormonk | kinda like haskell read "[1,2,3,4]" :: [Int] |
06:08:38 | * | saml_ quit (Quit: Leaving) |
06:13:10 | * | reem joined #nim |
06:17:40 | * | reem quit (Ping timeout: 265 seconds) |
06:23:01 | fowl | reactormonk, we can do better than typeinfo and marshal now with macros.getType |
06:23:19 | reactormonk | fowl, go on... |
06:23:34 | fowl | you know how `==` doesnt work for variant objects |
06:23:40 | reactormonk | nope |
06:24:25 | fowl | well it doesnt, though it seems like it should right |
06:25:46 | reactormonk | gimme sample code |
06:26:57 | fowl | .eval type maybe[t] = object case has:bool of true: val: t else: nil; var m1: maybe[int]; echo m1 == m1 |
06:28:51 | * | charmander is now known as dtscode |
06:29:06 | reactormonk | Error: parallel 'fields' iterator does not work for 'case' objects |
06:29:08 | reactormonk | that's what I get |
06:29:16 | fowl | reactormonk, that wont compile, but its easy to fix if a macro can look up an object type, get its field names and types... https://gist.github.com/fowlmouth/9b9010397ad5fe4b9872#file-xeq-nim |
06:31:25 | reactormonk | fowl, I remember macro.getType appearing somewhere last week? |
06:32:02 | fowl | i dunno, its very new |
06:32:08 | * | bretthart joined #nim |
06:32:44 | * | Woflox joined #nim |
06:47:44 | * | HakanD________ joined #nim |
06:52:17 | * | HakanD________ quit (Ping timeout: 252 seconds) |
07:21:32 | * | bcinman_ quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
07:32:29 | * | reem joined #nim |
07:33:30 | * | dv- quit (Changing host) |
07:33:30 | * | dv- joined #nim |
07:33:53 | * | phira quit (Quit: ZNC - http://znc.sourceforge.net) |
07:35:41 | * | phira joined #nim |
07:36:00 | * | BlaXpirit joined #nim |
07:40:16 | * | HakanD________ joined #nim |
07:40:19 | * | bjz joined #nim |
07:44:19 | * | reem quit (Remote host closed the connection) |
07:48:56 | * | reem joined #nim |
07:53:07 | * | dashed joined #nim |
07:55:31 | * | dyu joined #nim |
07:55:58 | * | reem quit (Remote host closed the connection) |
07:56:55 | * | reem joined #nim |
07:59:23 | * | gokr joined #nim |
08:00:25 | * | bjz quit (Ping timeout: 264 seconds) |
08:08:46 | * | Trustable joined #nim |
08:15:51 | * | gsingh93 quit (Quit: WeeChat 1.1.1) |
08:21:48 | * | Ven joined #nim |
08:24:32 | BlaXpirit | i don't know why i assumed marshal.store would be a binary format |
08:29:33 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:32:08 | * | Ven joined #nim |
08:54:12 | * | BlaXpirit_ joined #nim |
08:54:54 | * | BlaXpirit quit (Ping timeout: 252 seconds) |
08:56:01 | * | BlaXpirit_ quit (Client Quit) |
08:56:17 | * | BlaXpirit joined #nim |
09:08:31 | * | reem quit (Remote host closed the connection) |
09:08:44 | * | bretthart quit (Ping timeout: 256 seconds) |
09:13:46 | * | bretthart joined #nim |
09:17:10 | * | Sembei joined #nim |
09:21:46 | * | bretthart quit (Ping timeout: 256 seconds) |
09:26:10 | dtscode | to throw off future BlaXpirit |
09:28:30 | * | reem joined #nim |
09:31:33 | EXetoC | :o |
09:46:07 | * | reem quit (Remote host closed the connection) |
09:46:42 | * | bretthart joined #nim |
09:47:17 | * | reem joined #nim |
09:50:49 | * | irrequietus joined #nim |
10:01:01 | BlaXpirit | lib/system.nim(143, 40) Warning: unknown magic 'Addr' might crash the compiler [UnknownMagic] |
10:01:03 | BlaXpirit | okaaaaay |
10:07:28 | * | matkuki joined #nim |
10:11:45 | BlaXpirit | i know i'm pushing against the boundaries of the compiler |
10:12:32 | EXetoC | what are you doing? |
10:12:43 | BlaXpirit | still working on nim-random... |
10:13:24 | EXetoC | ok |
10:13:29 | EXetoC | that warning can appear with a bad compiler/csources combination |
10:13:58 | BlaXpirit | hm that's possible |
10:16:49 | BlaXpirit | welp, i updated to the latest devel |
10:16:56 | BlaXpirit | now it doesn't compile at all T_T |
10:17:26 | BlaXpirit | compiler crashes |
10:17:58 | gokr | fowl: There? |
10:18:36 | * | MyMind quit (Read error: Connection reset by peer) |
10:18:38 | gokr | I think you did some slick macro thingy the other day, was it something with tuples? I just recall it looked neat |
10:19:16 | EXetoC | BlaXpirit: works for me. how old is your csources? |
10:19:34 | * | MyMind joined #nim |
10:19:34 | BlaXpirit | no, everything is up to date and good |
10:19:40 | BlaXpirit | just that my program doesnt compile |
10:19:47 | EXetoC | ok |
10:20:03 | BlaXpirit | doesnt compile because compiler crashes Error: execution of an external program failed; rerun with --parallelBuild:1 to see the error message |
10:21:15 | EXetoC | and if you include that? did you build the compiler without -d:release? |
10:21:27 | EXetoC | "./koch temp" will generate bin/nim_temp |
10:21:47 | BlaXpirit | what's that do? |
10:22:46 | EXetoC | that's the only difference compared to "./koch boot", in case you built with -d:release and want to test without it in order to get a compiler stack trace |
10:22:55 | BlaXpirit | ah, first time i see --parallelBuild:1 actually do something |
10:23:11 | BlaXpirit | request for member ‘ClEnv’ in something not a structure or union |
10:23:26 | EXetoC | it usually does something for me. having to add it all the time is annoying though |
10:23:48 | EXetoC | invalid C code generated? |
10:24:02 | * | matkuki quit (Quit: ChatZilla 0.9.91.1 [Firefox 36.0.4/20150320202338]) |
10:24:10 | BlaXpirit | this definitely looks like a regression |
10:24:23 | BlaXpirit | may be hard to reproduce |
10:25:21 | EXetoC | there's no need to try too hard |
10:31:55 | * | reem quit (Ping timeout: 255 seconds) |
10:32:06 | EXetoC | in contrast with bug reports for certain other projects where said test case must be reduced as much as possible almost. that's just pedantic |
10:32:34 | BlaXpirit | nah dude, my lib is crazy convoluted, can't just link to it |
10:32:50 | BlaXpirit | i'm having success reproducing, it's definitely related to generic/concept |
10:34:30 | EXetoC | it's fine, if you can't reproduce. I think I still have an unfinished widget toolkit in the tests directory |
10:42:37 | * | bjz joined #nim |
10:44:14 | * | dashed quit (Quit: Connection closed for inactivity) |
10:47:18 | * | Sembei quit (Max SendQ exceeded) |
10:48:57 | * | Sembei joined #nim |
10:53:57 | * | matkuki joined #nim |
10:54:46 | * | arnetheduck joined #nim |
10:54:49 | matkuki | Do non-ref objects have any performance penalty vs tuples? |
10:55:49 | BlaXpirit | no |
10:56:18 | matkuki | BlaXpirit: Thanks. |
10:57:34 | matkuki | Have a tuple Line(x, y: Position) that needs extra fields, so was wondering. |
10:58:41 | * | bjz quit (Ping timeout: 252 seconds) |
11:01:58 | * | HakanD_________ joined #nim |
11:01:58 | * | HakanD________ quit (Read error: Connection reset by peer) |
11:02:36 | EXetoC | ok well the difference is purely syntactical |
11:06:36 | EXetoC | basically |
11:10:11 | matkuki | Got it. |
11:27:52 | * | bjz joined #nim |
11:44:34 | * | bretthart quit (Ping timeout: 256 seconds) |
12:08:34 | * | Woflox quit (Read error: Connection reset by peer) |
12:16:36 | BlaXpirit | what's wrong with iteration here? https://bpaste.net/show/997dbf299e7d |
12:18:11 | def- | BlaXpirit: You can only know that an iterator is finished after it is finished |
12:18:23 | BlaXpirit | ??? |
12:18:43 | BlaXpirit | so i need to account for that zero |
12:18:45 | def- | no |
12:19:01 | EXetoC | it also yields 'result' |
12:19:12 | EXetoC | apparently |
12:19:21 | BlaXpirit | i see what you mean |
12:19:39 | BlaXpirit | fixed: https://bpaste.net/show/941557c9a5ca |
12:19:53 | def- | or just like this: for x in iter(): result.add(x) |
12:20:12 | BlaXpirit | i know but this is a contrived example, i actually need to partially iterate |
12:20:15 | def- | ok |
12:20:37 | BlaXpirit | thanks |
12:20:53 | EXetoC | a userland iterator trait would be nice |
12:21:23 | BlaXpirit | but damn, this behavior sucks |
12:25:41 | def- | BlaXpirit: i don't see how it could be done differently in a reasonable way |
12:26:02 | def- | BlaXpirit: you'd have to look one step ahead in the iterator and buffer the result |
12:26:10 | BlaXpirit | well the only reasonable way i can imagine is like in my first paste |
12:26:16 | BlaXpirit | no, def- |
12:26:37 | BlaXpirit | i am checking for finished after the iterator is finished |
12:26:39 | def- | how do you know the iterator is finished without running it again after a yield? |
12:26:49 | BlaXpirit | but it doesn't work |
12:27:00 | def- | maybe there will be another yield? |
12:27:02 | BlaXpirit | it says finished only after i get one fake item |
12:27:15 | EXetoC | yes in your example |
12:27:19 | BlaXpirit | def-, please, i'm not stupid. consider the first example again. |
12:27:49 | def- | BlaXpirit: but I'm stupid and don't see how that would work |
12:27:58 | BlaXpirit | how what would work |
12:28:06 | BlaXpirit | iterator gives 1 2 3 |
12:28:32 | BlaXpirit | start. finished? no. get 1. finished? no. get 2. finished? no. get 3. finished? no. get fake 0. finished? yes. |
12:28:40 | BlaXpirit | that's how the first example works |
12:31:03 | EXetoC | it's very unintuitive |
12:32:26 | BlaXpirit | i'm pretty sure this is a bug |
12:32:41 | BlaXpirit | even the manual has it like in my first example |
12:35:24 | BlaXpirit | damn now i get it |
12:35:34 | BlaXpirit | ok i am, after all, stupid |
12:38:03 | EXetoC | but why retrieve an "item" for no reason? |
12:38:23 | BlaXpirit | there may be some actions after the final yield |
12:38:32 | BlaXpirit | iterator has not yet ended after the final yield |
12:39:18 | BlaXpirit | the final yield, like all other yields, pauses execution |
12:39:49 | BlaXpirit | so u need to bump the iterator again, but you can't know if will be finished before you bump it |
12:40:46 | BlaXpirit | welp, now i ran into Error: internal error: (filename: compiler/lowerings.nim, line: 128) for which parallelbuild doesn't help |
12:41:23 | EXetoC | it still seems odd to me, and I'd like to have a go at a userland implementation. |
12:42:12 | EXetoC | are there any benefits of having it in the form of a language feature though? assuming that "traits" are working |
12:43:14 | BlaXpirit | no idea how you want to pause execution without a language feature |
12:46:27 | EXetoC | just, stop advancing the iterator at any given moment |
12:47:35 | * | matkuki quit (Quit: ChatZilla 0.9.91.1 [Firefox 36.0.4/20150320202338]) |
12:50:02 | * | jefus_ is now known as jefus |
12:51:45 | EXetoC | 1. add an iterator interface 2. expand "for x in stuff: ..." to "__iter = stuff.iter; while !iter.done: x = __iter(); ..." ?? |
12:53:14 | EXetoC | not that Araq seemed to care, but I'll give it ago anyway |
12:53:15 | * | mwbrown joined #nim |
12:53:33 | BlaXpirit | you can't pause execution |
12:54:08 | BlaXpirit | although |
12:54:16 | BlaXpirit | yah, it may be possible, ok |
12:55:39 | * | Stefan_____ joined #nim |
12:59:02 | * | mpthrapp joined #nim |
12:59:41 | * | a5i joined #nim |
12:59:48 | Stefan_____ | I have a multiline string. I want to indent that text block, that is insert a number of spaces at the beginning of each line. There is strutils.unindent and strutils.replace. Does that help. And I do not see an insert(), i.e. insert a substring at position 7? |
13:02:48 | EXetoC | Stefan_____: insert is defined in system |
13:04:11 | BlaXpirit | Stefan_____, regex is an option |
13:04:25 | BlaXpirit | replace "^" with " " |
13:04:42 | BlaXpirit | except stdlib re will probably infinitely loop on that :| |
13:05:08 | Stefan_____ | Ah thanks. So I may replace "\n" with "\n " and insert " " at the beginning of the string. Yes regex is possible, but maybe not the fastest. |
13:05:14 | EXetoC | .eval |
13:05:41 | EXetoC | just prepend spaces to each line? |
13:05:56 | EXetoC | nvm I was thinking of string literals |
13:06:40 | BlaXpirit | oh right, no need for regex |
13:06:55 | EXetoC | a for loop iterating over the lines? |
13:08:38 | Stefan_____ | Maybe I should tell what I am doing: It is related to macro construction (glib macro) -- I have to insert some lines of code in the middle of the macro. That code needs well defined indent. |
13:08:38 | EXetoC | 'map' can't be used for strings apparently |
13:08:59 | Stefan_____ | Thanks for your suggestions, that should work. |
13:09:38 | EXetoC | a recursive proc that takes an integer representing the indentation level? |
13:11:48 | * | Stefan_____ quit () |
13:29:07 | * | jfchevrette joined #nim |
13:29:08 | * | TEttinger quit (Ping timeout: 246 seconds) |
13:35:07 | * | reem joined #nim |
13:37:38 | * | nimnoob123 joined #nim |
13:39:20 | nimnoob123 | Quick question: https://github.com/nim-lang/sdl2/blob/master/src/sdl2.nim#L661, how come I can call the close proc on RWopsPtr as: myrwop.close, but not as myrwop.close() ? |
13:39:39 | * | reem quit (Ping timeout: 252 seconds) |
13:39:39 | * | mwbrown quit (Ping timeout: 252 seconds) |
13:39:53 | BlaXpirit | nimnoob123, you must be mistaken |
13:40:04 | nimnoob123 | enlighten me |
13:40:22 | BlaXpirit | wait what |
13:40:25 | BlaXpirit | this is not a proc |
13:40:26 | EXetoC | myrwop[].close()? |
13:40:32 | BlaXpirit | wait, it is |
13:40:36 | nimnoob123 | it is a proc |
13:41:05 | BlaXpirit | this is actually interesting |
13:41:30 | nimnoob123 | i get a compiler error if i call it with parenthesis w/ the latest devel |
13:42:03 | BlaXpirit | report |
13:42:09 | nimnoob123 | let me show you my source maybe it's something to do w/ my code |
13:42:16 | BlaXpirit | without parentheses you are not actually calling it |
13:42:25 | BlaXpirit | nimnoob123, or i can report it if u want |
13:42:37 | nimnoob123 | ill report it, but let me show you this code |
13:42:41 | BlaXpirit | example is |
13:42:42 | BlaXpirit | type T = ref object; close*: proc (context: T);T().close() |
13:43:26 | nimnoob123 | https://gist.github.com/G4MR/327074ceb2b8c7a04826 |
13:43:45 | nimnoob123 | near the bottom |
13:44:56 | BlaXpirit | so? |
13:45:29 | nimnoob123 | sorry, so? |
13:45:39 | BlaXpirit | .eval type T = ref object; f: proc(t: T) |
13:46:20 | nimnoob123 | actually, go ahead and report it. I have some things to do. <BlaXpirit> nimnoob123, or i can report it if u want |
13:46:24 | BlaXpirit | this code causes compiler crash |
13:46:26 | BlaXpirit | what the. |
13:46:46 | EXetoC | bugs. weird innit |
13:47:13 | BlaXpirit | i don't even need to call close |
13:47:15 | BlaXpirit | or whatever |
13:47:24 | BlaXpirit | it just crashes as is |
13:48:46 | EXetoC | ok so the compiler *does* accept code from stdin |
13:49:48 | EXetoC | with the usual '-' convention |
13:50:05 | BlaXpirit | EXetoC, that was a recent change |
13:50:20 | BlaXpirit | by def? |
13:50:23 | def- | yes |
13:50:51 | EXetoC | oh ok. I think that was the first time I tried it, and it was by accident. weird innit |
13:51:02 | EXetoC | def-: great d(:)|< |
13:51:09 | BlaXpirit | nimnoob123, you aren't providing an argument :o |
13:51:19 | nimnoob123 | it doesn't require one? |
13:51:49 | EXetoC | huh |
13:52:00 | nimnoob123 | I'd love to stay and chat, but I have to get some work done. |
13:52:02 | BlaXpirit | close*: proc (context: RWopsPtr): cint |
13:52:15 | EXetoC | I didn't pay attention to that, since he claimed that "foo.bar" compiled |
13:52:16 | BlaXpirit | there is clearly an argument it wants |
13:52:23 | EXetoC | I wonder which 'close' is invoked then |
13:52:28 | BlaXpirit | it is not invoked |
13:52:35 | BlaXpirit | he just obtains the proc and doesnt call it |
13:52:47 | nimnoob123 | yeah it wants the rwop which i call as self.rw.close() is that not how I'm supposed to call it? |
13:53:04 | BlaXpirit | close takes argument |
13:53:07 | EXetoC | ok so he assigned to a var then |
13:53:30 | BlaXpirit | (self.rw.close)(self) |
13:53:43 | BlaXpirit | no idea which of them should be self and which shouldn't |
13:53:45 | nimnoob123 | i'm fairly certain im not retarded |
13:53:55 | BlaXpirit | SDL is fun -_- |
13:53:59 | nimnoob123 | close*: proc (context: RWopsPtr): cint, but that should be callable from the rwop object itself |
13:54:14 | BlaXpirit | it's a variable |
13:55:01 | nimnoob123 | it's a variable function similar to how I do it here: https://gist.github.com/G4MR/195693539e9ee6bae852 w/out issue here https://gist.github.com/G4MR/be9951d312bebebc8fbb |
13:55:24 | nimnoob123 | vtable is what i think they call it or w/e |
13:55:25 | * | banister joined #nim |
13:55:37 | BlaXpirit | why do people keep bothering with sdl, i have no idea |
13:55:45 | nimnoob123 | what's wrong with sdl? |
13:56:00 | EXetoC | rwopsPtr.close(rwopsPtr)? |
13:56:34 | nimnoob123 | so how come I can call it without an argument and w/o parenthesis? |
13:56:40 | BlaXpirit | you are not calling it |
13:56:43 | BlaXpirit | it's a variable |
13:56:47 | BlaXpirit | you're reading a variable |
13:56:48 | nimnoob123 | lol like I said, i'd love to stay and chat, but I have 4 minutes to get ready for work :D |
13:56:56 | EXetoC | "rwops.close" should yield "proc (context: RWopsPtr): cint" |
13:57:03 | EXetoC | ok later |
13:57:12 | nimnoob123 | im reading a variable which so happens to be a proc |
13:57:16 | nimnoob123 | what |
13:57:21 | * | nimnoob123 quit (Quit: Page closed) |
13:57:56 | EXetoC | just wait until after work then -.- |
14:05:56 | arnetheduck | if I have a seq[int], what's the easiest way to convert that into a seq[string] (applying $ to each element)..? |
14:06:12 | def- | arnetheduck: xs.map(`$`)? |
14:06:58 | arnetheduck | thanks, I keep looking for a list comprehension operator :/ |
14:07:18 | def- | right, $ is not procvar. I really think it would be nice to have everything as procvar by default |
14:07:24 | def- | arnetheduck: list comprehensions are in the future module |
14:08:00 | arnetheduck | mm,.. map doesn't work |
14:08:19 | def- | yes, because `$` is not a procvar (but I think Araq considers making everything a procvar by default soon) |
14:08:28 | def- | var ys = xs.map(proc (x: int): string = $x) |
14:09:21 | EXetoC | def-: so there'll still be something called procvar. will it be possible to omit it then? and why was it introduced in the first place? |
14:09:25 | def- | var ys = lc[$x | (x <- xs), string] |
14:09:30 | BlaXpirit | var ys = xs.map((x: int) => $x) |
14:09:43 | BlaXpirit | lc is just lame :| |
14:10:43 | def- | EXetoC: It was introduced because having procvars over module boundaries causes problems with adding optional parameters to a proc later on |
14:10:49 | def- | I think |
14:11:24 | arnetheduck | =>, is that from some non-default module? getting undeclared indentifier |
14:11:29 | def- | arnetheduck: future module |
14:11:43 | def- | it's nicer syntax for what I wrote |
14:11:51 | EXetoC | sweet sugar |
14:21:34 | arnetheduck | ok, that worked, thanks! |
14:22:41 | def- | I think we really need two things in this direction, procvar by default and a shorter way for anonymous procs, something like xs.map($_) where _ is a special symbol (there's an issue about both I believe) |
14:30:33 | * | bcinman joined #nim |
14:31:34 | * | Jehan_ joined #nim |
14:33:26 | * | brson joined #nim |
14:41:22 | * | untitaker quit (Ping timeout: 256 seconds) |
14:47:02 | gokr | Too late for filwit to get me a paper cutout crown... |
14:47:02 | * | untitaker joined #nim |
14:52:13 | BlaXpirit | :s |
14:53:15 | EXetoC | how did he die? |
15:00:14 | BlaXpirit | hmm how to turn seq to set? |
15:01:20 | BlaXpirit | i guess with an incl loop |
15:01:54 | def- | toSet if you're talking about the sets module |
15:02:22 | BlaXpirit | i'd use that module but its sets are unhashable |
15:02:37 | def- | can't you implement hash for them? |
15:02:45 | BlaXpirit | it would probably require sort |
15:02:51 | BlaXpirit | if you think about it |
15:02:53 | def- | right |
15:03:09 | BlaXpirit | so it's horribly costly, so it makes sense it's not there |
15:03:19 | BlaXpirit | i dont need it here anyway |
15:05:09 | * | gokr quit (Ping timeout: 250 seconds) |
15:09:34 | * | jefus_ joined #nim |
15:13:36 | * | jefus quit (Ping timeout: 264 seconds) |
15:13:47 | * | brson quit (Quit: leaving) |
15:14:03 | * | brson joined #nim |
15:29:00 | * | Sembei quit (Max SendQ exceeded) |
15:30:07 | BlaXpirit | flaviu, randomPrecise seems to be failing chi square test more often than any other part of the lib |
15:30:17 | * | Sembei joined #nim |
15:33:28 | Jehan_ | BlaXpirit: Just so you know, I did get your email, but am kinda busy this week, so probably not going to respond in any detail for a while. |
15:33:43 | BlaXpirit | ok, Jehan_ |
15:33:59 | BlaXpirit | i basically sticked to the old algorithm but without sorting |
15:35:28 | Jehan_ | BlaXpirit: *nod* |
15:38:30 | * | brson quit (Quit: leaving) |
15:39:13 | EXetoC | how do I pass an undeclared identifier to a macro? I can do only it with a template by using immediate as shown in the manual |
15:41:06 | EXetoC | wait |
15:41:08 | BlaXpirit | EXetoC, sure you can pass it |
15:41:12 | BlaXpirit | it's an error somewhere else |
15:41:48 | EXetoC | yep |
15:44:05 | Jehan_ | Macros can be immediate, too. |
15:44:31 | Jehan_ | Though Araq has mentioned redoing those semantics, so I'm not sure how future-proof that is. |
15:47:50 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:57:04 | EXetoC | yes it works now |
16:03:43 | * | Ven joined #nim |
16:07:40 | * | darkf quit (Quit: Leaving) |
16:13:34 | * | jefus_ is now known as jefus |
16:22:35 | * | pregressive joined #nim |
16:25:42 | * | gokr joined #nim |
16:25:52 | * | gokr left #nim (#nim) |
16:50:35 | * | gokr joined #nim |
16:50:46 | * | gokr left #nim (#nim) |
16:53:37 | * | sampwing joined #nim |
16:59:36 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:09:09 | * | fizzbooze joined #nim |
17:13:22 | * | Jehan_ quit (Quit: Leaving) |
17:17:32 | * | gsingh93 joined #nim |
17:42:54 | * | CryptoToad joined #nim |
17:47:30 | * | shodan45 quit (Quit: Konversation terminated!) |
17:52:49 | EXetoC | Araq: so, two of these should not cause a collison? "newVarStmt(newIdentNode($genSym()), newIntLitNode(0))" |
17:56:27 | EXetoC | wait |
17:56:29 | * | fizzbooze quit (Ping timeout: 244 seconds) |
17:57:12 | EXetoC | getting more confused than usual. it's just difficult to figure out how to convert to the right type at times |
17:58:49 | EXetoC | I need to get myself a rubber duck already |
18:00:27 | * | Trustable quit (Remote host closed the connection) |
18:02:48 | BlaXpirit | even using this channel as a rubber duck can be useful for others if u write the solution |
18:10:28 | * | Sembei quit (Ping timeout: 256 seconds) |
18:11:57 | * | wink-s joined #nim |
18:12:58 | * | emilsp quit (Remote host closed the connection) |
18:15:48 | * | jholland joined #nim |
18:17:25 | wink-s | I created a module which makes a Table public I then tried to use the module printing out the public Table, I got an obscure error: "lib/system.nim(1952, 16) Error: undeclared identifier: 'data'" |
18:17:53 | * | buMPnet_ quit (Read error: Connection reset by peer) |
18:18:42 | * | buMPnet joined #nim |
18:18:56 | wink-s | Turns out the problem was I has to import Table as well as my module in the test app. That surprised me, is there a way have the user of a module automatically get the dependent modules imported? |
18:20:44 | EXetoC | export <module> |
18:20:49 | EXetoC | or a list of symbols from that module |
18:21:26 | EXetoC | it seems to be a rare thing to do. I don't know if this is a convention |
18:24:07 | flyx | how do I generate a "static:" section in a macro? |
18:24:34 | flyx | nnkStaticStmt seems to be something different |
18:24:38 | flyx | isn't it? |
18:25:16 | * | totz joined #nim |
18:25:40 | * | totz left #nim (#nim) |
18:25:55 | * | ghfdj joined #nim |
18:27:51 | * | ghfdj left #nim (#nim) |
18:28:56 | BlaXpirit | if i had to guess, the name indicates that it's exactly it |
18:29:20 | BlaXpirit | you seem to be forgetting that you can generate the tree for a piece of code and just see |
18:29:34 | EXetoC | yep |
18:30:20 | EXetoC | macro m(e: expr): stmt = echo e[0].kind |
18:30:28 | CryptoToad | Can anyone see how I'm being an idiot with function pointers? http://hastebin.com/kutemorile.pas |
18:30:38 | EXetoC | then you can do "m: static: echo 1" |
18:30:42 | BlaXpirit | no, i actually can't see |
18:30:55 | EXetoC | with some newlines and indents thrown in |
18:31:01 | BlaXpirit | anything in that lame pastebin |
18:31:05 | def- | CryptoToad: findFirstFileW()? |
18:31:54 | CryptoToad | lel i'll use real pastebin then. def- it just gives me another error sec |
18:32:01 | flyx | I tried with treeRepr, but it outputs a DiscardStmt |
18:32:04 | BlaXpirit | why dont you give the definition of findfirstfilew |
18:32:04 | EXetoC | though the output of treeRepr should be logical, but I thought I'd try that |
18:32:17 | EXetoC | flyx: huh |
18:32:32 | EXetoC | with that exact code? and how recent is your compiler build? |
18:33:15 | def- | flyx: works on the current devel branch |
18:34:06 | flyx | https://gist.github.com/flyx/40784d17c99f02e1dda1 |
18:34:19 | def- | flyx: nono, use dumpTree: |
18:34:24 | def- | flyx: or make the macro immediate |
18:34:28 | flyx | ah |
18:34:40 | def- | because the macro is probably invoked after the static block is done |
18:35:07 | EXetoC | works with expr |
18:35:25 | CryptoToad | http://pastebin.com/R45r5q9v when i use parernthesis, and when using the type it says in the error i get Error: type expected |
18:35:31 | flyx | okay, works now. I guess I need to make the macro creating the node also immediate then |
18:35:40 | EXetoC | ok. good to know |
18:35:49 | EXetoC | gotta grind these things |
18:36:00 | BlaXpirit | time to learn macros |
18:36:03 | BlaXpirit | any good resources? |
18:36:23 | flyx | trial & error |
18:36:39 | flyx | I wrote all my macros like that |
18:36:50 | def- | I started a macro tutorial, but never finished |
18:36:58 | wink-s | EXetoc: txs, using export worked! |
18:40:03 | def- | flyx: Here's 3 ways to do this: https://gist.github.com/def-/f3121f0d4c0e8a294b67 |
18:41:15 | EXetoC | always such trivial mistakes |
18:41:25 | EXetoC | Araq: nevermind |
18:42:52 | def- | CryptoToad: sorry, don't have windows to try this, but looks like no () after all if you want a procvar |
18:43:25 | def- | type fptrFF = proc(lpFileName: string, lpFindFileData: LPWIN32_FIND_DATA): THandle |
18:44:35 | EXetoC | there we go, simple forEach macro |
18:44:53 | EXetoC | no need for error handling, right? can't spoonfeed too much |
18:45:37 | EXetoC | forEach for userland iterators that is |
18:47:23 | * | fizzbooze joined #nim |
18:47:41 | CryptoToad | Error: ambiguous identifier: 'THandle' -- use a qualifier < this seems like a compiler bug? |
18:48:37 | CryptoToad | using nevermind that worked for that line |
18:49:54 | CryptoToad | Error: type mismatch: got (proc (WideCString, var TWIN32_FIND_DATA): THandle{.stdcall.}) but expected 'fptrFF' |
18:50:28 | CryptoToad | oh weird the args are different types |
18:52:45 | CryptoToad | May be easier to just do this part in C. |
18:54:55 | BlaXpirit | may be easier to give enough information for someone to help you |
18:55:00 | * | emilsp joined #nim |
18:55:38 | EXetoC | BlaXpirit: http://nim-by-example.github.io/oop_macro/ await in the standard lib, and so on |
18:55:43 | CryptoToad | it's literally 2 lines of code i'm having an issue with, not much else to it. I've sent everything that's causing problems. |
18:56:12 | EXetoC | result.repr, macros.dumpTree, macros.treeRepr, macros.lispRepr |
18:56:35 | EXetoC | CryptoToad: ok |
18:57:16 | flyx | hmm. there was a proc to generate a new unique identifier, right? I'm too dumb to find it |
18:57:46 | EXetoC | CryptoToad: there's newWideCString |
18:58:05 | EXetoC | wait |
18:59:08 | EXetoC | call the proc and you get a THandle |
18:59:31 | * | HakanD_________ quit (Ping timeout: 255 seconds) |
19:00:15 | CryptoToad | yes but i'm looking for a pointer to findFirstFile, all i found on nim func pointers was one quite old post here http://stackoverflow.com/questions/23479655/how-can-i-use-function-pointers-in-nimrod |
19:00:17 | EXetoC | string != WideCString, and T != "var T" |
19:00:40 | CryptoToad | the reason i got those is because it told me to use that type at first in another error lol |
19:02:25 | EXetoC | either it was misleading or it was unrelated |
19:03:12 | EXetoC | what about "type fptrFF = proc(WideCString, var LPWIN32_FIND_DATA)"? |
19:03:28 | EXetoC | * "type fptrFF = proc(WideCString, var LPWIN32_FIND_DATA): THandle |
19:04:43 | EXetoC | apparently the argument names cannot be omitted, so keep them |
19:06:19 | EXetoC | minimal proc type example: "type P = proc(int); proc p(x: int) = discard; var x: P = p" |
19:09:34 | CryptoToad | type fptrFF = proc(WideCString, var LPWIN32_FIND_DATA): THandle throws "Error: ')' expected" probably due to the "var" statement |
19:10:55 | EXetoC | CryptoToad: as I said previously, the argument names cannot be omitted, so add them back. I made a mistake there |
19:14:51 | CryptoToad | type fptrFF = proc(lpFileName: WideCString, var lpFindFileData: LPWIN32_FIND_DATA): THandle throws the ) expected error, and without it tells me it needs a var statement |
19:17:59 | EXetoC | CryptoToad: 'var' comes after ':' for parameters |
19:18:41 | CryptoToad | ahh that makes sense. Sorry to pollute this channel with all my noob lol. |
19:22:02 | * | HakanD_________ joined #nim |
19:22:04 | EXetoC | just don't do that in #nim-offtopic. there we talk about lolcats and stuff |
19:22:34 | * | ChrisMAN quit (Remote host closed the connection) |
19:23:37 | flyx | are there examples on how to use genSym? can I just replace ident nodes with a result of gensym? |
19:26:37 | EXetoC | here's one: newVarStmt(genSym(nskVar, "foo"), newIntLitNode(0)) |
19:27:40 | flyx | what does the second parameter do? |
19:27:57 | flyx | I mean, if I give it an ident, how can I assure that it's not used anywhere else? |
19:28:15 | EXetoC | no idea, but I left it at the default |
19:28:18 | EXetoC | flyx: yep |
19:33:42 | flyx | this gets me a segfault, not sure why: https://gist.github.com/flyx/ed2c724da28c273a795c |
19:34:01 | flyx | well actually, adding that to the result syntax tree of my macro does. |
19:43:05 | EXetoC | I don't know what the AST is supposed to be |
19:44:48 | flyx | well, usually there should be an ident where I put the sym |
19:45:08 | EXetoC | "dumpTree: type T = object of U" is that the AST you're after? |
19:45:19 | flyx | yes |
19:46:54 | EXetoC | dumpTree can help you figure out what to do. I think it needs to be the second child, but you're making it the first child |
19:48:16 | flyx | what would be the first child then? dumpTree gives the Ident T as first child |
19:48:51 | EXetoC | yes, that part is correct, but not the ObjectTy part |
19:49:17 | EXetoC | if you compare it with the output of objectInherit.repr |
19:51:07 | * | fizzbooze quit (Ping timeout: 265 seconds) |
19:51:42 | flyx | ah yes |
19:51:49 | flyx | when I add all the empty nodes, it works |
19:51:56 | flyx | I didn't think that would be necessary |
19:57:38 | EXetoC | I suppose the order could be arbitrary in some cases, except then it doesn't correspond to the order required in source code |
20:00:34 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
20:00:37 | * | sampwing quit (Ping timeout: 252 seconds) |
20:01:09 | * | bcinman joined #nim |
20:02:35 | * | fizzbooze joined #nim |
20:02:55 | * | sampwing joined #nim |
20:08:08 | * | jfchevrette quit (Ping timeout: 246 seconds) |
20:09:12 | * | milosn quit (Read error: Connection reset by peer) |
20:12:59 | * | milosn joined #nim |
20:13:11 | * | a5i quit (Quit: Connection closed for inactivity) |
20:18:23 | * | BlaXpirit_ joined #nim |
20:19:17 | * | reem joined #nim |
20:19:55 | * | Matthias247 joined #nim |
20:25:56 | BlaXpirit_ | there is some bug in aporia@#HEAD |
20:26:05 | BlaXpirit_ | Unable to determine what action to take for nim |
20:26:12 | BlaXpirit_ | because it has predefined name "nimrod" |
20:34:21 | BlaXpirit_ | i asked a long time ago "Is there a way to invoke a macro on an include?" |
20:34:31 | BlaXpirit_ | m: include f does NOT work |
20:37:48 | EXetoC | BlaXpirit_: it does seem to work |
20:38:14 | BlaXpirit_ | nnkIncludeStmt very nice |
20:38:27 | BlaXpirit_ | you mean it does seem to compile |
20:38:32 | EXetoC | dump it bra. check them outputz |
20:38:41 | BlaXpirit_ | well i did |
20:38:43 | BlaXpirit_ | nnkIncludeStmt |
20:38:58 | EXetoC | 2. write usable macro 3. ??????? 4. wealth |
20:39:34 | BlaXpirit_ | what are u talking about |
20:39:36 | BlaXpirit_ | if it's impossible |
20:40:01 | dom96 | EXetoC is right. I am bathing in gold after writing the async macro. |
20:40:08 | EXetoC | BlaXpirit_: what is? |
20:40:18 | BlaXpirit_ | invoke a macro on a file/include |
20:42:48 | BlaXpirit_ | ok something works |
20:42:52 | BlaXpirit_ | if macro is not immediate |
20:43:24 | BlaXpirit_ | gives nnkIncludeStmt then nnkStmtList |
20:43:41 | EXetoC | I was confused by that example of yours. you mean "m: <all code of a module>"? |
20:44:16 | fowl | dom96, that thing is a beast |
20:44:23 | BlaXpirit_ | that's basically what i want, EXetoC |
20:44:32 | dom96 | fowl: :) |
20:46:46 | fowl | flyx, empty nodes dont just show up in the ast because someone was sloppy, they are necessary, usually things like pragmas will take their place |
20:47:04 | BlaXpirit_ | yeah, looking great actually. just needed to not use immediate. thanks, fowl. |
20:47:19 | EXetoC | fowl: you never see my responses :p |
20:47:30 | fowl | i did |
20:47:35 | fowl | the order is never arbitrary |
20:49:28 | flyx | I'm slowly getting back into it |
20:49:29 | EXetoC | ok. I think you misread then, but that was all speculative |
20:51:31 | * | BlaXpirit-UA joined #nim |
20:53:15 | * | brson joined #nim |
20:55:15 | * | sampwing quit (Ping timeout: 252 seconds) |
20:55:37 | * | BlaXpirit_ quit (Ping timeout: 264 seconds) |
20:55:45 | * | reem quit (Remote host closed the connection) |
20:56:06 | * | BlaXpirit-UA quit (Client Quit) |
20:56:25 | * | BlaXpirit_ joined #nim |
20:57:03 | BlaXpirit_ | something isn't right though |
20:57:04 | * | mpthrapp quit (Remote host closed the connection) |
20:57:28 | BlaXpirit_ | procs in the macro-ed include lose their asterisk |
21:00:16 | * | reem joined #nim |
21:01:55 | * | BlaXpirit_ quit (Quit: Quit Konversation) |
21:04:01 | * | wink-s quit (Ping timeout: 246 seconds) |
21:06:15 | * | sampwing joined #nim |
21:06:49 | dom96 | BlaXpirit: That aporia bug is fixed in the new-suggest branch |
21:11:04 | BlaXpirit | yeah, guys, this non-immediate macro messes everything up |
21:11:33 | BlaXpirit | somemacro: include x is definitely not the same as somemacro: <paste contents of x.nim here> |
21:11:48 | BlaXpirit | first of all, it requires the macro to be not immediate |
21:12:00 | BlaXpirit | so the node tree is subject to transformations |
21:12:15 | BlaXpirit | and it's pretty much too messed up at that point to do anything |
21:12:21 | BlaXpirit | asterisks are lost |
21:12:27 | BlaXpirit | multiple procs with the same name are lost |
21:12:38 | fowl | gl with that |
21:12:56 | BlaXpirit | well it's pretty much impossible |
21:13:08 | BlaXpirit | to achieve somemacro: <paste contents of x.nim here> |
21:13:50 | * | NimBot joined #nim |
21:14:07 | dom96 | someMacro(parseStmt(slurp(file))) |
21:14:19 | * | Mimbus joined #nim |
21:14:37 | BlaXpirit | well yeah |
21:14:53 | BlaXpirit | but then there is the problem of achieving the semantics of include's path lookup |
21:16:58 | fowl | if the postfix *s werent removed what would be the issue BlaXpirit |
21:17:29 | BlaXpirit | transform(parseStmt(slurp("common.nim"))) i'm getting Call Sym "parseStmt" etc |
21:19:45 | fowl | fr |
21:20:07 | fowl | macro incl (module:string): stmt = |
21:20:07 | fowl | result = parseStmt(slurp(module.strval)) |
21:21:11 | BlaXpirit | fowl, it works! thanks |
21:21:52 | fowl | i cant condone what you're doing though |
21:22:18 | * | fizzbooze quit (Ping timeout: 272 seconds) |
21:22:34 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
21:22:58 | BlaXpirit | create https://github.com/BlaXpirit/nim-random/blob/master/src/random.nim#L53 based on https://github.com/BlaXpirit/nim-random/blob/master/src/random/common.nim#L68 |
21:23:19 | * | bcinman joined #nim |
21:24:09 | BlaXpirit | wow, i think duplicate/overloaded procs are lost here |
21:25:30 | fowl | thisi s the module i tested on and both foos came through http://pastebin.com/Wy4QLrWS |
21:29:08 | BlaXpirit | omg |
21:29:16 | BlaXpirit | it was grabbing the old version of my lib |
21:29:19 | BlaXpirit | sorry |
21:29:34 | BlaXpirit | so does slurp actually have the semantics of include? |
21:29:48 | BlaXpirit | it slurped the file in ~/.nimble whatever |
21:30:35 | fowl | i doubt it |
21:30:48 | fowl | its not intended to read modules from the include path |
21:31:10 | BlaXpirit | dude i'm telling you |
21:31:21 | BlaXpirit | i'm in my home dir |
21:31:35 | BlaXpirit | nim i slurp("random/common.nim") |
21:32:13 | BlaXpirit | heck, slurp("intsets.nim") |
21:32:15 | BlaXpirit | try it out |
21:32:30 | BlaXpirit | .eval echo slurp("intsets.nim") |
21:32:31 | Mimbus | BlaXpirit: eval.nim(3, 10) Error: 'slurp' can only be used in compile-time context |
21:32:41 | fowl | lol wtf |
21:32:53 | fowl | thats useful |
21:33:55 | EXetoC | .eval static:; echo slurp("intsets.nim") |
21:33:56 | Mimbus | EXetoC: eval.nim(4, 4) Error: invalid indentation |
21:33:58 | fowl | yea i can slurp any module installed by nimble |
21:34:02 | EXetoC | .eval static:; echo slurp("intsets.nim") |
21:34:03 | Mimbus | EXetoC: # |
21:34:03 | * | Mimbus quit (Excess Flood) |
21:34:09 | * | Mimbus joined #nim |
21:34:27 | fowl | .eval import strutils; echo '\L'.repeat(42) |
21:34:29 | Mimbus | fowl: |
21:34:47 | BlaXpirit | .eval const x = slurp("intsets.nim"); echo x[4..x.high] |
21:34:48 | Mimbus | BlaXpirit: # Nim's Runtime Library |
21:34:48 | * | Mimbus quit (Excess Flood) |
21:34:54 | * | Mimbus joined #nim |
21:35:22 | fowl | BlaXpirit, i know what this is for |
21:35:42 | fowl | its so that a module can slurp something from its own dir |
21:35:52 | BlaXpirit | well yeah |
21:36:00 | BlaXpirit | i knew that |
21:36:07 | BlaXpirit | but this craziness |
21:38:12 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:39:12 | * | reem quit (Remote host closed the connection) |
21:40:21 | * | jfchevrette joined #nim |
21:41:30 | * | jfchevrette quit (Client Quit) |
21:41:49 | * | reem joined #nim |
21:43:04 | * | wink-s joined #nim |
21:46:27 | * | pregressive quit (Remote host closed the connection) |
21:49:04 | * | reem quit (Remote host closed the connection) |
21:50:07 | EXetoC | BlaXpirit: use it wisely |
21:50:24 | * | reem joined #nim |
21:50:30 | EXetoC | it's much more convenient than any other approach? |
21:51:30 | wink-s | I see references to ".eval blah ..." is this short and for executing "nim i" (interactive mode) or is it something else? |
21:51:59 | fowl | wink-s, no it gets compiled and ran |
21:52:24 | fowl | "nim i" would be spitting out errors and not work for anything useful |
21:52:42 | BlaXpirit | "; "->"\n" and compile |
21:52:55 | EXetoC | in a secure sandbox, but try to break it if you want ;) |
21:53:07 | BlaXpirit | i dont think it's secure |
21:53:42 | EXetoC | break it then :p |
21:53:46 | EXetoC | "; " -> "\n " |
21:54:57 | flaviu | BlaXpirit: ask google for a 10 thousand dollar bounty if you break it. |
21:55:07 | wink-s | ok, so it just means take the code following the .eval put it in a file and compile with "nim c" ? |
21:55:08 | BlaXpirit | oh ok |
21:55:19 | BlaXpirit | pretty much |
21:55:21 | EXetoC | .eval echo"yo" |
21:55:22 | Mimbus | EXetoC: yo |
21:55:30 | flaviu | It's linux accounts, pretty much all shared hosting depends on it being safe. |
21:56:42 | flaviu | wink-s: There are a couple extra imports, but yep. |
21:57:56 | reactormonk | lib/system.nim(143, 40) Warning: unknown magic 'Addr' might crash the compiler [UnknownMagic] |
21:57:59 | reactormonk | O.o? |
21:58:56 | BlaXpirit | reactormonk, fixed already |
21:59:11 | BlaXpirit | wait |
21:59:19 | BlaXpirit | no it's not, i'm confusing something |
21:59:44 | BlaXpirit | but i got it when i compiled nim without compiling koch or something |
22:00:34 | EXetoC | yes just update everything |
22:00:39 | BlaXpirit | scratch all that. what i should've said: |
22:00:48 | BlaXpirit | I had this error today but don't seem to get it anymore after i recompiled properly |
22:00:55 | EXetoC | reactormonk: more language features as procs \o/ |
22:01:17 | reactormonk | EXetoC, sweet |
22:03:31 | * | wink-s quit (Ping timeout: 246 seconds) |
22:04:32 | reactormonk | I'm tinkering on merge for CountTable https://gist.github.com/reactormonk/3ea31e6a5e03195ce294 I get Error: type mismatch: got (CountTable[system.string], CountTableRef[system.string]) |
22:05:24 | BlaXpirit | well dude |
22:05:28 | BlaXpirit | s[].merge(t[]) |
22:05:36 | BlaXpirit | reactormonk^ |
22:05:51 | reactormonk | BlaXpirit, nope, I want double CountTableRef |
22:06:23 | BlaXpirit | k |
22:06:58 | reactormonk | wtf did I get CountTable and not CountTableRef there? |
22:08:04 | reactormonk | BlaXpirit, oh, fuck. you're right. |
22:08:10 | BlaXpirit | k |
22:08:25 | fowl | lol thats what merge() does already |
22:09:25 | reactormonk | fowl, didn't see it, somwhere else? |
22:09:28 | * | reem quit (Remote host closed the connection) |
22:09:39 | fowl | ln 991 |
22:09:44 | EXetoC | can the user be notified of unused vars in macros? |
22:09:48 | * | zahary1 quit (Ping timeout: 272 seconds) |
22:10:17 | reactormonk | fowl, hm, not sure about var semantics |
22:10:27 | reactormonk | does a ref convert to a var? |
22:10:43 | fowl | yea |
22:10:46 | reactormonk | nope |
22:10:48 | fowl | that line should be a[].merge(b[]) |
22:10:55 | fowl | er s[].merge(t[]) |
22:10:56 | reactormonk | yeah, fixed it |
22:12:30 | * | reem joined #nim |
22:13:13 | reactormonk | Error: ambiguous call; both tables.merge(s: var CountTable[merge.A], t: CountTable[merge.A]) and tables.merge(s: CountTable[merge.A], t: CountTable[merge.A]) match for: (CountTable[system.string], CountTable[system.string]) |
22:13:15 | reactormonk | aww |
22:13:23 | reactormonk | so I can't overload based on var? |
22:13:42 | BlaXpirit | you can |
22:14:00 | BlaXpirit | reactormonk, http://blaxpirit.com/blog/7/interesting-proc-overloads-with-parameter-constraints-in-nim.html#overloading-on-var |
22:14:20 | * | Trustable joined #nim |
22:14:54 | def- | but still not on return type unfortunately |
22:15:03 | fowl | ah {lvalue} smart |
22:15:16 | BlaXpirit | obviously i didnt come up with this myself :| |
22:15:19 | EXetoC | you think foo.bar() should be able to expand to foo[].bar()? I think people would get annoyed by allocation-agnosticity otherwise |
22:15:23 | reactormonk | def-, yeah, but that would make type inference interesting |
22:15:26 | def- | i don't think you need the lvalue anymore |
22:15:33 | EXetoC | unless of course multiple overloads are defined, but that's clearly a waste |
22:15:35 | def- | at least i did it without lvalue and it worked |
22:15:53 | BlaXpirit | i thought it was recently added, too |
22:16:22 | EXetoC | I don't bother with ptr/ref parameters |
22:16:26 | fowl | it was a couple weeks ago iirc |
22:17:25 | EXetoC | fowl: did you want to make a game with me before? |
22:17:33 | EXetoC | it'd be nice to try urhonimo |
22:17:44 | reactormonk | I've never heard of parameter contraints before O.o |
22:17:58 | EXetoC | what? |
22:17:59 | * | reem quit (Remote host closed the connection) |
22:18:21 | fowl | yea EXetoC but i dont have any ideas :< |
22:18:28 | reactormonk | I might have skimmed over them but I don't remember them |
22:18:47 | fowl | urho is nice, networking and physics are really easy to do |
22:19:02 | EXetoC | reactormonk: what do you mean? "x: int" is a constraint, isn't it? |
22:19:22 | reactormonk | EXetoC, this part: http://nim-lang.org/manual.html#parameter-constraints |
22:19:38 | EXetoC | right ok |
22:20:24 | * | fizzbooze joined #nim |
22:20:31 | def- | I've only seen them used with tr macros |
22:20:50 | EXetoC | fowl: physics from scratch? |
22:21:20 | BlaXpirit | i don't understand what I can do with nnkCommentStmt |
22:21:33 | BlaXpirit | i can't divine any of its fields |
22:21:34 | reactormonk | What's an `lvalue` exactly? |
22:21:51 | BlaXpirit | something that can be assigned to |
22:22:04 | BlaXpirit | mitems gives lvalues |
22:22:33 | reactormonk | neat |
22:22:55 | * | reem joined #nim |
22:23:36 | BlaXpirit | nnkCommentStmt node doesn't have string value, doesn't have children |
22:23:41 | BlaXpirit | so what are u supposed to do with it |
22:24:32 | def- | BlaXpirit: nothing probably, i guess it's just used by the compiler internally and a remnant of comments belonging to the AST |
22:24:57 | BlaXpirit | so u cant access a comment in macros????? |
22:25:08 | BlaXpirit | and, worse, can't write comments in macros |
22:25:30 | BlaXpirit | because how awesome would it be if nim doc could read comments from procs made by macros |
22:25:42 | def- | yes, that would be nice |
22:25:52 | def- | Go ahead and work on the compiler I guess! |
22:26:32 | BlaXpirit | nope nope nope |
22:26:38 | reactormonk | BlaXpirit, it's not hard |
22:26:41 | def- | Maybe this has something you need: https://github.com/jboy/nim-docstrings |
22:26:45 | reactormonk | I'm a nim scrub and I still can do it :-) |
22:27:11 | EXetoC | indenting comments isn't really a big deal... |
22:27:51 | EXetoC | there were some annoying issues though, but couldn't those be fixed? "# enummember," for example |
22:28:11 | reactormonk | BlaXpirit, I'd say you have to add a field to nnkCommentStmt and modify the parser to fill it - take a look at nim doc and how it grabs the docstrings |
22:28:17 | EXetoC | def-: so, make them part of the AST again? or something else? |
22:29:11 | def- | EXetoC: at least make them optionally part of the AST, maybe |
22:29:12 | * | gokr joined #nim |
22:29:15 | BlaXpirit | comments are not part of ast, i dont think |
22:29:17 | EXetoC | time for forum discussion? |
22:29:20 | BlaXpirit | these are doc comments |
22:29:27 | BlaXpirit | i cant get doc comments in macros |
22:29:31 | BlaXpirit | outrageous |
22:29:48 | EXetoC | right. just having doc comments in the AST might be good enough |
22:31:10 | reactormonk | just patch them in there and see what araq says in the PR |
22:33:04 | reactormonk | dundundidun my laptop is slow -.- |
22:34:41 | reactormonk | BlaXpirit, fixed, no need for the lvalue hack anymore |
22:34:48 | BlaXpirit | ok |
22:41:24 | def- | the ARM Nim buildbots are pretty slow, 10 hours to run the tests |
22:41:44 | gokr | So just got back home from doing a talk on Nim |
22:41:49 | reactormonk | uh-oh |
22:41:49 | gokr | Think it went well. |
22:41:50 | def- | They're basically running tests all day, every day: http://buildbot.nim-lang.org/waterfall |
22:41:55 | reactormonk | gokr, got video? |
22:41:56 | def- | gokr: nice! |
22:42:08 | gokr | No, it wasn't taped - and it was in swedish. But I do have the slides :) |
22:42:12 | EXetoC | fowl: pitch: the player controls a due who can shoot differently coloured projectiles which bounce as long as they don't hit an obstacle that destroys said bullet type, and collisions involving other combinations will alter the world in certain ways |
22:42:23 | EXetoC | sounds awesome, yeah? |
22:42:30 | def- | gokr: slides please! |
22:42:44 | def- | They're trying to delete the Nim wiki article again, need more sources! |
22:42:58 | BlaXpirit | :s |
22:43:21 | gokr | def-: Ok, our company just made a press release |
22:45:02 | gokr | http://3dicc.com/terf-news/2015/3/25/terf-rendering-power-upgrade-announced |
22:45:02 | gokr | Not sure if that qualifies as a source - since we also hired Andreas ;) |
22:45:02 | EXetoC | oh |
22:45:13 | BlaXpirit | lol who would've thought there could be a downside |
22:45:17 | EXetoC | A nim related job would be great |
22:45:21 | BlaXpirit | but nobody's gonna know |
22:46:14 | gokr | BlaXpirit: But it says so in the press release ;) |
22:48:16 | reactormonk | gokr, should do |
22:48:28 | gokr | http://files.krampe.se/3dicc-nim-2015.odp |
22:49:10 | gokr | So... I also did a lot of code snippets in Aporia - so... that's not on the slides. |
22:49:47 | reactormonk | BlaXpirit, most important tool for hacking the compiler: ./koch temp |
22:50:05 | reactormonk | and a fast computer -.- |
22:51:47 | EXetoC | I thought it could be sped up |
22:52:21 | reactormonk | gokr, the python syntax from nim is more due to accident IIRC - initially it was planned to be agnostic to that one too, so you could go algol. The python one was hardest to implement, so he went for that one first. And then didn't get to do the others ^^ |
22:52:33 | * | Trustable quit (Quit: Leaving) |
22:52:35 | gokr | Ha! |
22:52:39 | EXetoC | libreoffice choked on it after some time -.- |
22:52:44 | gokr | Really? |
22:52:49 | EXetoC | there we go |
22:52:54 | gokr | There is an mp4 movie in it. |
22:53:02 | gokr | That shows a bit of what we do. |
22:53:23 | fowl | EXetoC, 2d or 3d |
22:53:32 | gokr | Not sure the slides are that easy to follow - since I interleaved with quite a lot of silly snippets in Aporia |
22:53:32 | reactormonk | gokr, just to add some trivia :-) |
22:53:40 | gokr | reactormonk: Yeah, great! |
22:53:58 | reactormonk | gokr, you could ask him how true that one is :-) |
22:54:22 | gokr | I am probably going to follow up with a blog article, was quite a few "loose ends" I missed that would be nice to mention/explain. |
22:55:29 | EXetoC | fowl: might as well go with 3d. I assume it won't be difficult with that engine |
22:55:58 | fowl | gokr, hey the tuple macro you're referring to takes an array with any indices (-2..2 for ex) and generates an expression to index it correctly into a tuple (obj[-2], obj[-1], ..) |
22:56:14 | fowl | and it is here http://forum.nim-lang.org/t/1044 |
22:56:16 | gokr | Ah! That was it |
22:56:33 | reactormonk | https://gist.github.com/6dc8bfd3d41afc9ef851 should run everything at compiletime, correct? |
22:56:47 | dom96 | def-: nooo, not again :( |
22:57:03 | gokr | Hehe https://twitter.com/wgren/status/580799666910031873 |
22:57:05 | def- | dom96: your fault for putting the old text back! |
22:57:29 | def- | (if you hadn't done that, we would get deleted for being a stub instead) |
22:57:31 | BlaXpirit | omg i did it |
22:57:42 | BlaXpirit | what i wrote 1.5 hours ago [:22:57] |
22:58:22 | reactormonk | BlaXpirit, I think I missed out |
22:58:39 | BlaXpirit | create https://github.com/BlaXpirit/nim-random/blob/master/src/random.nim#L53 based on https://github.com/BlaXpirit/nim-random/blob/master/src/random/common.nim#L68 using macros |
22:58:56 | fowl | reactormonk, ugh i had that working then i lost the tab |
22:59:17 | reactormonk | fowl, "that"? |
22:59:25 | fowl | your code |
22:59:35 | reactormonk | fowl, don't bother |
22:59:41 | EXetoC | fowl: then sell it and get rich? |
22:59:54 | reactormonk | fowl, https://github.com/Araq/Nim/pull/2411/files |
22:59:55 | dom96 | def-: :( |
23:00:41 | * | reem quit (Remote host closed the connection) |
23:00:55 | def- | dom96: maybe the 3dicc press release can save us |
23:00:58 | reactormonk | an immediate macro should be executed at compile time, correct? |
23:01:14 | def- | reactormonk: all macros are executed at compile time I hope |
23:01:44 | fowl | reactormonk, immediate just lets you use symbols in the arguments that arent defined yet |
23:02:02 | fowl | so it runs before overload resolution, you can't get symbols in an immediate macro, only idents |
23:03:40 | reactormonk | def-, then why the fuck does https://github.com/reactormonk/nim/blob/tablesandmacros/tests/macros/ttableandmacros.nim generate an error in the ccgexprs.nim |
23:03:54 | * | reem joined #nim |
23:04:05 | reactormonk | fowl, got me an example for the difference? |
23:04:09 | def- | reactormonk: doesn't for me |
23:04:10 | EXetoC | ICE? |
23:04:16 | fowl | lib/pure/collections/tables.nim(786, 21) Error: cannot generate code for '==' |
23:04:24 | reactormonk | fowl, exactly. |
23:04:37 | reactormonk | EXetoC, ICE? |
23:05:06 | fowl | probably because there is no `==` for nimnode |
23:05:59 | reactormonk | fowl, hm. strange. I tried your new `==`, didn't help |
23:06:40 | EXetoC | "(system.not|system.not|system.not|system.not|system.not|system.not|...) :tmp.advance:" ah yes, that again :-) |
23:07:05 | fowl | i got an interesting error when i defined == lol |
23:08:19 | reactormonk | fowl, let's see |
23:08:53 | fowl | no wait it did work but then failed at linking |
23:08:58 | dhasenan_ | When I realized that all parameters in Nim are named parameters: http://media0.giphy.com/media/vSSdLSLbGIXio/200_s.gif |
23:09:10 | reactormonk | Error: unhandled exception: false Invalid node kind nnkIntLit for macros.`$` |
23:09:24 | fowl | change that to repr reactormonk |
23:10:00 | reactormonk | fowl, yup, works now |
23:11:26 | dom96 | def-: let me know if you contest the speedy deletion |
23:11:29 | dom96 | def-: and I will back you |
23:11:32 | EXetoC | reminder of the day: #!strongSpaces |
23:11:57 | def- | dom96: not planning anything |
23:11:58 | reactormonk | fowl, well, == is defined for NimNode in lib/core/macros.nim |
23:12:25 | fowl | reactormonk, yea i cant get this to work |
23:12:41 | dom96 | def-: why not? Are you just going to let it be deleted? |
23:12:45 | fowl | what are you trying to do though? i have before built a table[string,nimnode] and stored ast in it |
23:13:02 | def- | dom96: I have no experience with Wikipedia stuff, don't know how this works |
23:13:57 | reactormonk | fowl, found it |
23:14:11 | reactormonk | fowl, https://github.com/Araq/Nim/issues/1679 |
23:14:56 | * | CryptoToad quit (Read error: Connection reset by peer) |
23:15:04 | fowl | dom96, i'll make a comment |
23:15:09 | reactormonk | fowl, well, why to fuck do the macro instructions end up in ccgexprs |
23:15:28 | reactormonk | something went wrong somewhere |
23:15:29 | dom96 | i'll contest it as well |
23:15:46 | fowl | how do you link to an article in wiki markup |
23:16:39 | dom96 | fowl: click the little chain in the editor and it will do it for you :) |
23:17:00 | fowl | ah |
23:17:13 | fowl | what other programming languages have pages but no references, i only know of ooc |
23:17:35 | dom96 | That won't work as an excuse |
23:17:51 | dom96 | https://en.wikipedia.org/wiki/Wikipedia:Other_stuff_exists |
23:17:56 | fowl | in that case i'm marking them all for deletion |
23:18:08 | fowl | nvm i dont know how to do that |
23:18:10 | def- | fowl: don't do that please |
23:18:49 | def- | I prefer this excuse: https://en.wikipedia.org/wiki/Wikipedia:Ignore_all_rules |
23:18:51 | fowl | dom96, its not that they exist, its that they exist without references |
23:19:33 | def- | dom96: it's known that async/await with try-except fails with a 50k line stack trace? |
23:19:45 | * | reem quit (Remote host closed the connection) |
23:20:05 | dom96 | def-: there are some try-except async/await bugs left in there. But I haven't seen such a huge stack trace :O |
23:21:21 | def- | dom96: https://github.com/Araq/Nim/issues/2412 |
23:21:44 | * | reem joined #nim |
23:21:57 | dom96 | def-: ahh, they are omitted thankfully :P |
23:23:44 | * | reem quit (Remote host closed the connection) |
23:24:48 | reactormonk | in the compiler, macros are execute before or with the cgen? |
23:25:49 | dom96 | likely before |
23:27:06 | reactormonk | ok |
23:27:16 | fowl | so how do i request an article be deleted |
23:27:38 | fowl | we should try to get rid of these unnoteworthy programming languages which only link to their website |
23:28:09 | * | reem joined #nim |
23:28:53 | reactormonk | fowl, >:) |
23:29:16 | def- | fowl: hurting other languages doesn't help us |
23:29:31 | reactormonk | fowl, yeah, go for that spree after we got ours |
23:29:35 | fowl | def-, how is it hurting other languages? its helping wikipedia |
23:29:36 | * | reem quit (Remote host closed the connection) |
23:30:29 | fowl | how burdenous they are to be taking up bytes for their project which by wikipedias standards does not exist until other people talk about it |
23:31:07 | fowl | maybe if we clean up wikipedia jimbo whales will stop begging for donations |
23:31:39 | flaviu | fowl: Being an ass won't solve anything. |
23:35:35 | EXetoC | is it possible to get an ident from a sym? |
23:36:55 | BlaXpirit | newIdentNode($sym) |
23:36:58 | BlaXpirit | is my guess |
23:39:46 | reactormonk | should you be able to use NimNode instances at runtime? |
23:40:02 | EXetoC | I'm trying to use it in a template and I want to pass that template to getAst, but then I get "undeclared identifier: tmp" |
23:41:11 | EXetoC | reactormonk: I don't know, but it seems pointless |
23:41:50 | reactormonk | EXetoC, hmm, I see your point |
23:42:43 | EXetoC | I think I tried to create nodes outside a macro, and I got an ICE (Internal Compiler Error) |
23:44:27 | reactormonk | anyone knows where macro processing starts in the compiler? |
23:45:21 | dom96 | In relation to WP: I will contest it with gokr's article. |
23:46:15 | gokr | dom96: What about nimio.us - isn't that also a legal entity using Nim? |
23:46:34 | gokr | And feel free to point to 3dicc.com and the press release etc. |
23:46:37 | dom96 | oh wow, cool. |
23:46:40 | dom96 | Didn't see that site yet. |
23:46:48 | gokr | Its gmpreussner|work :) |
23:47:03 | gokr | Ok, now really time to sleep, cya |
23:47:05 | reactormonk | hm, so it never actually gets there :-( |
23:48:26 | dom96 | gmpreussner|work: nice work :) |
23:49:38 | * | reem joined #nim |
23:52:06 | dom96 | really wish I could play with those gadgets |
23:53:28 | BlaXpirit | how to do {.hint[Deprecated]: off.} |
23:53:42 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:54:54 | BlaXpirit | actually is {.warning[Deprecated]: off.} |
23:57:04 | Araq | reactormonk: entry point is in sem.nim iirc, but it all ends up in the VM |
23:57:11 | def- | Welcome back, Araq |
23:57:27 | Araq | it's refreshing to take a break from #nim :P |
23:57:28 | reactormonk | Araq, thanks. I'm trying to debug https://github.com/Araq/Nim/issues/1679 |
23:57:43 | * | TEttinger joined #nim |
23:58:06 | reactormonk | somehow the tables don't end up in the vm |
23:58:57 | BlaXpirit | LOL macros https://github.com/BlaXpirit/nim-random/commit/d745045d7a15dee58f980afa494fdf5d0675340c |