00:01:34 | * | couven92 quit (Read error: Connection reset by peer) |
00:03:44 | * | theelous3 quit (Ping timeout: 272 seconds) |
00:09:26 | * | rnrwashere joined #nim |
00:11:58 | * | rnrwashere quit (Client Quit) |
00:28:21 | * | rnrwashere joined #nim |
00:28:46 | * | rnrwashere quit (Client Quit) |
00:32:19 | * | jasper quit (Quit: Page closed) |
00:35:37 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
00:37:28 | * | laaron joined #nim |
00:39:24 | * | theelous3 joined #nim |
01:04:32 | * | theelous3 quit (Ping timeout: 272 seconds) |
01:15:19 | * | oculux quit (Ping timeout: 244 seconds) |
01:22:47 | * | laaron quit (Remote host closed the connection) |
01:24:25 | * | laaron joined #nim |
01:27:36 | * | rnrwashere joined #nim |
01:29:30 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
01:30:59 | * | oculux joined #nim |
01:33:15 | * | laaron joined #nim |
01:37:54 | * | laaron quit (Remote host closed the connection) |
01:39:36 | * | laaron joined #nim |
01:48:07 | * | kapilp joined #nim |
01:49:27 | * | laaron quit (Remote host closed the connection) |
01:51:47 | * | laaron joined #nim |
02:02:05 | * | banc quit (Quit: Bye) |
02:04:01 | * | oculuxe joined #nim |
02:05:20 | * | oculux quit (Ping timeout: 272 seconds) |
02:19:19 | * | laaron quit (Remote host closed the connection) |
02:21:50 | * | laaron joined #nim |
02:21:57 | skrylar[m] | i kinda got used to crappy c code for so long that i forgot python and friends had custom iterators |
02:22:14 | skrylar[m] | have been dealing with freepascal (has enumerators, a bit clunk) and was sitting here like wait i can just make an iterator for this |
02:22:17 | skrylar[m] | :d |
02:23:23 | * | banc joined #nim |
02:35:08 | * | aranhaagency joined #nim |
02:38:13 | aranhaagency | \join #mozilla |
02:49:10 | * | neceve quit (Remote host closed the connection) |
02:58:56 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
02:59:35 | * | laaron joined #nim |
03:04:26 | * | rnrwashere quit (Remote host closed the connection) |
03:36:27 | * | jasper joined #nim |
03:44:38 | * | vlad1777d quit (Ping timeout: 245 seconds) |
03:56:20 | FromGitter | <Varriount> Zevv: Ok, your library is *amazing* |
04:01:38 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
04:02:17 | * | laaron joined #nim |
04:10:58 | skrylar[m] | woo. pure-nim bmessage encoding |
04:12:09 | leorize | Araq: do you want to get the js backend tested on travis? |
04:25:30 | skrylar[m] | kind of wonder how offensive this encoding format is |
04:25:32 | Zevv | varriount: sweet, got something working I asssume? |
04:27:01 | skrylar[m] | its basically forth-esque.. a single seq of bytes that gets stretched to hold the packet, it just kinda shoves the headers+keys in to one big blob and then has internal pointers to navigate around. downside is there's a pointer for each field but you can build it in random order without a lot of shuffling :think |
04:27:21 | skrylar[m] | can probably trim it a little by forcing 32-bit ointers because you're not going to have messages that big |
04:39:01 | Zevv | until someone does :) |
04:39:25 | skrylar[m] | its possible |
04:39:29 | Zevv | varints |
04:39:40 | skrylar[m] | most broker systems choke long before megabyte messages |
04:40:27 | Zevv | fcourse |
04:41:01 | skrylar[m] | i was originally going to use varints, and had this little format written down in a doc, but when i sat down to write it ... i basically just ended up with a forth/flatbuffer hybrid, which allows random-writing. the overhead is slightly unfortunate though |
04:41:07 | * | arecaceae quit (Remote host closed the connection) |
04:41:26 | * | arecaceae joined #nim |
04:41:31 | Zevv | don't optimize if you dont need to. |
04:41:41 | Zevv | Do you use pointers or just indexes? |
04:42:03 | skrylar[m] | indexes, kind of |
04:42:17 | skrylar[m] | they are soft pointers in that they are indeed pointers, but they are relative to the buffer start |
04:43:00 | skrylar[m] | it would not be unreasonable to set them at 16-bit |
04:43:23 | Zevv | 65k is not that much |
04:43:35 | skrylar[m] | how much data are you shuttling about a button press |
04:44:19 | Zevv | wait until someone connects a cam to see who pressed the button |
04:45:16 | skrylar[m] | under be/haiku that is addressed by making a clipboard or a media node that handled it and sending a message telling the recipient which clipboard to use |
04:45:25 | skrylar[m] | (which also appears to be how nats/nsq/rabbit get used) |
04:50:56 | skrylar[m] | there is another model i could use that i almost went with where it doesn't have the pointers but if you try to append to an array that was already encoded it has to shuffle the buffer around to make room |
04:51:14 | skrylar[m] | which as long as your messages arent constructed in a pathological way works |
05:00:55 | * | Snircle_ quit (Quit: Textual IRC Client: www.textualapp.com) |
05:05:57 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
05:06:58 | * | laaron joined #nim |
05:07:28 | * | jasper quit (Quit: Page closed) |
05:13:48 | * | aranhaagency quit (Ping timeout: 258 seconds) |
05:16:43 | * | narimiran joined #nim |
05:58:44 | * | solitudesf joined #nim |
06:12:20 | FromGitter | <Varriount> Zevv: Somewhat |
06:13:48 | FromGitter | <Varriount> Zevv: https://gist.github.com/Varriount/103aec43b11e1689fef41fceb8c7187c |
06:15:00 | FromGitter | <Varriount> Zevv: I'm going to develop better string patterns (supporting escapes, single quotes, etc). |
06:16:03 | FromGitter | <Varriount> My problem ATM is finding an alternative to non-greedy STRING_CHARS |
06:17:23 | * | nsf joined #nim |
06:18:21 | Zevv | what's your problem here - you want to match anything up to the ", right? |
06:22:07 | FromGitter | <Varriount> Zevv: the STRING_DATA pattern captures the `$` in `"data${sub}"` |
06:22:15 | FromGitter | <Varriount> And continues |
06:22:21 | Zevv | well, yes :) |
06:24:39 | Zevv | move the '+' repeat one level up |
06:25:37 | Zevv | so instead of +STRING_CHARS, do +(COMMAND_SUB | VARIABLE_SUB | STRING_CHAR) |
06:27:10 | Zevv | and your WORD_CHAR is too trigger happy, it will eat the trailing ')' |
06:27:49 | Zevv | http://p.zevv.nl/?9c42 this works for your sample input |
06:28:48 | * | sealmove joined #nim |
06:29:56 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
06:30:28 | sealmove | Good morning. I wonder if ref counting is implemented yet, because the 4th example from https://nim-lang.org/araq/ownedrefs.html compiles normally, but I think it should exit with error. |
06:31:26 | * | laaron joined #nim |
06:31:51 | FromGitter | <Varriount> Zevv: I would have preferred that STRING_CHAR be composed of more than one character, but I guess this works |
06:32:38 | Zevv | well, you can make that work, but then you'd have to exlude the $ |
06:32:47 | Zevv | and allow it to be put in escaped |
06:33:57 | Zevv | ~look at the json example for escaping |
06:38:05 | Zevv | http://p.zevv.nl/?3069 without escaping, /me is away now |
06:38:32 | * | solitudesf quit (Ping timeout: 268 seconds) |
06:39:02 | Zevv | and about your redirect syms: take care that ">" will match before ">>", so keep an eye on the ordering |
06:47:09 | leorize | sealmove: it's implemented |
06:47:14 | leorize | you should file a bug report |
06:51:13 | sealmove | but... this is kind of the most simplistic example |
06:54:15 | leorize | doesn't mean Araq remembers to implement it :p |
06:58:19 | sealmove | hum, maybe we should better try to document what works and what doesn't, instead of filing "bugs". |
06:59:58 | leorize | bugs are bugs |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:00:15 | leorize | before I filed a few of them, you can easily return owned pointer as unowned |
07:01:21 | sealmove | first of all, how do you "dispose" currently? `= nil` doesn't work for `let` variables, lol |
07:01:32 | sealmove | and `dispose()` is not defined |
07:02:30 | leorize | sealmove: https://github.com/nim-lang/Nim/blob/3e0fac7c20c624ba69ecff615af6bc6a78dcaeec/lib/system.nim#L1671 |
07:02:42 | sealmove | oh.. |
07:03:02 | leorize | and yea it doesn't work for let atm :p |
07:04:38 | * | gmpreussner joined #nim |
07:45:19 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
07:47:30 | * | laaron joined #nim |
07:58:29 | * | stefanos82 joined #nim |
08:02:32 | * | hoijui joined #nim |
08:10:25 | * | ShalokShalom joined #nim |
08:15:12 | * | hoijui quit (Remote host closed the connection) |
08:59:38 | * | ShalokShalom62 joined #nim |
08:59:53 | * | ShalokShalom62 quit (Remote host closed the connection) |
09:26:55 | * | dddddd quit (Read error: Connection reset by peer) |
09:42:23 | * | vlad1777d joined #nim |
09:50:57 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
09:51:55 | * | laaron joined #nim |
10:05:44 | * | rnrwashere joined #nim |
10:10:10 | * | rnrwashere quit (Ping timeout: 252 seconds) |
10:15:31 | * | krux02 joined #nim |
10:19:04 | * | Vladar joined #nim |
10:27:56 | * | luis_ joined #nim |
10:51:34 | * | krux02 quit (Remote host closed the connection) |
11:03:54 | * | solitudesf joined #nim |
11:19:01 | * | seerix quit (Ping timeout: 246 seconds) |
11:24:17 | * | seerix joined #nim |
11:58:57 | * | lritter joined #nim |
12:36:29 | * | vivus joined #nim |
12:38:15 | vivus | hello all |
12:41:06 | vivus | @jrfondren do I need to define how the JSON will look for importing a table into JSON? Right now I am getting an error: template/generic instantiation from here ... Error: undeclared field: 'data' |
12:41:44 | * | Snircle joined #nim |
12:43:46 | * | al_ joined #nim |
12:45:37 | * | luis_ quit (Remote host closed the connection) |
12:50:21 | * | luis_ joined #nim |
12:52:22 | * | Vladar quit (Remote host closed the connection) |
12:54:46 | xace | vivus: jrfondren might now be available, do you have a paste you can share with your problem? |
12:55:08 | xace | s/now/not |
12:59:12 | * | luis_ quit (Ping timeout: 252 seconds) |
13:01:21 | vivus | xace: here is my issue in a paste: https://dpaste.de/72wN |
13:03:46 | * | luis_ joined #nim |
13:08:25 | vivus | xace: when I use the marshal module, it works, but I see what the issue might be. the exporting to JSON creates very deep nesting |
13:13:33 | * | smitop joined #nim |
13:13:40 | smitop | How do I convert between `seq`s and `array`s? |
13:16:16 | smitop | I've looked through `sequtils`, am I missing something? |
13:16:32 | Zevv | you can convert an array to a seq with @ |
13:16:55 | Zevv | the other way around is not possible, since the (fixed size) memory allocation for an array is determined at compile time |
13:27:21 | * | apodo joined #nim |
13:27:37 | xace | vivus: the json you provided is that even valid json? |
13:28:20 | vivus | xace: in the paste, that is not JSON. that is the output of `echo mytable` |
13:29:00 | vivus | the program doesn't compile and gives an error when I try to convert mytable to JSON |
13:29:33 | Zevv | it looks like a json object with Nim-serialized tuples |
13:30:41 | * | Vladar joined #nim |
13:30:47 | Zevv | vivus: use %* instead |
13:30:57 | Zevv | https://nim-lang.github.io/Nim/json.html#%25%2A.m%2Cuntyped |
13:32:03 | Zevv | well, no, ignore that |
13:36:04 | vivus | Zevv: already tried that |
13:36:25 | Zevv | I never tried, but I expect json is not able to handle tuples at all |
13:36:52 | vivus | Zevv: also, I added how I initialized my table in the code. it is a string and tuple of strings |
13:38:26 | Zevv | I just now see this: var main_table = newTable[string, (string, seq[string])]() |
13:38:40 | Zevv | I'm afraid that is not trivially jsonified |
13:39:07 | Zevv | but I guess it is worth a bug report |
13:40:09 | * | ShalokShalom quit (Remote host closed the connection) |
13:42:16 | Zevv | yeah, the implementation of % for tables is not complete |
13:42:30 | Zevv | it does not recursively jsonify the table contents |
13:46:28 | vivus | Zevv: so it just looks at the first level to JSONify things? |
13:47:01 | Zevv | yeah, and also you can not convert tuples to json, so it is a double issue. still looking into it |
13:47:40 | vivus | interesting. Besides CSV and JSON, what other format can I export from a table to? |
13:48:28 | Zevv | ok, your problem is the tuples |
13:48:32 | Zevv | change your code to something like this: |
13:48:39 | Zevv | http://p.zevv.nl/?e809 |
13:49:45 | vivus | ty. I will refactor it now. might take a bit of a while, but if it helps get the right export format, that works for me |
13:50:52 | Zevv | I'm not sure what tuple semantics in json actually should be, the docs do not seem to explicitly mention this, but I guess it is problematic at least |
13:52:36 | Zevv | https://github.com/nim-lang/Nim/pull/10010 |
13:52:38 | vivus | Zevv: how do I initialize an empty object? I currently have: `mytable[p.row[0]] = (p.row[2], @[])` |
13:58:05 | Zevv | o = Foo() |
14:04:49 | * | dddddd joined #nim |
14:08:08 | * | laaron quit (Remote host closed the connection) |
14:08:34 | shashlick | Npeg looks awesome |
14:08:44 | shashlick | Nicely documented, will try sometime |
14:08:56 | * | laaron joined #nim |
14:15:23 | * | laaron quit (Remote host closed the connection) |
14:15:48 | * | laaron joined #nim |
14:17:30 | FromGitter | <liquid600pgm> is it possible to parse an indentation-based language using NPeg (or any PEG, really)? |
14:21:50 | FromDiscord_ | <DeltaPHC> Speaking in general terms, whitespace in grammar shouldn't be a problem. Whether the indentation is *correct* could be done in a separate step from lexing |
14:23:19 | FromDiscord_ | <DeltaPHC> You just have to preserve the whitespace |
14:24:55 | FromDiscord_ | <DeltaPHC> You could make significant whitespace its own token |
14:28:25 | FromGitter | <liquid600pgm> I thought doing it the way Nim does it is really clever (the indentation level is stored in tokens themselves) |
14:30:08 | * | vlad1777d quit (Ping timeout: 272 seconds) |
14:30:50 | FromDiscord_ | <DeltaPHC> It's not too hard to think about if you look at the code as just a stream of bytes |
14:31:58 | FromDiscord_ | <DeltaPHC> A stream of bytes with lots of space characters |
14:32:14 | FromGitter | <liquid600pgm> hmm, I'll think about it for a little more |
14:32:58 | FromGitter | <liquid600pgm> does NPeg support Unicode? |
14:38:31 | Zevv | im on the roas, home in 5 min |
14:38:35 | Zevv | road |
14:41:49 | * | leorize quit (Quit: WeeChat 2.3) |
14:42:01 | * | theelous3 joined #nim |
14:43:17 | * | leorize joined #nim |
14:46:11 | * | clyybber joined #nim |
14:49:29 | Zevv | liquid600pgm: you could lex the indents as any token, but I'm not sure if there is a proper way to use it as part of the grammar |
14:49:41 | Zevv | You'd need more state for that |
14:50:12 | Zevv | Unicode is not explicitly supported, as I am not sure to what level it would need support. |
14:50:39 | Zevv | The tests have an example for matching unicode characters |
14:51:15 | Zevv | but for *real* support, much more would be needed. For example, the character classes like Upper and Lower need to become unicode aware. Not really a technical problem, but it would kill performance. |
14:51:35 | Zevv | so for now I decided not to put it in - although it is a good idea to mention that in the README |
14:53:10 | Zevv | and I'm not accurate: you can do *UTF-8* explicitly |
14:55:23 | * | jeremy_ joined #nim |
14:55:48 | * | jeremy_ is now known as Guest93678 |
14:58:38 | Guest93678 | Hello, I am trying to use nimgl's imgui bindings but I've encountered some issues. There's an option that compiles imgui in source so you don't need a shared lib but it seems broken. I want to fix it but I am unsure how. See this issue I made: https://github.com/lmariscal/nimgl/issues/19 |
15:00:59 | Guest93678 | What I've gathered is that the c function declaration that is defined by the nimgl bindings is slightly different from the cimgui.h declaration. |
15:01:36 | * | vlad1777d joined #nim |
15:02:35 | Guest93678 | Here's the binding defined by nimgl |
15:02:38 | Guest93678 | proc igShowDemoWindow*(p_open: ptr bool = nil): void {.imgui_lib, importc: "igShowDemoWindow".} |
15:03:10 | Guest93678 | and cimgui |
15:03:13 | Guest93678 | CIMGUI_API void igShowDemoWindow(bool* p_open); |
15:06:58 | * | kapilp quit (Quit: Connection closed for inactivity) |
15:11:57 | * | rnrwashere joined #nim |
15:13:01 | * | redlegion_ is now known as redlegion |
15:13:01 | * | redlegion quit (Changing host) |
15:13:01 | * | redlegion joined #nim |
15:31:03 | Mister_Magister | what ide do you use for nim? I don't see any intellij plugin and sublime kinda succ as ide |
15:32:09 | Zevv | I believe visual studio is the IDE of choice for many |
15:32:20 | leorize | visual studio code to be exact |
15:32:25 | leorize | there's a major diff between the two |
15:32:57 | Mister_Magister | and something that is not spying on me? |
15:33:42 | leorize | vsc doesn't spy on you :p |
15:34:09 | Mister_Magister | >m$ |
15:34:18 | Mister_Magister | i dont want >m$ |
15:34:34 | Zevv | Well, I use vim, which I tend to trust. |
15:35:01 | Mister_Magister | ye vim is okay but something gui? |
15:35:05 | Zevv | gvim :) |
15:35:33 | Mister_Magister | xdd |
15:36:05 | Zevv | https://github.com/nim-lang/Nim/wiki/Editor-Support is probably not really up to date |
15:36:07 | * | Kaivo quit (Quit: WeeChat 2.4) |
15:38:53 | Guest93678 | there is telemetry in vscode but you can disable it or just use the open source build |
15:50:20 | vivus | can someone tell me what the error in my code is here: https://dpaste.de/pyzV |
15:53:08 | * | smitop quit (Quit: Connection closed for inactivity) |
15:54:22 | dom96 | vivus, you cannot assign on the right hand side of an assignment |
15:55:03 | dom96 | well, `(myobj = main_table(); myobj)` might work |
15:55:59 | vivus | I did: myobj = main_table() ... \n ... mytable[p.row[0]] = (p.row[2], myobj) ... and get this error now: Error: undeclared identifier: 'myobj' |
15:57:00 | leorize | what exactly are you trying to do? |
15:58:26 | vivus | leorize: I am trying to do what Zevv suggested above and convert my = newTable[string, (string, seq[string])]() into: newTable[string, main_table]() ... and then I want to convert: mytable.add(p.row[0], (p.row[2], []) into the equivalent of what it would be with an object |
16:06:03 | Zevv | vivus: convention is to use capital first letter for type names, but alas |
16:07:21 | Zevv | try mytable[p.row[0]] = main_table(f0: p.row[2]) |
16:07:37 | Zevv | main_table() is your object constructor here |
16:08:12 | Zevv | https://nim-lang.org/docs/manual.html#types-object-construction |
16:09:05 | * | dddddd quit (Read error: Connection reset by peer) |
16:11:44 | * | rnrwashere quit (Remote host closed the connection) |
16:11:47 | vivus | Zevv: how is the string initialized then? cause the string is outside the object here: `newTable[string, main_table]()` ? |
16:13:25 | * | rnrwashere joined #nim |
16:14:24 | * | laaron quit (Remote host closed the connection) |
16:14:58 | * | laaron joined #nim |
16:16:39 | * | sealmove quit (Quit: WeeChat 2.4) |
16:18:45 | leorize | vivus: you should read more about tables |
16:19:43 | * | dddddd joined #nim |
16:23:03 | FromGitter | <kaushalmodi> Mister_Magister: emacs |
16:23:15 | Mister_Magister | emacsOS surely best |
16:33:20 | * | lritter quit (Quit: Leaving) |
16:38:01 | FromGitter | <Varriount> Zevv: Just out of curiosity, have you done any performance comparisons between your PEG library and hand written parsers (such as the JSON module)? |
16:42:38 | * | rnrwashere quit (Remote host closed the connection) |
16:44:44 | * | kapilp joined #nim |
16:45:53 | Zevv | yes, npeg is faster then nim json |
16:46:16 | Zevv | and about as fast as Araqs packedjson |
16:47:25 | FromGitter | <Varriount> :O |
16:50:02 | * | vivus quit (Remote host closed the connection) |
16:51:48 | * | ShalokShalom joined #nim |
16:55:46 | Mister_Magister | i have object property type int64 and i want to pass it to function which takes string parameter. how can i convert/cast it? |
16:56:20 | * | aranhaagency joined #nim |
16:57:53 | FromGitter | <Varriount> Mister_Magister: Use the '$' operataor |
16:58:10 | FromGitter | <Varriount> `$100` -> `"100"` |
16:59:08 | * | ShalokShalom quit (Remote host closed the connection) |
16:59:47 | * | ShalokShalom joined #nim |
17:00:09 | Mister_Magister | will it work with variables? |
17:02:13 | Mister_Magister | oh it does thanks! |
17:02:24 | Mister_Magister | note to self. if you want number to string use PHP |
17:02:33 | * | deech_ quit (Ping timeout: 245 seconds) |
17:10:24 | Mister_Magister | Future[bool] what is Future? |
17:11:08 | * | Jesin quit (Quit: Leaving) |
17:11:27 | leorize | it's an async thing |
17:11:45 | leorize | future is a variable that will be come the type it contains |
17:13:03 | Mister_Magister | thanks and what is debug function? |
17:13:23 | * | luis_ quit (Ping timeout: 258 seconds) |
17:14:27 | Mister_Magister | like debug(args) |
17:15:28 | Araq | debugEcho(args) |
17:17:57 | * | Jesin joined #nim |
17:24:23 | * | deech_ joined #nim |
17:29:38 | * | aranhaagency quit (Remote host closed the connection) |
17:30:09 | * | aranhaagency joined #nim |
17:34:40 | * | aranhaagency quit (Ping timeout: 268 seconds) |
17:38:19 | FromGitter | <liquid600pgm> debugEcho is the same as echo, though |
17:38:29 | FromGitter | <liquid600pgm> it just pretends to not have side effects |
17:39:49 | FromGitter | <kayabaNerve> I don't think it is |
17:40:09 | FromGitter | <kayabaNerve> I'm pretty sure it does have at least a partially different implementation |
17:40:17 | leorize | nope, it's the same |
17:40:27 | leorize | different magic, ofc :p |
17:40:35 | FromGitter | <liquid600pgm> nope |
17:40:37 | FromGitter | <liquid600pgm> not different |
17:40:49 | FromGitter | <liquid600pgm> it's `{.magic: "Echo", noSideEffect.}` |
17:41:00 | leorize | ooooh |
17:41:16 | leorize | Araq: do we want to do JS testing on travis? |
17:41:43 | Araq | huh? |
17:41:55 | Araq | we do have JS testing on travis already |
17:42:35 | leorize | I'm just a bit confused by this line: https://github.com/nim-lang/Nim/blob/devel/testament/categories.nim#L698 |
17:43:55 | Araq | 'not defined(linux)' |
17:43:57 | FromGitter | <Varriount> Zevv: New and improved! https://gist.github.com/Varriount/103aec43b11e1689fef41fceb8c7187c |
17:51:37 | deech_ | Anyone here work who with Emacs and 'projectile' know how to ignore the 'nim*' binaries in the 'compiler' directory? Adding them to .gitignore doesn't seem to work for me. |
17:54:02 | * | vlad1777d quit (Ping timeout: 244 seconds) |
17:55:41 | * | rnrwashere joined #nim |
17:58:27 | * | elrood joined #nim |
17:58:58 | Zevv | Varriount: quite something, does it all work as you wanted it to? I hate the SHOUTING though, but that's just an opinion |
18:11:05 | * | aranhaagency joined #nim |
18:13:31 | Araq | so ... anybody knows about case object transitions? |
18:13:57 | Araq | because I solved this language design puzzle. After X years... |
18:14:34 | FromGitter | <liquid600pgm> you mean changing an object's variant? ⏎ ⏎ ```type ⏎ Kind = enum ⏎ kA``` [https://gitter.im/nim-lang/Nim?at=5cead78a7c363c75a7498d4d] |
18:15:56 | Araq | yes |
18:17:04 | FromGitter | <liquid600pgm> I've known about them for a while, but never used them (because I didn't need to) |
18:17:15 | FromGitter | <liquid600pgm> what did you change in their design? |
18:17:47 | FromDiscord_ | <DeltaPHC> IMO, the issue seems to be in treating the variant as a regular field |
18:18:42 | deech_ | Araq, what problem did you fix. Does the above example not compile now? |
18:19:18 | Araq | well I'm still implementing it |
18:21:13 | deech_ | Awesome. |
18:21:38 | Araq | but the idea is that assignments to the 'kind' field are invalid at runtime, as before |
18:21:49 | Araq | but the existing loophole is closed |
18:22:10 | * | al_ quit (Quit: al_) |
18:22:28 | deech_ | But can't it be caught at compile time? |
18:23:07 | Araq | to do a branch switch, replace the object completely inplace, like so: obj[] = Obj(k: newBranch, fields) |
18:23:21 | * | lritter joined #nim |
18:23:27 | Araq | deech_: no, that would be too restrictive |
18:24:15 | FromGitter | <liquid600pgm> what do you mean "restrictive"? it throws a runtime error anyways, and the earlier an error is caught the better |
18:24:17 | deech_ | Araq, interesting. There are legitimate use cases for changing the 'kind' of an object dynamically? |
18:24:34 | Araq | I do it everywhere in Nim's compiler |
18:25:13 | Araq | liquid600pgm: I mean preventing it at compile-time would be too restrictive. |
18:25:57 | FromGitter | <liquid600pgm> I understood what you meant, I just don't get why it would be too restrictive since it throws an error at runtime anyways |
18:26:54 | Araq | I don't understand you. |
18:27:14 | FromGitter | <liquid600pgm> > the idea is that assignments to the 'kind' field are invalid at runtime, as before |
18:27:31 | FromGitter | <liquid600pgm> I understood this as "assigning to the kind field throws a runtime error" |
18:27:33 | deech_ | Just did a grep on '.kind =' and I'm seeing a lot of comparisons like, 'a.kind = b.kind' but not much direct manipulation. I do see you creating programatically creating nodes using those value though. |
18:27:53 | deech_ | s/'a.kind = b.kind'/'a.kind == b.kind'/ |
18:29:52 | deech_ | Btw, is 'kind' a special name or can it be any field the user chooses? |
18:30:27 | FromGitter | <liquid600pgm> it's a regular field, so any name is valid |
18:31:01 | deech_ | Interesting. That makes things harder to detect at compile time. |
18:31:02 | Zevv | How does this fit together with system.reset()? |
18:31:37 | FromGitter | <liquid600pgm> deech_: not really, you still know it's a variant because of the `case field: Type` |
18:31:46 | Araq | deech_: |
18:31:50 | Araq | proc myreset(n: var TFullReg) = reset(n) |
18:31:50 | Araq | template ensureKind(k: untyped) {.dirty.} = |
18:31:50 | Araq | if regs[ra].kind != k: |
18:31:52 | Araq | myreset(regs[ra]) |
18:31:54 | Araq | regs[ra].kind = k |
18:31:56 | Araq | in compiler/vm.nim |
18:32:31 | Araq | the VM depends on this feature. but eventually we'll find workarounds, at least the loophole is gone for other Nim code then :P |
18:32:51 | Araq | Zevv: system.reset() doesn't allow you to switch object branches |
18:33:09 | deech_ | Yeah, that's a huge step up. Maybe it's the job of a linter to flag assignments to discriminators. |
18:33:10 | Araq | after this change. |
18:33:36 | Araq | yup, assignments to discriminators could be flagged as bad |
18:34:52 | * | aranhaagency quit (Remote host closed the connection) |
18:39:05 | Mister_Magister | httpclient returns in response image file and i want to save it. How can i do it? |
18:41:26 | Zevv | Mister_Magister: http://p.zevv.nl/?9e9d |
18:41:47 | Mister_Magister | oh thanks! |
18:44:48 | FromDiscord_ | <DeltaPHC> Hm. In other languages, the variant is part of the object construction and the discriminator isn't directly accessible. `let a = MyThing::SomeVariant(data); a = MyThing::AnotherVariant(data)` |
18:44:54 | FromGitter | <liquid600pgm> Zevv: is there any way of referencing a capture in NPeg? like in regex you can do `(\w+)\s\1` to match pairs of the same word |
18:45:02 | FromDiscord_ | <DeltaPHC> Is Nim's object variant design out of keeping it minimal? |
18:45:19 | Zevv | liquid600pgm: nope |
18:46:01 | Zevv | didn't need it yet, so didn't add it yet. not sure if it would be easy or hard to |
18:46:16 | FromGitter | <liquid600pgm> could it be a feature, or does it go against NPeg's design philosophy? |
18:46:29 | FromGitter | <liquid600pgm> I could try to implement it |
18:46:44 | Zevv | there's no philosophy here, so I don't see why not |
18:47:24 | Araq | DeltaPHC: it was heavily inspired by Ada, not ML as I considered it way more flexible |
18:47:34 | Araq | it didn't age all that well though :P |
18:48:04 | Zevv | captures are a bit more powerful then in regexpes (can be nested, for example), so not sure if there is a robust way to refer to a capture, but I'll take a look |
18:48:21 | Araq | but it is more flexible than what the other langs do. It's also not as safe, not a big surprise here. |
18:48:58 | FromGitter | <liquid600pgm> Zevv: I was saying "design philosophy" referring to this definition, btw: https://opensource.guide/best-practices/#write-down-your-projects-vision |
18:49:10 | FromGitter | <liquid600pgm> so "your project's vision" |
18:51:30 | Zevv | My vision is that usually "things seemed like a good idea", and I'm usually wrong. So I just try to make the best of it :) But if I had a vision, where would I put that down? |
18:52:30 | FromGitter | <liquid600pgm> probably at the beginning of your readme, eg. "MyEngine is a minimal game engine focused on a simple drawing API" |
18:52:45 | Zevv | hm ok, I'll give it a think |
18:53:20 | FromGitter | <liquid600pgm> by the way, what does the `@P` operator do? "search for P" is a pretty unclear definition |
18:53:21 | Mister_Magister | Zevv: what if i have line like this await newAsyncHttpClient().get(api_file & file_path) and i want to save response from that to file |
18:53:45 | Zevv | Mister_Magister: await the body and write that |
18:53:54 | Mister_Magister | but how to write that body |
18:54:02 | Mister_Magister | ah |
18:54:04 | Mister_Magister | writeFile |
18:54:06 | Mister_Magister | got it |
18:54:10 | FromGitter | <liquid600pgm> writeFile("filename", "content") |
18:54:12 | Zevv | writeFile await c.getContent("...") |
18:56:02 | * | rnrwashere quit (Remote host closed the connection) |
18:59:04 | FromGitter | <liquid600pgm> I like the way you throw parse errors in NPeg |
18:59:39 | Zevv | I don't. it's not robust, because if you make your grammar wrong it throws when it could backtrace |
19:00:12 | Zevv | I read this thing tons of times, but I don't understand it: https://github.com/zevv/npeg/blob/master/doc/Exception_Handling_for_Error_Reporting_in_Parsing_Expression_Grammars.pdf |
19:01:32 | FromGitter | <liquid600pgm> your library is the first PEG lib I've seen that allows you to define custom syntax error messages instead of something along the lines of "Expected '(' or [a-zA-Z_]" |
19:02:23 | * | rnrwashere joined #nim |
19:03:13 | Zevv | good to hear it works for you! |
19:05:36 | Zevv | and the @ is explained in https://github.com/zevv/npeg#achoring-and-searching |
19:06:02 | Zevv | it is just sugar for a common pattern |
19:06:18 | FromGitter | <liquid600pgm> aah, that makes sense |
19:06:39 | * | rnrwashere quit (Remote host closed the connection) |
19:07:04 | * | rnrwashere joined #nim |
19:07:27 | * | rnrwashere quit (Remote host closed the connection) |
19:14:07 | FromGitter | <liquid600pgm> is it possible to return something from a parse rule? like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ceae57ead024978c632bd32] |
19:14:19 | FromGitter | <liquid600pgm> or do I have to use a separate stack for that? |
19:15:33 | Zevv | I've been trying various mechanisms for that, but there is no single best way that fits all use cases. |
19:15:58 | FromGitter | <liquid600pgm> fine then, I'll use a stack to manage those results then |
19:16:00 | Zevv | If you return there, what should npeg do with it? |
19:16:23 | FromGitter | <liquid600pgm> yeah I was thinking about that now and I agree with you |
19:16:43 | Zevv | I'd love to do conversion like parseFloat there, but captures are string only at this time. You can capture to JSON though, if that suits you |
19:16:55 | FromGitter | <liquid600pgm> I'm used to PEG.js where this is the obvious thing that's done |
19:17:10 | Zevv | yeah, same with me and lpeg. Duck typing makes some things easier |
19:17:14 | FromGitter | <liquid600pgm> but that's due to the dynamic nature of JS |
19:17:19 | Zevv | and Lua |
19:17:28 | FromGitter | <liquid600pgm> yes |
19:18:09 | FromGitter | <liquid600pgm> as I learned recently from my adventures with Lua and game dev, dynamic typing is sometimes your worst debugging nightmare |
19:18:25 | FromGitter | <liquid600pgm> yet sometimes it's super useful |
19:19:09 | Zevv | Well, yes and no. I've done *tons* of lua over the last 12 years as it was my main langauge in a number of projects. But the biggest reason to drop it in the end was indeed the lack of typing and compile time checking. Enters Nim |
19:21:07 | Zevv | One other issue with npeg is that you can't pass user state trough the parser, so everything done in the code blocks needs to be available before the PEG definition. Not a horrenduous showstopper, but it would be nice to be able to pass your own thingy and access that from within the callbacks. |
19:21:16 | * | rnrwashere joined #nim |
19:21:26 | Zevv | I have an implementation that fixes that, but I hate the notation and API, so didn't make it in |
19:21:41 | FromGitter | <liquid600pgm> yeah I just create the Parser in a separate `parseScript` proc |
19:21:54 | FromGitter | <liquid600pgm> that allows me to have a distinct state, but it's not perfect |
19:22:01 | Zevv | right |
19:38:44 | * | rnrwashere quit (Remote host closed the connection) |
19:43:44 | Mister_Magister | its there some quick way of getting last element in sequence? |
19:43:58 | FromGitter | <liquid600pgm> sequence[^1] |
19:44:00 | Zevv | [^1] |
19:44:25 | Mister_Magister | thanks! |
19:45:10 | Mister_Magister | nim is beautif ul |
19:53:35 | Mister_Magister | if i have toUpper from both strutils and unicode how do i specify which one do i want to use? unicode.toUpper doesn't seem to work |
19:54:07 | * | rnrwashere joined #nim |
19:54:17 | FromGitter | <liquid600pgm> toUpper from strutils is exported from unicode |
19:54:41 | Mister_Magister | ohh |
19:55:23 | * | aranhaagency joined #nim |
19:56:34 | Araq | wait what? unicode.toUpper MUST work |
19:56:53 | Mister_Magister | Error: ambiguous call; both strutils.strip(s: string, leading: bool, trailing: bool, chars: set[char]) [declared in ../.choosenim/toolchains/nim-#devel/lib/pure/strutils.nim(2663, 6)] and unicode.strip(s: string, leading: bool, trailing: bool, runes: openarray[Rune]) [declared in ../.choosenim/toolchains/nim-#devel/lib/pure/unicode.nim(1062, 6)] match for: (string) |
20:02:57 | FromGitter | <liquid600pgm> Zevv: shouldn't it be possible to implement Unicode support in NPeg using the `unicode` module and `Rune`? |
20:03:14 | FromGitter | <liquid600pgm> so that instead of matching a string, we match a `seq[Rune]`? |
20:07:47 | Zevv | Probably, but performance, I wouldnt want that to be the default. But maybe it can be genericized, that would be a pretty solution |
20:10:04 | Zevv | otoh, I'm not yet sure of the practical benefit. As long as your utf-8 is normalized, that will already "just work" |
20:10:17 | * | rnrwashere quit (Remote host closed the connection) |
20:13:16 | * | narimiran quit (Remote host closed the connection) |
20:13:55 | FromDiscord_ | <DeltaPHC> You can already kinda match unicode if your rule merely excludes what isn't allowed in an identifier. By logical extension, idents would then be able to accept unicode |
20:15:31 | Zevv | will not necessarily result in clear or understandable rules, but yes :) |
20:15:46 | Zevv | but unicode and utf8 is not the same thing |
20:17:38 | * | rnrwashere joined #nim |
20:19:18 | skrylar[m] | argh. 600% overheads |
20:19:42 | * | nsf quit (Quit: WeeChat 2.4) |
20:37:35 | * | aranhaagency quit (Remote host closed the connection) |
20:39:56 | * | aranhaagency joined #nim |
20:49:13 | * | stefanos82 quit (Quit: Quitting for now...) |
20:49:40 | * | stefanos82 joined #nim |
21:03:22 | * | aranhaag_ joined #nim |
21:03:22 | * | aranhaagency quit (Read error: Connection reset by peer) |
21:09:03 | * | clyybber quit (Quit: WeeChat 2.4) |
21:12:24 | FromGitter | <jrfondren> @lqdev, https://github.com/jrfondren/modsec/blob/master/src/modsec/actions.nim#L270 is enough to implement a unicode `1` |
21:12:48 | * | rnrwashere quit (Remote host closed the connection) |
21:16:27 | * | rnrwashere joined #nim |
21:16:58 | * | kapilp quit (Quit: Connection closed for inactivity) |
21:19:26 | FromGitter | <kayabaNerve> ```code paste, see link``` ⏎ ⏎ I've never seen this before [https://gitter.im/nim-lang/Nim?at=5ceb02de9404bf2aedb468d8] |
21:20:33 | * | Vladar quit (Remote host closed the connection) |
21:21:32 | FromGitter | <jrfondren> x mod (uint64(max)+1u64) |
21:21:39 | FromGitter | <jrfondren> well that's obviously a division by zero |
21:21:41 | FromGitter | <kayabaNerve> Oh. That's a RangeError except when you have checks:off |
21:22:00 | * | rockcavera joined #nim |
21:22:18 | FromGitter | <jrfondren> oh that's not uint64.max |
21:22:34 | FromGitter | <jrfondren> are you passing uint64.max as the `max` parameter? |
21:22:48 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ceb03a89d64e537bc177032] |
21:22:58 | FromGitter | <kayabaNerve> I promise you I have a reason |
21:23:03 | FromGitter | <kayabaNerve> :thinking: |
21:23:10 | FromGitter | <kayabaNerve> I think it's casting to a negative |
21:23:38 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ceb03da8f019114aebfbd1f] |
21:23:45 | FromGitter | <kayabaNerve> Here's the version with checks |
21:24:24 | FromGitter | <jrfondren> yep, you're passing uint64.max |
21:24:54 | FromGitter | <kayabaNerve> ... the check is running with `not int8(0)` |
21:24:58 | * | lritter quit (Ping timeout: 272 seconds) |
21:25:08 | FromGitter | <kayabaNerve> How is that uint64 max? |
21:25:43 | FromGitter | <jrfondren> ot |
21:25:45 | FromGitter | <jrfondren> it's -1 |
21:25:53 | FromGitter | <jrfondren> which is uint64.max |
21:27:03 | FromGitter | <jrfondren> what you're expecting is 255 |
21:27:32 | FromGitter | <jrfondren> which is what you get with uint8(0) |
21:29:06 | FromGitter | <jrfondren> I get sign-extension is always mildly confusing, but what Nim does is reasonable since you're starting with a signed type |
21:30:03 | FromGitter | <kayabaNerve> I just want to get an int with all its bits set to 1 for 8/16/32. I don't see how 8 1 bits would equiv 64 1 bits. |
21:30:31 | FromGitter | <jrfondren> use uintX(0) then for those |
21:31:33 | FromGitter | <kayabaNerve> You're recommending `int(uint(0))` ? |
21:31:45 | FromGitter | <kayabaNerve> I can't use an uint in rand so I do need the result to be an int :P |
21:31:54 | FromGitter | <jrfondren> to go from -1.int8 to uint64, you could go int8->int64->uint64, or you could go int8->uint8->uint64. The first way asks "what's a good signed int64 value to map a -1.uint8 to?" and the answer's obviously -1.int64, which is then all bits set uint64, or uint64.max |
21:32:15 | FromGitter | <jrfondren> I'm recommending not(uint8(0)) |
21:33:03 | FromGitter | <kayabaNerve> Got it. Thank you. |
21:33:09 | FromGitter | <kayabaNerve> I see the issue now. |
21:33:18 | FromGitter | <kayabaNerve> An int 0 has half of its bytes set. |
21:33:29 | FromGitter | <kayabaNerve> To be clear though. I'm not doing anything with 64 bit ints |
21:33:32 | FromGitter | <kayabaNerve> I cap at 32 |
21:33:48 | FromGitter | <jrfondren> yeah the conversion happens in rand |
21:34:42 | FromGitter | <jrfondren> arguably rand()'s signature is wrong. it's `proc rand(max: int): int` but it passes `max` as-is to the second parameter of `proc rand(r: var Rand; max: Natural): int` |
21:35:00 | FromGitter | <jrfondren> -1 is an OK `int`. it's out of bounds as a `Natural` |
21:43:37 | FromGitter | <Varriount> kayabaNerve: How are things going? |
21:45:09 | * | vlad1777d joined #nim |
21:45:24 | FromGitter | <Varriount> Zevv: Regarding unicode, I just have my parser accept all characters as valid for strings and words. I'll then do unicode handling in the parser stage |
21:45:31 | FromGitter | <Varriount> *lexer accept |
21:50:20 | FromGitter | <kayabaNerve> @Varriount Good! Just cleaning up my tests. |
21:50:25 | FromGitter | <kayabaNerve> How are you? |
21:53:35 | * | solitudesf quit (Ping timeout: 248 seconds) |
22:05:44 | * | kapilp joined #nim |
22:25:08 | * | apodo quit (Ping timeout: 272 seconds) |
22:35:43 | * | NimBot joined #nim |
22:36:25 | FromGitter | <Varriount> @kayabaNerve Tinkering/Using Zevv's npegs module |
22:41:21 | * | stefanos82 quit (Remote host closed the connection) |
22:44:15 | * | rnrwashere quit (Remote host closed the connection) |
23:19:24 | * | rnrwashere joined #nim |
23:23:39 | * | rnrwashere quit (Ping timeout: 248 seconds) |
23:25:37 | * | WilhelmVonWeiner quit (Quit: leaving) |
23:25:47 | * | WilhelmVonWeiner joined #nim |
23:35:31 | * | Jjp137 quit (Read error: Connection reset by peer) |
23:36:11 | * | Jjp137 joined #nim |
23:46:22 | * | elrood quit (Remote host closed the connection) |
23:47:53 | FromGitter | <kayabaNerve> Looked quality :P I was excited to see Commandant back in the day. I hope you publish any updates you make. |
23:53:14 | * | rnrwashere joined #nim |
23:57:44 | * | rnrwashere quit (Ping timeout: 252 seconds) |
23:58:31 | * | rnrwashere joined #nim |