<< 26-05-2019 >>

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:57skrylar[m]i kinda got used to crappy c code for so long that i forgot python and friends had custom iterators
02:22:14skrylar[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:17skrylar[m]:d
02:23:23*banc joined #nim
02:35:08*aranhaagency joined #nim
02:38:13aranhaagency\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:20FromGitter<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:58skrylar[m]woo. pure-nim bmessage encoding
04:12:09leorizeAraq: do you want to get the js backend tested on travis?
04:25:30skrylar[m]kind of wonder how offensive this encoding format is
04:25:32Zevvvarriount: sweet, got something working I asssume?
04:27:01skrylar[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:21skrylar[m]can probably trim it a little by forcing 32-bit ointers because you're not going to have messages that big
04:39:01Zevvuntil someone does :)
04:39:25skrylar[m]its possible
04:39:29Zevvvarints
04:39:40skrylar[m]most broker systems choke long before megabyte messages
04:40:27Zevvfcourse
04:41:01skrylar[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:31Zevvdon't optimize if you dont need to.
04:41:41ZevvDo you use pointers or just indexes?
04:42:03skrylar[m]indexes, kind of
04:42:17skrylar[m]they are soft pointers in that they are indeed pointers, but they are relative to the buffer start
04:43:00skrylar[m]it would not be unreasonable to set them at 16-bit
04:43:23Zevv65k is not that much
04:43:35skrylar[m]how much data are you shuttling about a button press
04:44:19Zevvwait until someone connects a cam to see who pressed the button
04:45:16skrylar[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:25skrylar[m](which also appears to be how nats/nsq/rabbit get used)
04:50:56skrylar[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:14skrylar[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:20FromGitter<Varriount> Zevv: Somewhat
06:13:48FromGitter<Varriount> Zevv: https://gist.github.com/Varriount/103aec43b11e1689fef41fceb8c7187c
06:15:00FromGitter<Varriount> Zevv: I'm going to develop better string patterns (supporting escapes, single quotes, etc).
06:16:03FromGitter<Varriount> My problem ATM is finding an alternative to non-greedy STRING_CHARS
06:17:23*nsf joined #nim
06:18:21Zevvwhat's your problem here - you want to match anything up to the ", right?
06:22:07FromGitter<Varriount> Zevv: the STRING_DATA pattern captures the `$` in `"data${sub}"`
06:22:15FromGitter<Varriount> And continues
06:22:21Zevvwell, yes :)
06:24:39Zevvmove the '+' repeat one level up
06:25:37Zevvso instead of +STRING_CHARS, do +(COMMAND_SUB | VARIABLE_SUB | STRING_CHAR)
06:27:10Zevvand your WORD_CHAR is too trigger happy, it will eat the trailing ')'
06:27:49Zevvhttp://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:28sealmoveGood 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:51FromGitter<Varriount> Zevv: I would have preferred that STRING_CHAR be composed of more than one character, but I guess this works
06:32:38Zevvwell, you can make that work, but then you'd have to exlude the $
06:32:47Zevvand allow it to be put in escaped
06:33:57Zevv~look at the json example for escaping
06:38:05Zevvhttp://p.zevv.nl/?3069 without escaping, /me is away now
06:38:32*solitudesf quit (Ping timeout: 268 seconds)
06:39:02Zevvand about your redirect syms: take care that ">" will match before ">>", so keep an eye on the ordering
06:47:09leorizesealmove: it's implemented
06:47:14leorizeyou should file a bug report
06:51:13sealmovebut... this is kind of the most simplistic example
06:54:15leorizedoesn't mean Araq remembers to implement it :p
06:58:19sealmovehum, maybe we should better try to document what works and what doesn't, instead of filing "bugs".
06:59:58leorizebugs are bugs
07:00:00*gmpreussner quit (Quit: kthxbye)
07:00:15leorizebefore I filed a few of them, you can easily return owned pointer as unowned
07:01:21sealmovefirst of all, how do you "dispose" currently? `= nil` doesn't work for `let` variables, lol
07:01:32sealmoveand `dispose()` is not defined
07:02:30leorizesealmove: https://github.com/nim-lang/Nim/blob/3e0fac7c20c624ba69ecff615af6bc6a78dcaeec/lib/system.nim#L1671
07:02:42sealmoveoh..
07:03:02leorizeand 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:15vivushello all
12:41:06vivus@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:46xacevivus: jrfondren might now be available, do you have a paste you can share with your problem?
12:55:08xaces/now/not
12:59:12*luis_ quit (Ping timeout: 252 seconds)
13:01:21vivusxace: here is my issue in a paste: https://dpaste.de/72wN
13:03:46*luis_ joined #nim
13:08:25vivusxace: 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:40smitopHow do I convert between `seq`s and `array`s?
13:16:16smitopI've looked through `sequtils`, am I missing something?
13:16:32Zevvyou can convert an array to a seq with @
13:16:55Zevvthe 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:37xacevivus: the json you provided is that even valid json?
13:28:20vivusxace: in the paste, that is not JSON. that is the output of `echo mytable`
13:29:00vivusthe program doesn't compile and gives an error when I try to convert mytable to JSON
13:29:33Zevvit looks like a json object with Nim-serialized tuples
13:30:41*Vladar joined #nim
13:30:47Zevvvivus: use %* instead
13:30:57Zevvhttps://nim-lang.github.io/Nim/json.html#%25%2A.m%2Cuntyped
13:32:03Zevvwell, no, ignore that
13:36:04vivusZevv: already tried that
13:36:25ZevvI never tried, but I expect json is not able to handle tuples at all
13:36:52vivusZevv: also, I added how I initialized my table in the code. it is a string and tuple of strings
13:38:26ZevvI just now see this: var main_table = newTable[string, (string, seq[string])]()
13:38:40ZevvI'm afraid that is not trivially jsonified
13:39:07Zevvbut I guess it is worth a bug report
13:40:09*ShalokShalom quit (Remote host closed the connection)
13:42:16Zevvyeah, the implementation of % for tables is not complete
13:42:30Zevvit does not recursively jsonify the table contents
13:46:28vivusZevv: so it just looks at the first level to JSONify things?
13:47:01Zevvyeah, and also you can not convert tuples to json, so it is a double issue. still looking into it
13:47:40vivusinteresting. Besides CSV and JSON, what other format can I export from a table to?
13:48:28Zevvok, your problem is the tuples
13:48:32Zevvchange your code to something like this:
13:48:39Zevvhttp://p.zevv.nl/?e809
13:49:45vivusty. 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:52ZevvI'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:36Zevvhttps://github.com/nim-lang/Nim/pull/10010
13:52:38vivusZevv: how do I initialize an empty object? I currently have: `mytable[p.row[0]] = (p.row[2], @[])`
13:58:05Zevvo = Foo()
14:04:49*dddddd joined #nim
14:08:08*laaron quit (Remote host closed the connection)
14:08:34shashlickNpeg looks awesome
14:08:44shashlickNicely 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:30FromGitter<liquid600pgm> is it possible to parse an indentation-based language using NPeg (or any PEG, really)?
14:21:50FromDiscord_<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:19FromDiscord_<DeltaPHC> You just have to preserve the whitespace
14:24:55FromDiscord_<DeltaPHC> You could make significant whitespace its own token
14:28:25FromGitter<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:50FromDiscord_<DeltaPHC> It's not too hard to think about if you look at the code as just a stream of bytes
14:31:58FromDiscord_<DeltaPHC> A stream of bytes with lots of space characters
14:32:14FromGitter<liquid600pgm> hmm, I'll think about it for a little more
14:32:58FromGitter<liquid600pgm> does NPeg support Unicode?
14:38:31Zevvim on the roas, home in 5 min
14:38:35Zevvroad
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:29Zevvliquid600pgm: 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:41ZevvYou'd need more state for that
14:50:12ZevvUnicode is not explicitly supported, as I am not sure to what level it would need support.
14:50:39ZevvThe tests have an example for matching unicode characters
14:51:15Zevvbut 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:35Zevvso for now I decided not to put it in - although it is a good idea to mention that in the README
14:53:10Zevvand 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:38Guest93678Hello, 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:59Guest93678What 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:35Guest93678Here's the binding defined by nimgl
15:02:38Guest93678proc igShowDemoWindow*(p_open: ptr bool = nil): void {.imgui_lib, importc: "igShowDemoWindow".}
15:03:10Guest93678and cimgui
15:03:13Guest93678CIMGUI_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:03Mister_Magisterwhat ide do you use for nim? I don't see any intellij plugin and sublime kinda succ as ide
15:32:09ZevvI believe visual studio is the IDE of choice for many
15:32:20leorizevisual studio code to be exact
15:32:25leorizethere's a major diff between the two
15:32:57Mister_Magisterand something that is not spying on me?
15:33:42leorizevsc doesn't spy on you :p
15:34:09Mister_Magister>m$
15:34:18Mister_Magisteri dont want >m$
15:34:34ZevvWell, I use vim, which I tend to trust.
15:35:01Mister_Magisterye vim is okay but something gui?
15:35:05Zevvgvim :)
15:35:33Mister_Magisterxdd
15:36:05Zevvhttps://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:53Guest93678there is telemetry in vscode but you can disable it or just use the open source build
15:50:20vivuscan 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:22dom96vivus, you cannot assign on the right hand side of an assignment
15:55:03dom96well, `(myobj = main_table(); myobj)` might work
15:55:59vivusI did: myobj = main_table() ... \n ... mytable[p.row[0]] = (p.row[2], myobj) ... and get this error now: Error: undeclared identifier: 'myobj'
15:57:00leorizewhat exactly are you trying to do?
15:58:26vivusleorize: 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:03Zevvvivus: convention is to use capital first letter for type names, but alas
16:07:21Zevvtry mytable[p.row[0]] = main_table(f0: p.row[2])
16:07:37Zevvmain_table() is your object constructor here
16:08:12Zevvhttps://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:47vivusZevv: 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:45leorizevivus: you should read more about tables
16:19:43*dddddd joined #nim
16:23:03FromGitter<kaushalmodi> Mister_Magister: emacs
16:23:15Mister_MagisteremacsOS surely best
16:33:20*lritter quit (Quit: Leaving)
16:38:01FromGitter<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:53Zevvyes, npeg is faster then nim json
16:46:16Zevvand about as fast as Araqs packedjson
16:47:25FromGitter<Varriount> :O
16:50:02*vivus quit (Remote host closed the connection)
16:51:48*ShalokShalom joined #nim
16:55:46Mister_Magisteri 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:53FromGitter<Varriount> Mister_Magister: Use the '$' operataor
16:58:10FromGitter<Varriount> `$100` -> `"100"`
16:59:08*ShalokShalom quit (Remote host closed the connection)
16:59:47*ShalokShalom joined #nim
17:00:09Mister_Magisterwill it work with variables?
17:02:13Mister_Magisteroh it does thanks!
17:02:24Mister_Magisternote to self. if you want number to string use PHP
17:02:33*deech_ quit (Ping timeout: 245 seconds)
17:10:24Mister_MagisterFuture[bool] what is Future?
17:11:08*Jesin quit (Quit: Leaving)
17:11:27leorizeit's an async thing
17:11:45leorizefuture is a variable that will be come the type it contains
17:13:03Mister_Magisterthanks and what is debug function?
17:13:23*luis_ quit (Ping timeout: 258 seconds)
17:14:27Mister_Magisterlike debug(args)
17:15:28AraqdebugEcho(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:19FromGitter<liquid600pgm> debugEcho is the same as echo, though
17:38:29FromGitter<liquid600pgm> it just pretends to not have side effects
17:39:49FromGitter<kayabaNerve> I don't think it is
17:40:09FromGitter<kayabaNerve> I'm pretty sure it does have at least a partially different implementation
17:40:17leorizenope, it's the same
17:40:27leorizedifferent magic, ofc :p
17:40:35FromGitter<liquid600pgm> nope
17:40:37FromGitter<liquid600pgm> not different
17:40:49FromGitter<liquid600pgm> it's `{.magic: "Echo", noSideEffect.}`
17:41:00leorizeooooh
17:41:16leorizeAraq: do we want to do JS testing on travis?
17:41:43Araqhuh?
17:41:55Araqwe do have JS testing on travis already
17:42:35leorizeI'm just a bit confused by this line: https://github.com/nim-lang/Nim/blob/devel/testament/categories.nim#L698
17:43:55Araq'not defined(linux)'
17:43:57FromGitter<Varriount> Zevv: New and improved! https://gist.github.com/Varriount/103aec43b11e1689fef41fceb8c7187c
17:51:37deech_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:58ZevvVarriount: 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:31Araqso ... anybody knows about case object transitions?
18:13:57Araqbecause I solved this language design puzzle. After X years...
18:14:34FromGitter<liquid600pgm> you mean changing an object's variant? ⏎ ⏎ ```type ⏎ Kind = enum ⏎ kA``` [https://gitter.im/nim-lang/Nim?at=5cead78a7c363c75a7498d4d]
18:15:56Araqyes
18:17:04FromGitter<liquid600pgm> I've known about them for a while, but never used them (because I didn't need to)
18:17:15FromGitter<liquid600pgm> what did you change in their design?
18:17:47FromDiscord_<DeltaPHC> IMO, the issue seems to be in treating the variant as a regular field
18:18:42deech_Araq, what problem did you fix. Does the above example not compile now?
18:19:18Araqwell I'm still implementing it
18:21:13deech_Awesome.
18:21:38Araqbut the idea is that assignments to the 'kind' field are invalid at runtime, as before
18:21:49Araqbut the existing loophole is closed
18:22:10*al_ quit (Quit: al_)
18:22:28deech_But can't it be caught at compile time?
18:23:07Araqto do a branch switch, replace the object completely inplace, like so: obj[] = Obj(k: newBranch, fields)
18:23:21*lritter joined #nim
18:23:27Araqdeech_: no, that would be too restrictive
18:24:15FromGitter<liquid600pgm> what do you mean "restrictive"? it throws a runtime error anyways, and the earlier an error is caught the better
18:24:17deech_Araq, interesting. There are legitimate use cases for changing the 'kind' of an object dynamically?
18:24:34AraqI do it everywhere in Nim's compiler
18:25:13Araqliquid600pgm: I mean preventing it at compile-time would be too restrictive.
18:25:57FromGitter<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:54AraqI don't understand you.
18:27:14FromGitter<liquid600pgm> > the idea is that assignments to the 'kind' field are invalid at runtime, as before
18:27:31FromGitter<liquid600pgm> I understood this as "assigning to the kind field throws a runtime error"
18:27:33deech_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:53deech_s/'a.kind = b.kind'/'a.kind == b.kind'/
18:29:52deech_Btw, is 'kind' a special name or can it be any field the user chooses?
18:30:27FromGitter<liquid600pgm> it's a regular field, so any name is valid
18:31:01deech_Interesting. That makes things harder to detect at compile time.
18:31:02ZevvHow does this fit together with system.reset()?
18:31:37FromGitter<liquid600pgm> deech_: not really, you still know it's a variant because of the `case field: Type`
18:31:46Araqdeech_:
18:31:50Araqproc myreset(n: var TFullReg) = reset(n)
18:31:50Araqtemplate ensureKind(k: untyped) {.dirty.} =
18:31:50Araq if regs[ra].kind != k:
18:31:52Araq myreset(regs[ra])
18:31:54Araq regs[ra].kind = k
18:31:56Araqin compiler/vm.nim
18:32:31Araqthe 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:51AraqZevv: system.reset() doesn't allow you to switch object branches
18:33:09deech_Yeah, that's a huge step up. Maybe it's the job of a linter to flag assignments to discriminators.
18:33:10Araqafter this change.
18:33:36Araqyup, assignments to discriminators could be flagged as bad
18:34:52*aranhaagency quit (Remote host closed the connection)
18:39:05Mister_Magisterhttpclient returns in response image file and i want to save it. How can i do it?
18:41:26ZevvMister_Magister: http://p.zevv.nl/?9e9d
18:41:47Mister_Magisteroh thanks!
18:44:48FromDiscord_<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:54FromGitter<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:02FromDiscord_<DeltaPHC> Is Nim's object variant design out of keeping it minimal?
18:45:19Zevvliquid600pgm: nope
18:46:01Zevvdidn't need it yet, so didn't add it yet. not sure if it would be easy or hard to
18:46:16FromGitter<liquid600pgm> could it be a feature, or does it go against NPeg's design philosophy?
18:46:29FromGitter<liquid600pgm> I could try to implement it
18:46:44Zevvthere's no philosophy here, so I don't see why not
18:47:24AraqDeltaPHC: it was heavily inspired by Ada, not ML as I considered it way more flexible
18:47:34Araqit didn't age all that well though :P
18:48:04Zevvcaptures 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:21Araqbut it is more flexible than what the other langs do. It's also not as safe, not a big surprise here.
18:48:58FromGitter<liquid600pgm> Zevv: I was saying "design philosophy" referring to this definition, btw: https://opensource.guide/best-practices/#write-down-your-projects-vision
18:49:10FromGitter<liquid600pgm> so "your project's vision"
18:51:30ZevvMy 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:30FromGitter<liquid600pgm> probably at the beginning of your readme, eg. "MyEngine is a minimal game engine focused on a simple drawing API"
18:52:45Zevvhm ok, I'll give it a think
18:53:20FromGitter<liquid600pgm> by the way, what does the `@P` operator do? "search for P" is a pretty unclear definition
18:53:21Mister_MagisterZevv: 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:45ZevvMister_Magister: await the body and write that
18:53:54Mister_Magisterbut how to write that body
18:54:02Mister_Magisterah
18:54:04Mister_MagisterwriteFile
18:54:06Mister_Magistergot it
18:54:10FromGitter<liquid600pgm> writeFile("filename", "content")
18:54:12ZevvwriteFile await c.getContent("...")
18:56:02*rnrwashere quit (Remote host closed the connection)
18:59:04FromGitter<liquid600pgm> I like the way you throw parse errors in NPeg
18:59:39ZevvI don't. it's not robust, because if you make your grammar wrong it throws when it could backtrace
19:00:12ZevvI 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:32FromGitter<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:13Zevvgood to hear it works for you!
19:05:36Zevvand the @ is explained in https://github.com/zevv/npeg#achoring-and-searching
19:06:02Zevvit is just sugar for a common pattern
19:06:18FromGitter<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:07FromGitter<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:19FromGitter<liquid600pgm> or do I have to use a separate stack for that?
19:15:33ZevvI've been trying various mechanisms for that, but there is no single best way that fits all use cases.
19:15:58FromGitter<liquid600pgm> fine then, I'll use a stack to manage those results then
19:16:00ZevvIf you return there, what should npeg do with it?
19:16:23FromGitter<liquid600pgm> yeah I was thinking about that now and I agree with you
19:16:43ZevvI'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:55FromGitter<liquid600pgm> I'm used to PEG.js where this is the obvious thing that's done
19:17:10Zevvyeah, same with me and lpeg. Duck typing makes some things easier
19:17:14FromGitter<liquid600pgm> but that's due to the dynamic nature of JS
19:17:19Zevvand Lua
19:17:28FromGitter<liquid600pgm> yes
19:18:09FromGitter<liquid600pgm> as I learned recently from my adventures with Lua and game dev, dynamic typing is sometimes your worst debugging nightmare
19:18:25FromGitter<liquid600pgm> yet sometimes it's super useful
19:19:09ZevvWell, 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:07ZevvOne 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:26ZevvI have an implementation that fixes that, but I hate the notation and API, so didn't make it in
19:21:41FromGitter<liquid600pgm> yeah I just create the Parser in a separate `parseScript` proc
19:21:54FromGitter<liquid600pgm> that allows me to have a distinct state, but it's not perfect
19:22:01Zevvright
19:38:44*rnrwashere quit (Remote host closed the connection)
19:43:44Mister_Magisterits there some quick way of getting last element in sequence?
19:43:58FromGitter<liquid600pgm> sequence[^1]
19:44:00Zevv[^1]
19:44:25Mister_Magisterthanks!
19:45:10Mister_Magisternim is beautif ul
19:53:35Mister_Magisterif 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:17FromGitter<liquid600pgm> toUpper from strutils is exported from unicode
19:54:41Mister_Magisterohh
19:55:23*aranhaagency joined #nim
19:56:34Araqwait what? unicode.toUpper MUST work
19:56:53Mister_MagisterError: 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:57FromGitter<liquid600pgm> Zevv: shouldn't it be possible to implement Unicode support in NPeg using the `unicode` module and `Rune`?
20:03:14FromGitter<liquid600pgm> so that instead of matching a string, we match a `seq[Rune]`?
20:07:47ZevvProbably, but performance, I wouldnt want that to be the default. But maybe it can be genericized, that would be a pretty solution
20:10:04Zevvotoh, 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:55FromDiscord_<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:31Zevvwill not necessarily result in clear or understandable rules, but yes :)
20:15:46Zevvbut unicode and utf8 is not the same thing
20:17:38*rnrwashere joined #nim
20:19:18skrylar[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:24FromGitter<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:26FromGitter<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:32FromGitter<jrfondren> x mod (uint64(max)+1u64)
21:21:39FromGitter<jrfondren> well that's obviously a division by zero
21:21:41FromGitter<kayabaNerve> Oh. That's a RangeError except when you have checks:off
21:22:00*rockcavera joined #nim
21:22:18FromGitter<jrfondren> oh that's not uint64.max
21:22:34FromGitter<jrfondren> are you passing uint64.max as the `max` parameter?
21:22:48FromGitter<kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ceb03a89d64e537bc177032]
21:22:58FromGitter<kayabaNerve> I promise you I have a reason
21:23:03FromGitter<kayabaNerve> :thinking:
21:23:10FromGitter<kayabaNerve> I think it's casting to a negative
21:23:38FromGitter<kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ceb03da8f019114aebfbd1f]
21:23:45FromGitter<kayabaNerve> Here's the version with checks
21:24:24FromGitter<jrfondren> yep, you're passing uint64.max
21:24:54FromGitter<kayabaNerve> ... the check is running with `not int8(0)`
21:24:58*lritter quit (Ping timeout: 272 seconds)
21:25:08FromGitter<kayabaNerve> How is that uint64 max?
21:25:43FromGitter<jrfondren> ot
21:25:45FromGitter<jrfondren> it's -1
21:25:53FromGitter<jrfondren> which is uint64.max
21:27:03FromGitter<jrfondren> what you're expecting is 255
21:27:32FromGitter<jrfondren> which is what you get with uint8(0)
21:29:06FromGitter<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:03FromGitter<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:31FromGitter<jrfondren> use uintX(0) then for those
21:31:33FromGitter<kayabaNerve> You're recommending `int(uint(0))` ?
21:31:45FromGitter<kayabaNerve> I can't use an uint in rand so I do need the result to be an int :P
21:31:54FromGitter<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:15FromGitter<jrfondren> I'm recommending not(uint8(0))
21:33:03FromGitter<kayabaNerve> Got it. Thank you.
21:33:09FromGitter<kayabaNerve> I see the issue now.
21:33:18FromGitter<kayabaNerve> An int 0 has half of its bytes set.
21:33:29FromGitter<kayabaNerve> To be clear though. I'm not doing anything with 64 bit ints
21:33:32FromGitter<kayabaNerve> I cap at 32
21:33:48FromGitter<jrfondren> yeah the conversion happens in rand
21:34:42FromGitter<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:00FromGitter<jrfondren> -1 is an OK `int`. it's out of bounds as a `Natural`
21:43:37FromGitter<Varriount> kayabaNerve: How are things going?
21:45:09*vlad1777d joined #nim
21:45:24FromGitter<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:31FromGitter<Varriount> *lexer accept
21:50:20FromGitter<kayabaNerve> @Varriount Good! Just cleaning up my tests.
21:50:25FromGitter<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:25FromGitter<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:53FromGitter<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