<< 15-05-2022 >>

00:00:29FromDiscord<!Patitotective> stacklang is the definition of text
00:00:34FromDiscord<!Patitotective> (edit) "stacklang is the definition of text ... " added "https://github.com/PMunch/stacklang"
00:27:12FromDiscord<!Patitotective> or i can copy this lol https://github.com/KatrinaKitten/honeycomb/blob/master/tests/test.nim#L698
00:42:10*noeontheend quit (Ping timeout: 240 seconds)
01:17:09*arkurious quit (Quit: Leaving)
01:42:24FromDiscord<System64 ~ Flandre Scarlet> In reply to @Patitotective "ho would i evaluate": JavaScript be like
01:42:49FromDiscord<!Patitotective> In reply to @System64 "JavaScript be like": haha i actually copied that from js
01:42:57FromDiscord<System64 ~ Flandre Scarlet> ah alright lol
01:44:38FromDiscord<!Patitotective> i got it working using honeycomb https://katrinakitten.github.io/honeycomb https://media.discordapp.net/attachments/371759389889003532/975212078862303273/ImTemplate-2.mp4
01:50:13*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
01:52:06*Lord_Nightmare joined #nim
02:22:36FromDiscord<aph> damn
02:26:17NimEventerNew thread by Elcritch: Fidgetty: themes ... ?, see https://forum.nim-lang.org/t/9155
02:40:11*vicfred joined #nim
04:02:51*slowButPresent quit (Quit: ERC 5.4 (IRC client for GNU Emacs 28.1))
04:04:38*Zectbumo joined #nim
04:38:17*duuude quit (Ping timeout: 248 seconds)
06:23:15FromDiscord<Rika> In reply to @Elegantbeef "Or consider using pmunch's": Yardanico has a math expression evaluator
06:34:35FromDiscord<Zectbumo> sent a code paste, see https://paste.rs/0IZ
06:34:43FromDiscord<Zectbumo> (edit)
06:35:09FromDiscord<Zectbumo> (edit) "https://play.nim-lang.org/#ix=3XOn" => "https://play.nim-lang.org/#ix=3XOm"
06:37:38FromDiscord<huantian> I mean that’s probably the best way
06:38:04FromDiscord<Phil> I don't know of any parseInt that allows for a default value if it fails.↵Best I can think of is maybe looking into "isEmptyOrWhitespace" but that does more than you might want it to (It would recognize " " as true which you didn't want)
06:38:22FromDiscord<Phil> (edit) "I don't know of any parseInt that allows for a default value if it fails.↵Best I can think of is maybe looking into "isEmptyOrWhitespace" ... but" added "for your initial check to use std-lib stuff,"
06:38:47FromDiscord<Zectbumo> sent a code paste, see https://paste.rs/I5s
06:38:48FromDiscord<Elegantbeef> or just `echo try: parseint(str): except 0`
06:39:32FromDiscord<huantian> ~~Make a typed sql wrapper~~
06:40:25FromDiscord<Zectbumo> In reply to @Elegantbeef "or just `echo try:": I tried this but I get invalid indentation
06:40:32FromDiscord<Phil> Surprisingly enough, getValue does not return an optional, huh
06:40:35FromDiscord<Phil> TIL
06:41:01FromDiscord<Zectbumo> right? they kinda force the ""
06:41:17FromDiscord<Rika> In reply to @Zectbumo "I tried this but": Missing colon after except
06:41:19FromDiscord<Rika> Add that
06:41:20FromDiscord<Phil> Write your own wrapper proc that does this properly
06:41:28FromDiscord<Phil> (edit) "Write your own wrapper proc that does this properly ... " added "and then you can deal with it from there"
06:41:29FromDiscord<Rika> Beef is old and forgetful
06:41:51FromDiscord<Rika> Also what the fuck beef you put the colon before except
06:41:56FromDiscord<Rika> Remove that too lol
06:42:26FromDiscord<Elegantbeef> single line expressions make me write bad code cause they're bad
06:43:03FromDiscord<Zectbumo> !eval echo try: "".parseInt except: 0
06:43:04NimBotCompile failed: /usercode/in.nim(1, 6) Error: invalid indentation
06:44:00FromDiscord<Rika> In reply to @Elegantbeef "single line expressions make": Excuses lmao
06:44:33FromDiscord<huantian> Just make a parseIntOrDefault proc or something tbh
06:44:52FromDiscord<huantian> That’ll probably give the cleanest code
06:44:59FromDiscord<Zectbumo> oh "To prevent confusing code there is a parsing limitation; if the try follows a ( it has to be written as a one liner:"
06:45:13FromDiscord<Zectbumo> !eval echo (try: "".parseInt except: 0)
06:45:15NimBotCompile failed: /usercode/in.nim(1, 14) Error: undeclared field: 'parseInt' for type system.string [type declared in /playground/nim/lib/system.nim(34, 3)]
06:45:36FromDiscord<Zectbumo> (edit) "!eval ... echo" added "import std/strutils;"
06:45:37FromDiscord<Phil> Nimbot doesn't import strutils for you?
06:45:39FromDiscord<Phil> huh
06:45:40FromDiscord<Rika> Import the package first, not there by default
06:45:42FromDiscord<Rika> No
06:45:46FromDiscord<Zectbumo> !eval import std/strutils; echo (try: "".parseInt except: 0)
06:45:47FromDiscord<Rika> Nothing is imported by default
06:46:43FromDiscord<Zectbumo> thanks @ElegantBeef
06:47:19FromDiscord<huantian> Though do note that’ll catch all paraeInt fails
06:52:32FromDiscord<Phil> sent a long message, see http://ix.io/3XOr
06:52:48FromDiscord<Phil> (edit) "http://ix.io/3XOr" => "http://ix.io/3XOs"
06:56:09FromDiscord<Elegantbeef> distincts
06:57:46FromDiscord<Phil> You mean make the newHook procs distinct somehow?↵I'm not sure how that'd work and how jsony would know which newHook proc to use when, they'd have the same name with the same parameters, just different behaviour
07:03:34FromDiscord<Elegantbeef> You want to have two hooks but the same internal structure yes?
07:04:04FromDiscord<Elegantbeef> If so you do `type MyOtherType = distinct MyType` then do `MyOtherType myType` or similar to convert when you want to parse/emit the specific json
07:05:41FromDiscord<Phil> OHHHHHHH
07:06:08FromDiscord<Phil> Like I could have `type CharacterUpdate = distinct Character` and have a newHook proc for that
07:06:13FromDiscord<Phil> that is really nice!
07:08:19FromDiscord<Elegantbeef> Welcome to a functional type system
07:10:40FromDiscord<Phil> My plan got foiled by the fact I can't actually start a newHook with a DB-entry since I can't query from within a `newHook`, or rather I don't have access to the parameters I'd need.... dangit
07:11:39*ltriant quit (Ping timeout: 240 seconds)
07:19:17FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XOu
07:19:56FromDiscord<Elegantbeef> Isnt that just have all your fields as optional?
07:19:57FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3XOw" => "https://paste.rs/Bz9"
07:21:19FromDiscord<Phil> They'd only be optional in the sense that the user might not send them for an HTTP PATCH request where they only want to update the `description` field of an entry.↵They are not optional in the sense that there MUST be a value.↵In the specific case of an HTTP-PATCH request I just already have a value for it
07:21:29FromDiscord<Phil> (edit) "They'd only be optional in the sense that the user might not send them for an HTTP PATCH request where they only want to update the `description` field of an entry.↵They are not optional in the sense that there MUST be a value.↵In the specific case of an HTTP-PATCH request I just already have a value for it ... " added "in the database and will keep it."
07:21:47FromDiscord<Phil> (edit) "that" => "of the Database, aka"
07:22:10FromDiscord<Phil> (edit) "it" => "them"
07:22:18FromDiscord<Phil> (edit) "it." => "it unchanged."
07:22:27FromDiscord<Elegantbeef> This is the benefit of JsonNode gives you
07:23:07FromDiscord<Phil> Fair, that was my first approach, I guess I should go back to implementing that one, seems to be a case tailor made for it
08:01:16FromDiscord<planetis> I have written something similarities before https://github.com/planetis-m/breakout/blob/master/breakout/loadasset.nim
08:02:01FromDiscord<planetis> Thing is it crashes if fields are not in the correct order
08:03:23FromDiscord<planetis> I have seen others storing the results in temporaries first to make it work
08:05:00FromDiscord<planetis> https://github.com/tandy-1000/uniony
08:05:12FromDiscord<Phil> I'm doing a horrible amalgamation of tons of "when" clauses and handling all the various types my field on the object could have (which is luckily limited since it's representing something in a db-column and I don't deal with JSON) and going through all the possible node-kinds the JsonNode could have and either copying the value from the JsonNode over to the field or raising JsonParseErrors
08:06:38FromDiscord<planetis> You can't really replace JsonNode can you heh
08:10:36*ltriant joined #nim
08:12:33FromDiscord<Phil> Pretty much.↵I'm also basically covering all combinations of "Type I expect to have" and "possible JsonNodeKinds".↵Given I can have string, int, int64, float, bool as well as optionals of all of these.... I've got stuff to write
08:12:49FromDiscord<Phil> (edit) "expect to have"" => "have in model-object""
08:13:55FromDiscord<Phil> I'll definitely need to refactor the spaghetti code I'm currently writing... assuming I find a better way
08:14:03FromDiscord<planetis> I am writing something similar https://github.com/planetis-m/packedjson2/issues/7 don't know how it performs yet
08:14:50FromDiscord<Phil> Holy damn
08:15:20*ltriant quit (Ping timeout: 248 seconds)
08:17:51FromDiscord<planetis> A_raq basically said just use packjson already, but I want to pursue it a little more
08:31:43*retropikzel joined #nim
08:49:28FromDiscord<voidwalker> https://media.discordapp.net/attachments/371759389889003532/975318992715644978/unknown.png
08:51:00FromDiscord<voidwalker> I have to store X tables like this, with n rows and 10~ columns (i know n before creating). In the previous implementation I used a dynamic array made of string[50] in pascal. What do you suggest I do here, for datatypes ?
08:51:25FromDiscord<voidwalker> storing everything in a 50 length string is inefficient, as some columns only contain one char, or a number 0..100
08:51:42FromDiscord<voidwalker> especially since the rows can go into thousands
08:52:02FromDiscord<Elegantbeef> You could use an object variant based off the type held
08:53:07FromDiscord<voidwalker> a little more explicit please ?
08:53:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XOJ
08:53:41FromDiscord<Elegantbeef> that should be `intval: 0u8..100u8` 😄
08:54:01FromDiscord<Elegantbeef> It's a tagged union so each entry will at most use 9 bytes
08:54:21FromDiscord<Elegantbeef> the data the string has is more of course
08:54:48FromDiscord<voidwalker> oh so you mean a record for the individual entries, i see... didn't consider this
08:55:19FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#types-object-variants fully explained here
08:56:24FromDiscord<voidwalker> so a row would be array[1..10, EntryKind]
08:56:47FromDiscord<Elegantbeef> `Entry` but yea
08:57:30FromDiscord<voidwalker> (edit) "so" => "sent" | "row would be array[1..10, EntryKind]" => "code paste, see https://play.nim-lang.org/#ix=3XOK"
08:57:39FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=3XOK" => "https://play.nim-lang.org/#ix=3XOL"
08:58:25FromDiscord<voidwalker> ok, i will look up how to practically make use of this
08:58:49FromDiscord<voidwalker> And how about the rows themselves, how do I store just N of them in memory for each such table ?
08:58:57FromDiscord<voidwalker> since n varies from table to table
08:59:16FromDiscord<Elegantbeef> Use a sequence or similar if it's dynamic
08:59:35FromDiscord<voidwalker> n is static for a table, and i know it before I create the table
08:59:43FromDiscord<voidwalker> but varies between tables
08:59:59FromDiscord<Elegantbeef> Make a generic type so you can do it statically
09:00:32FromDiscord<Elegantbeef> `type Table[Columns: static int] = distinct array[Columns, Row]`
09:01:05FromDiscord<voidwalker> ok, what do I have to read up on this, I never used generics in any language
09:01:30FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#generics the generic docs will probably help
09:02:59*jmdaemon quit (Ping timeout: 240 seconds)
09:05:52*ltriant joined #nim
09:05:53FromDiscord<Elegantbeef> Generics just let you easily create contains for different types, in this case different sized arrays
09:09:58FromDiscord<Elegantbeef> containers and procs for different types\ 😄
09:09:59FromDiscord<voidwalker> I know that, just trying to wrap my head around the code you presented. 'static' and 'distinct' are also new to me
09:10:05FromDiscord<voidwalker> A static statement/expression explicitly requires compile-time execution. Even some code that has side effects is permitted in a static block:
09:10:57FromDiscord<Elegantbeef> Static generic parameters are generics delimited by a value
09:11:09FromDiscord<Elegantbeef> IE `array[10,int] isnot array[9, int]`
09:34:40NimEventerNew post on r/nim by insomniac_lemon: Runtime iterated variable names?, see https://reddit.com/r/nim/comments/uq2i0h/runtime_iterated_variable_names/
09:42:55FromDiscord<voidwalker> I need more examples for generic types. And why doesn't yours have [T] @ElegantBeef ?
09:43:11FromDiscord<Elegantbeef> It's just a generic parameter name
09:43:16FromDiscord<Elegantbeef> It doesnt have to be `T` it can be whatever you want
09:45:13FromDiscord<jmgomez> Hey guys, any idea of how to check if a dynlib is open/being used? (it may be similar of a so file)
09:46:38FromDiscord<jmgomez> oh I think it can be done with dlopen
09:48:20FromDiscord<voidwalker> type Table[Columns: static int] = distinct array[Columns, Row] - ok it's been alost an hour and I still don't understand this. What are Columns and Row supposed to be in this context ?
09:48:45FromDiscord<voidwalker> I declare a const Columns = 10, since columns are constant ?
09:49:09FromDiscord<voidwalker> (edit) "alost" => "almost"
09:51:43FromDiscord<Rika> No you declare a type `Table[10]`
09:51:56FromDiscord<Rika> And now that table type has Columns set to 10
09:52:11FromDiscord<Rika> Think of it as a “variable that’s local to a type” kind of?
09:52:26FromDiscord<voidwalker> not the same as const colN = 10 and Table[ColN]
09:52:38FromDiscord<voidwalker> (edit) "not the same as const colN = 10 and Table[ColN] ... " added "?"
09:52:51FromDiscord<Rika> Was that capitalisation mismatch intentional?
09:53:02FromDiscord<Rika> If it wasn’t, then they would be the same; constants are folded
09:53:11FromDiscord<voidwalker> (edit) "Table[ColN]" => "Table[colN]"
09:53:36FromDiscord<Rika> And only if that second part was a type usage and not the declaration
09:53:56FromDiscord<voidwalker> (edit) "not the same as const colN = 10 and ... Table[colN]" added "type"
09:54:26FromDiscord<Rika> So declaring a constant then a type Table[constantName: static something], the constant won’t be put in the type automatically
09:54:26FromDiscord<voidwalker> I thiink I ruined my brain trying to understand that line : \
09:54:51FromDiscord<Rika> But if it’s a usage var a: Table[constantName] then it works
09:56:00FromDiscord<Rika> I’m on mobile so I have to carefully choose how to explain it (without code because xd what a pain to deal with keyboards on mobile)
10:07:26FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XOV
10:11:54*retropikzel left #nim (#nim)
10:37:04*duuude joined #nim
10:44:02*Zectbumo quit (Remote host closed the connection)
11:25:44*oprypin quit (Ping timeout: 260 seconds)
11:26:51*pro joined #nim
11:38:02*pch quit (Ping timeout: 246 seconds)
12:32:26*slowButPresent joined #nim
12:33:42FromDiscord<Andreas> would anybody pls. sho we how one can a finalizer-proc to a variant-type using `new[T](a: var ref T; finalizer: proc (x: ref T)` - if it is possible at all ?
12:33:53FromDiscord<Andreas> (edit) "sho we" => "show me"
12:34:07FromDiscord<Andreas> (edit) "it" => "that"
12:34:58FromDiscord<Andreas> (edit) "would anybody pls. show me how one can ... a" added "add"
12:35:13FromDiscord<Andreas> (edit) "how one can" => "how-to"
12:35:39FromDiscord<Rika> You just add it? What do you mean? What’s the issue you were having
12:35:45FromDiscord<Rika> When you tried
12:38:25FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=3XPb
12:38:43FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=3XPb" => "https://paste.rs/36T"
12:43:39FromDiscord<demotomohiro> https://nim-lang.org/docs/system.html#new,ref.T,proc(ref.T)↵First parameter of that `new` is `ref Test` type variable.
12:43:44FromDiscord<Rika> a is an instance of your type
12:43:46FromDiscord<Rika> Not the type
12:45:30*pro quit (Quit: pro)
12:46:40FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3XPd
12:48:47FromDiscord<federico3> raising any exception in a proc implies RootEffect ?
12:51:43*oprypin joined #nim
13:06:57FromDiscord<Phil> In reply to @Elegantbeef "This is the benefit": Actually, finally finished that approach!↵I'm... well, I'm happy it works, but I feel like it isn't really the most readable code I've ever written.
13:08:26FromDiscord<Phil> I ended up writing like half a dozen templates and copious amounts of `raise newException` if the model wanted a type that I could not possibly get out of the given JsonNode based on its JsonNodeKind.↵↵If anyone wants to give some pointers on what I could improve, I've opened a question on stackexchange codereview:↵https://codereview.stackexchange.com/questions/276555/transferring-values-from-a-json-string-into-an-object-instance-in-ni
13:08:44FromDiscord<Phil> (edit) "the model" => "a field" | "a fieldwanted ... a" added "a value of"
13:09:12FromDiscord<Phil> Sidenote, NimEventer does not monitor stackexchange codereview as I've come to realize
13:39:32FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=3XPm
13:40:09FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=3XPm" => "https://play.nim-lang.org/#ix=3XPn"
13:40:57FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=3XPn" => "https://paste.rs/uo5"
13:41:20FromDiscord<Andreas> (edit) "https://paste.rs/NeC" => "https://play.nim-lang.org/#ix=3XPo"
13:41:54FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3XPp
13:54:35FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XPw
13:54:54FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3XPw" => "https://paste.rs/BI0"
13:55:09FromDiscord<Rika> does that not work
13:55:29FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XPx
13:56:11FromDiscord<Rika> `(wolf[]).fieldPairs`
13:56:14FromDiscord<Rika> sorry]
13:56:25FromDiscord<Rika> `wolf[].fieldPairs` parens not neede
13:56:25FromDiscord<Phil> What do the "[]" do?
13:56:26FromDiscord<Rika> (edit) "neede" => "needed"
13:56:28FromDiscord<Rika> dereference
13:56:34FromDiscord<Phil> OHHHHHHH
13:56:37FromDiscord<Phil> That's why this works
13:56:43FromDiscord<Phil> I've seen this before and was so damn confused
14:01:12FromDiscord<Phil> Can you always just dereference a `ref object` to use a proc that expects an `object` parameter?
14:01:19FromDiscord<Phil> (edit) "parameter?" => "parameter, or are iterators special?"
14:01:52FromDiscord<Phil> I'm asking since the iterators according to the docs expect tuples/objects most of the time
14:02:01FromDiscord<Phil> (edit) "I'm asking since the iterators according to the docs expect tuples/objects most of the time ... " added "and none of them explicitly expects a ref object type"
14:04:20FromDiscord<Generic> yes I think so
14:09:02FromDiscord<demotomohiro> You can use `[]` to dereference `ref object` and pass it to procs that takes `object` as long as it is not nil.
14:09:03FromDiscord<Rika> fields is special since its not a real iterator
14:14:25FromDiscord<Phil> sent a code paste, see https://paste.rs/loh
14:14:40FromDiscord<Phil> (edit) "https://paste.rs/dLR" => "https://play.nim-lang.org/#ix=3XPG"
14:15:52NimEventerNew question by Philipp Doerner: How do I iterate over the fields of a ref object in nim?, see https://stackoverflow.com/questions/72249059/how-do-i-iterate-over-the-fields-of-a-ref-object-in-nim
14:16:29FromDiscord<Phil> Fun fact, I'm not even 6 months into the language and already I've started googling my own SO questions to nim
14:17:35FromDiscord<Rika> interesting strategy ngl
14:17:55FromDiscord<Rika> i dont think ive ever needed to do something similar
14:18:46FromDiscord<Phil> if norm didn't force ref types onto me with Models I don't think I would either
14:19:26*arkurious joined #nim
14:19:52FromDiscord<Phil> But since it does and model-instances are basically the bread and butter of my web application, I end up doing a whole bunch of things with ref-types that I otherwise would've done with value types
14:20:10FromDiscord<Rika> i mean, use SO quesitons
14:20:17FromDiscord<Phil> Oh, that, fair
14:20:37FromDiscord<Phil> Before nim I used them more for actually getting my problems solved
14:21:03FromDiscord<Phil> But with nim I just knew I needed something I could google because it'd soon be more than I could keep in my head for prolonged periods of time
14:22:03FromDiscord<Phil> Particularly doing a whole bunch of stuff with types at compile time is its own dangerous dance with the devil
14:22:29FromDiscord<Phil> I'd already forgotten how to get the inner type of an option at compile time when I remembered that I'd faced that issue once before and back then leorize helped me find the answer
14:28:27FromDiscord<Rika> In reply to @Isofruit "I'd already forgotten how": .get? or you really mean inner type
14:29:18FromDiscord<Phil> The actual type inside the optional from just the optional typedesc.↵That's `genericParams(fieldValue.type()).get(0)`
14:29:40FromDiscord<Phil> fieldValue = the parameter with the typedesc[Option[<SomeType>]]
14:30:25FromDiscord<Rika> does `typeof(option).T` not work?
14:30:36FromDiscord<Rika> (edit) "`typeof(option).T`" => "`typeof(valueThatIsOption).T`"
14:30:46FromDiscord<Rika> !eval import std/options; var a: Option[int]; echo typeof(a).T
14:30:55FromDiscord<Phil> Let me check if that lets my program compile
14:31:13FromDiscord<Rika> if its a typedesc then you dont need to typeof
14:32:08FromDiscord<Phil> Huh, that also works
14:32:57FromDiscord<Phil> In fact, even `fieldValue.T` does it (fieldValue is from an iterator over a Model-type)
14:33:24FromDiscord<Phil> I'll add that as an additional response to the question
14:33:31FromDiscord<Rika> yeah you can access generic parameters as long as you know their name
14:33:53FromDiscord<Rika> which is why i dont like it when people name their parameters T
14:34:10FromDiscord<Rika> probably should follow c++ (gasp) in this sense
14:59:03FromDiscord<Phil> In reply to @Rika "probably should follow c++": As someone that never touched C++, I assume they give their generic types proper names?
14:59:10FromDiscord<Rika> they do
14:59:24FromDiscord<!Patitotective> how could i get the indexes of the matches of `findAll`? https://nim-lang.org/docs/re.html#findAll%2Cstring%2CRegex%2Cint
15:00:15FromDiscord<Phil> Hmm fair, I do like that one. I already do this in fact for my procs that generate prologue-handler-procs, just not anywhere else.
15:06:13FromDiscord<huantian> In reply to @Patitotective "how could i get": Make your own version, probably
15:06:40FromDiscord<huantian> Wait no that’s the regex find all, can you even do that with regex
15:08:13*arkt8 quit (Quit: Leaving.)
15:08:19FromDiscord<huantian> Maybe there’s a function I don’t know about but you’d probably have to modify the findAll iterator
15:09:18FromDiscord<!Patitotective> i have a string like this `=A2+2+F89` so i want to get `@[("A2", 1), ("F89", 6)]`
15:09:45FromDiscord<Rika> whats your regex
15:09:51*arkt8 joined #nim
15:10:12FromDiscord<!Patitotective> `([A-Za-z])([0-9]{1}|[0-9]{2})`
15:12:09FromDiscord<!Patitotective> actually it can be `([A-Za-z])([0-9]{1,2})`
15:16:18FromDiscord<gmag> Hello 🖐️ 🤓 ↵I'm so excited with Nim! I come from a Python background and immediately tried to play with nimpy and nimporter (kudos to the devs, wonderful packages!). I was wondering how easy/difficult would be integrate numpy arrays, maybe I missed some pertinent documentation on that matter, perhaps someone may kindly give me some pointers.
15:21:12FromDiscord<Phil> In reply to @gmag "Hello 🖐️ 🤓 ": I sadly can't offer much here, I assume the integration would be necessary due to an existing codebase using numpy arrays?
15:23:11*arkt8 left #nim (#nim)
15:23:44FromDiscord<gmag> In reply to @Isofruit "I sadly can't offer": Yes indeed, but also because numpy is sort of the bread and butter for scientific stuff and the glue to integrate with other packages in the Python ecosystem
15:25:05FromDiscord<Phil> Is the goal to generate packages to use in python?
15:25:09FromDiscord<Phil> (edit) "Is the goal to generate packages ... to" added "with nim"
15:31:00FromDiscord<gmag> yes, that's the idea. I have an example repo (based on nimporter examples) that does really the basics (https://github.com/gmagno/nym). And I'm now thinking how to expose a numpy array. This is mostly for fun purposes, there is no goal in mind yet.
15:32:38NimEventerNew thread by Stoneface86: How to add custom links in doc gen?, see https://forum.nim-lang.org/t/9156
15:33:07FromDiscord<gmag> I've used Pybind11 in the past and the interoperability is really interesting. It would be fantastic to reach that kind interoperability in Nim
15:33:47FromDiscord<Phil> Rika, did you play around with importing python into nim?
15:39:02FromDiscord<root> how do i import my own python files into my nim project? I know how to import external libraries but not my own .py files :/
15:39:04FromDiscord<Phil> In reply to @gmag "I've used Pybind11 in": Should currently you be unable to find somebody that has played around a bit more with python/nim interop, I'd highly recommend throwing up a topic in the nim forum.↵And if you're feeling very generous, you can even write up self-answered question on SO with your results (it's what I currently do whenever I solve something that stops me for a bit)
15:41:02FromDiscord<Phil> I've written a decent amount of python in webdev, so I can talk with you regarding how you can express certain things that you do in python in nim, but that's around it. My current webdev project is pretty much reimplementing my python code for funsies and ego (since nim provides hilarious levels of speed-up)
15:43:58FromDiscord<xflywind> I used nimpy before: https://github.com/yglukhov/nimpy when I need some procs from opencv-python.
15:46:48FromDiscord<gmag> @Phil Thanks, I appreciate the feedback and time. I will definitely continue sharing my findings.
15:47:08FromDiscord<xflywind> See also https://github.com/yglukhov/nimpy#troubleshooting-qa
15:47:25FromDiscord<Yardanico> yeah nimpy is the way to go
15:48:14FromDiscord<xflywind> (edit) "See also https://github.com/yglukhov/nimpy#troubleshooting-qa ... " added " "Is there any numpy compatibility"?"
15:48:59FromDiscord<xflywind> It seems that https://github.com/SciNim/scinim/blob/main/scinim/numpyarrays.nim provides numpy interoperability.
15:49:07FromDiscord<Rika> In reply to @Isofruit "Rika, did you play": No
15:49:23FromDiscord<Rika> I never did any Python Nim interoperation
15:49:26FromDiscord<xflywind> > nimpy allows manipulating numpy objects just how you would do it in Python, however it is not much more efficient. scinim offers API for performance critical numpy interop, and it is advised to consider it first.↵> ↵> Nimpy also exposes lower level Buffer protocol, see raw_buffers.nim. tpyfromnim.nim contains a very basic test for this.
15:50:40NimEventerNew thread by Morturo: Problem with --threads:on, see https://forum.nim-lang.org/t/9157
15:52:23FromDiscord<Phil> In reply to @flywind "It seems that https://github.com/SciNim/scinim/blob": Ohhh I saw the thread when scinim was published, the fact they have that interop is pretty cool
15:53:03FromDiscord<xflywind> Yeah, they are awesome!
15:54:01FromDiscord<Phil> In reply to @gmag "<@180601887916163073> Thanks, I appreciate": Expanding on xflywind's plugging of scinim, it appears they also have a gitter:↵https://gitter.im/SciNim/community
15:54:12FromDiscord<Yardanico> no need for a gitter
15:54:14FromDiscord<Yardanico> #science
15:54:41FromDiscord<Phil> Sometimes I forget that I have like 80% of the channels on here muted, yeah science is likely also a pretty good resource
15:54:50FromDiscord<Yardanico> In reply to @Isofruit "Sometimes I forget that": wdym "likely"
15:54:54FromDiscord<Yardanico> it's literally bridged to the gitter :D
15:54:59FromDiscord<gmag> ah
15:55:02FromDiscord<Phil> It is? nice!
15:55:03FromDiscord<gmag> fantastic!
15:55:04FromDiscord<Yardanico> and matrix (but gitter is matrix too anyway)
15:55:23FromDiscord<Yardanico> no one actually uses gitter for science it seems, mostly matrix or discord
16:06:15*PMunch joined #nim
16:16:27*duuude quit (Ping timeout: 240 seconds)
16:18:44*xet7 quit (Remote host closed the connection)
16:19:52*xet7 joined #nim
16:27:54FromDiscord<eyecon> Is it good form to shadow the proc parameters to make some adjustments? Like, a short form is possible but I have to expand it first, and to avoid having two procs I just expand it at the beginning and overwrite the user-given proc parameter? If not, how else would you do it?
16:29:34FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3XQw
16:31:00FromDiscord<Yardanico> yeah it's totally fine if you shadow the proc arguments by modifying them into new variables
16:31:23FromDiscord<Yardanico> in fact you can even (ab?)use `sink` for that
16:31:50FromDiscord<Yardanico> `sink` is meant for move semantics and it's an annotation that prevents a copy when an argument that is being passed to the proc is not used afterwards
16:31:54FromDiscord<Yardanico> in other cases `sink` just returns a copy
16:32:23FromDiscord<Yardanico> but the main part is that `sink`'d arguments are mutable so you don't need to redeclare them and can instead modify them directly
16:32:55FromDiscord<Yardanico> I honestly don't know if it's okay to use `sink` that way, but I did use it for that myself and seen some other people do the same :)
16:33:45FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XQx
16:34:25FromDiscord<Yardanico> and don't worry, `sink` works with refc GC as well, it's just that there it always copies
16:34:31FromDiscord<eyecon> Thanks. I cannot find a documentation about `sink` except hooks, where can I read more about this?
16:34:40FromDiscord<Yardanico> https://nim-lang.org/docs/destructors.html#sink-parameters
16:35:17*duuude joined #nim
16:36:12FromDiscord<Yardanico> Anyway, if you don't want to use somewhat "obscure" features like this you can just shadow proc arguments, it's completely acceptable.
16:36:28FromDiscord<eyecon> Thanks, will read about them
16:42:07*pch joined #nim
16:52:31PMunchOh this is weird
16:52:44PMunchI have a macro which takes a uint8 and varargs[untyped]
16:53:02PMunchIf I call that from a template it fails to find the macro
16:53:15PMunchMarking the template as dirty makes it work
17:01:56FromDiscord<!Patitotective> sus ඞ
17:03:44PMunchYeah it's doing a couple of these really weird things..
17:11:35FromDiscord<treeform> In reply to @Isofruit "<@107140179025735680> Question regarding": You can do this with a 2 line parse hook:
17:11:57FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3XQE
17:13:04FromDiscord<treeform> 1 line 🙂
17:13:05FromDiscord<treeform> sent a code paste, see https://paste.rs/xCe
17:16:29FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XQI
17:17:28FromDiscord<Phil> My intended control flow is↵Http Patch request --> Query entry from Db --> update values from entry with whatever is in the json --> save updated entry to DB
17:17:48FromDiscord<Phil> (edit) "My intended control flow is↵Http Patch request ... -->" added "with entry-id + some key-value pairs in JSON format"
17:18:18FromDiscord<treeform> you could do a sqlQuery inside the newHook?
17:18:31FromDiscord<Phil> Yeh but I don't have access to the ID that I want to use to query
17:18:43FromDiscord<Phil> That is unless I generate the newHook with the ID that I receive at runtime
17:18:53FromDiscord<treeform> just a moment parse hook would do the job
17:18:53FromDiscord<Phil> And I'm not sure that works
17:21:40FromDiscord<treeform> A little more complex as you need to parse the object twice:
17:21:48FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3XQK
17:22:38FromDiscord<Phil> My scenario is even more messed up than that.↵You get the id not via the json, in the json are only the fields you want to update and nothing else.↵The id you receive as a path-parameter from the HTTP-Request-URL
17:23:37PMunchNow I'm getting some really weird type issues..
17:23:37FromDiscord<Phil> That is, assuming I do not touch anything in my frontend.↵The alternative would be adding the id to the JSON that is being sent and then I could do it with a parsehook
17:25:18*jmdaemon joined #nim
17:27:42FromDiscord<treeform> In reply to @Isofruit "My scenario is even": Use new hook as a closure with an external id?
17:28:40FromDiscord<treeform> it does not appear to work due to nim's polymorphism rules
17:28:43*krux02 joined #nim
17:34:10*jmd_ joined #nim
17:34:54*jmdaemon quit (Ping timeout: 252 seconds)
17:36:07FromDiscord<treeform> using globals would be easy, but I don't think that is what you want
17:40:13FromDiscord<treeform> this is the best I got
17:40:15FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3XQO
17:40:29FromDiscord<treeform> don't know how to make generation of merge without macros
17:50:29FromDiscord<iamtakingithard> sent a code paste, see https://play.nim-lang.org/#ix=3XQQ
17:55:49FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XQR
17:56:01FromDiscord<Yardanico> anyway, any reason you're asking for the complete code instead of trying to do it yourself first? 🤔 it's good for learning
17:57:10FromDiscord<Yardanico> @iamtakingithard hallo
17:59:11NimEventerNew thread by Solomonthewise: Interesting proposal for Error handling and Null through unified option Type., see https://forum.nim-lang.org/t/9158
18:00:07FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3XQT
18:00:08FromDiscord<System64 ~ Flandre Scarlet> okay so Nim cannot run on Windows 2000
18:00:51FromDiscord<Yardanico> In reply to @treeform "this is what I": i guess this is closer to his code (except the main function) than mine 🤔
18:00:56FromDiscord<Yardanico> also you don't need .items for toSeq
18:01:03FromDiscord<Yardanico> toSeq iterates by itself if items is defined for the variable
18:01:07FromDiscord<treeform> did not know that
18:06:12FromDiscord<Yardanico> and @iamtakingithard was never heard again...
18:08:58*kenran joined #nim
18:11:43FromDiscord<iamtakingithard> In reply to @Yardanico "and <@790153860130799616> was": I was busy with talking irl friend, xd
18:11:53FromDiscord<iamtakingithard> In reply to @treeform "this is what I": Thank you!
18:12:03FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XQW
18:12:18FromDiscord<Yardanico> but any reason you wanted to see others make this thing, and not try yourself? just curious as that's a pretty weird request
18:13:11FromDiscord<Yardanico> this code is pretty simple and it translates quite close from Python to Nim
18:13:13FromDiscord<Andreas> how can a get the ref to a variant-type ?
18:13:38FromDiscord<Yardanico> In reply to @Andreas "how can a get": wdym? it's no different than any other normal objects
18:13:46FromDiscord<iamtakingithard> In reply to @Yardanico "this code is pretty": I am more of uh visual learner. If i can see the differences between Python and Nim one I would know what to use.
18:13:56FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XQX
18:14:06FromDiscord<Yardanico> In reply to @iamtakingithard "I am more of": i doubt that these examples will really help you to learn Nim, but that's just my opinion
18:14:41FromDiscord<root> how do i import my own .py files into my nim project with nimpy?
18:14:44FromDiscord<Yardanico> Python and Nim are actually quite different, "visual" differences won't be enough :)
18:15:07FromDiscord<iamtakingithard> In reply to @Yardanico "Python and Nim are": well, there's section nim for python programmers
18:15:29FromDiscord<Yardanico> yes, but it just shows some of the simple differences
18:15:57FromDiscord<Yardanico> a lot of nim concepts don't exist in Python at all, and a lot of idioms that do exist in both languages are much less frequently used in Nim than in Python
18:16:26FromDiscord<Yardanico> In reply to @iamtakingithard "well, there's section nim": also, keep in mind that this wiki page is community-contributed, it's not official documentation
18:18:22FromDiscord<Yardanico> In reply to @root "how do i import": something like https://github.com/yglukhov/nimpy/issues/255#issuecomment-1053706906
18:18:43FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=3XQZ
18:18:50FromDiscord<Yardanico> In reply to @Andreas "hi, well with variants,": huh?
18:18:57FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=3XQZ" => "https://play.nim-lang.org/#ix=3XR0"
18:19:11FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=3XR0" => "https://play.nim-lang.org/#ix=3XR1"
18:19:16FromDiscord<Yardanico> if your object is already a ref you don't need to prepend `ref` to its type again
18:19:32FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=3XR1" => "https://play.nim-lang.org/#ix=3XR3"
18:20:11FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XR5
18:23:03FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=3XR6
18:23:32FromDiscord<Yardanico> yes of course if you want a finalizer, but IMO it's better to use destructors as those are "native" to arc/orc while finalizers are "native" to refc but not arc/orc
18:23:38FromDiscord<Yardanico> and orc will become default in nim 2.0
18:23:59FromDiscord<Yardanico> but again, you can use `new` with a ref object to assign a finalizer to it, yes
18:24:20FromDiscord<Yardanico> `new` doesn't create a `ref Type` if you pass it a `Type` that is already a ref
18:26:25FromDiscord<Yardanico> ah, seems like with the finalizer `new` is a bit of a different overload
18:26:56FromDiscord<Andreas> In reply to @Yardanico "ah, seems like with": ok, Rika came up with this one https://discord.com/channels/371759389889003530/371759389889003532/975378666668294174
18:27:20FromDiscord<Yardanico> that makes `t` a `ref ref object` though
18:27:27FromDiscord<Andreas> (edit) "https://discord.com/channels/371759389889003530/371759389889003532/975378666668294174" => "https://discord.com/channels/371759389889003530/371759389889003532/975378666668294174↵which blows-up as soon as i try to set the .kind of t"
18:28:17FromDiscord<Andreas> In reply to @Yardanico "that makes `t` a": ok, so i better try a destructor
18:28:27FromDiscord<Yardanico> you can still do it like this:
18:29:29FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XR9
18:29:55FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XRb
18:31:54PMunchWee, nice I've got i2c working on the Digispark with Ratel now :)
18:33:35FromDiscord<Yardanico> @Andreas one thing to note is that destructors are more "low-level" than finalizers
18:34:11FromDiscord<Yardanico> if you define a custom destructor for a type, then you must manually call `=destroy` for all of the object's fields that are managed by the GC while finalizers do that automatically
18:34:15om3gaHi! How to find element count in SharedList?
18:36:38FromDiscord<Rika> In reply to @Andreas "ok, Rika came up": that wasnt the one i made
18:36:49FromDiscord<Rika> https://discord.com/channels/371759389889003530/371759389889003532/975392559784423504
18:37:40FromDiscord<Andreas> In reply to @Rika "https://discord.com/channels/371759389889003530/371": sry, mea culpa
18:39:38FromDiscord<Phil> I feel like I'm doing something I shouldn't somewhere. I somehow manage to generate `renameHook`-procs through a template (I can even import them into other modules and it compiles, they exist!), yet after the program compiles they aren't being used by jsony.↵↵The `newHook`-procs, generated by the very same template-call work though.↵Codesample incoming
18:42:53PMunchWait, why isn't this in 1.6.6? https://github.com/nim-lang/Nim/pull/19545
18:43:17FromDiscord<Yardanico> In reply to @PMunch "Wait, why isn't this": because it wasn't marked as backported? :)
18:43:38PMunchSo it won't be added until 1.8?
18:43:47FromDiscord<Yardanico> maybe it'll get added to 1.6.8 ?
18:44:05FromDiscord<Yardanico> but yeah, not to 1.6.6
18:44:13PMunchThat doesn't make sense it was merged back in February, so why wouldn't it be in 1.6.6?
18:44:40FromDiscord<Yardanico> In reply to @PMunch "That doesn't make sense": because 1.6 branch isn't devel
18:45:06FromDiscord<Yardanico> 1.6 branch was made in october 2021
18:45:29PMunchYeah, but why would it then be added to 1.6.8?
18:45:43FromDiscord<Yardanico> because you can ping miran and ask him to backport it, that's what i meant
18:45:45FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=3XRd
18:45:55PMunchOh :P
18:46:02FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=3XRd" => "https://play.nim-lang.org/#ix=3XRe"
18:46:09FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XRf
18:46:20FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3XRf" => "https://play.nim-lang.org/#ix=3XRg"
18:46:30FromDiscord<Phil> Honestly, this is a crapshot if anyone has any idea whatsoever, feel free to skip
18:46:42*Zectbumo joined #nim
18:46:46FromDiscord<Yardanico> so is createUpdateHandler defined in encounterDeserialization ?
18:46:49FromDiscord<Yardanico> .nim
18:47:03FromDiscord<Yardanico> or does it import encounterDeserialization ?
18:47:16FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3XRg" => "https://play.nim-lang.org/#ix=3XRh"
18:49:48FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XRi
18:51:24FromDiscord<Phil> `encounterRoutes nim` calls the convenience proc, which calls `createUpdateHandler` to create a handler proc.↵Since that proc is now in the context of `encounterRoutes` and `encounterRoutes.nim` imports `encounterDeserialization.nim` (which has the `renameHook` proc), I would expect the created handler proc to make use of the `renameHook` proc.
18:51:36FromDiscord<Phil> (edit) "`encounterRoutes nim` calls the convenience proc, which calls `createUpdateHandler` to create a handler proc.↵Since that ... proc" added "handler"
18:52:05FromDiscord<Yardanico> what happens if you add `import encounterDeserialization` to `createHandlerProcs.nim` ? does anything change?
18:52:21FromDiscord<Yardanico> just to try
18:52:45FromDiscord<Phil> Yeh, am currently compiling it
18:53:34FromDiscord<Phil> I'll do `from encounter/encounterDeserialization import renameHook` because the other procs in that template that get generated would cause an `ambiguous call` error.
18:54:24FromDiscord<Phil> Still doesn't make use of `renameHook` ↵(I can see that because I fire an HTTP request to that endpoint and the value of the `diaryentry` field is not correctly transferred to the `diaryentry_id` field on `Encounter`
18:54:31FromDiscord<Phil> (edit) "`Encounter`" => "`Encounter`)"
18:54:40FromDiscord<Phil> (edit) "Still doesn't make use of `renameHook` ↵(I can see that because I fire an HTTP request to that endpoint and the value of the `diaryentry` field ... is" added "in the json"
18:57:02FromDiscord<Phil> The worst part is, I can't reproduce this in a minimal code sample. I've done semi-similar setups in a playground-project of mine and there it works.↵But that one doesn't try to use jsony within a proc created by a generic proc
18:57:45FromDiscord<Yardanico> well you can at least try to call renameHook explicitly in createUpdateHandler (just to test, you can create an empty variable of that type) so that it fails at compile time if it doesn't see renameHook
18:57:50FromDiscord<Yardanico> that should make testing faster
19:03:14FromDiscord<Phil> wfasdfjkadsjfsö
19:03:27FromDiscord<root> how do i remove an item from a sequence?
19:03:37FromDiscord<Yardanico> In reply to @Isofruit "wfasdfjkadsjfsö": yes?
19:03:54FromDiscord<Andreas> In reply to @root "how do i remove": delete( seq[], idx..idx)
19:03:54FromDiscord<Yardanico> In reply to @root "how do i remove": `del` and `delete`
19:04:03FromDiscord<root> thank you!
19:04:05FromDiscord<Yardanico> `del` doesn't preserve the order, `delete` does
19:04:13FromDiscord<Yardanico> In reply to @Andreas "delete( seq[], idx..idx)": no need for `[]`, and no need for `..` here
19:04:26FromDiscord<root> how do i get the index of something in a seq?
19:04:29FromDiscord<Yardanico> `find`
19:04:37FromDiscord<Yardanico> just `seq.delete(idx)` or `seq.del(idx)` depending on if you want to preserve the order in the seq or not
19:04:42FromDiscord<Yardanico> to delete
19:04:47FromDiscord<Yardanico> delete preserves, del doesn't
19:05:11FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XRn
19:05:33FromDiscord<Yardanico> In reply to @Isofruit "So I plonked this": well it's not that surprising, because this way you use renameHook right in your proc
19:05:41FromDiscord<Yardanico> and it's not jsony that's trying to use it
19:05:52FromDiscord<Yardanico> as an alternative, try to remove this whole `when` and instead add `bind renameHook` to the start of that proc
19:05:52FromDiscord<Andreas> In reply to @Yardanico "no need for `[]`,": i did `delete( seq, idx:int )` and got a deprecation-warning, range will be accepted in future..
19:06:02FromDiscord<Yardanico> In reply to @Andreas "i did `delete( seq,": ??
19:06:27FromDiscord<Yardanico> ah you're talking about https://nim-lang.org/docs/sequtils.html#delete%2Cseq%5BT%5D%2CSlice%5Bint%5D
19:06:35FromDiscord<Yardanico> this is for removing whole parts of the seq, not one element
19:06:50FromDiscord<Yardanico> system itself defines `del` and `delete` for removing single seq entries already
19:12:53FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XRq
19:12:54FromDiscord<Phil> Still breaks though
19:13:14FromDiscord<Yardanico> nonon, bind outside of `result`
19:13:17FromDiscord<Yardanico> i meant in `createUpdateHandler`
19:13:46FromDiscord<Phil> Hmm alright, let's see
19:13:47FromDiscord<Yardanico> `bind` is not a runtime operation, it's for compile time
19:13:58FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#generics-bind-statement
19:14:07*xet7 quit (Remote host closed the connection)
19:15:07*xet7 joined #nim
19:15:41FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XRr
19:17:17FromDiscord<Yardanico> hmm, and what if you keep this `bind` but also add encounterDeserialization import to `createHandlerProcs.nim` ?
19:17:56FromDiscord<Phil> This is already with `from encounter/encounterDeserialization import renameHook` at the start of `createHandlerProcs.nim`
19:18:34FromDiscord<Yardanico> then i don't have any new ideas, sorry :( guessing without full source code is a bit hard, but it's fine if it's a private project
19:18:42FromDiscord<Yardanico> maybe you can make a post on the forum or open an issue in jsony
19:19:09FromDiscord<Phil> Oh, I can gladly provide full source code, I've got a public github repo
19:19:18FromDiscord<Yardanico> oh why haven't you told that as the very first thing :D
19:19:20FromDiscord<Phil> Just that that source code would spam the entire channel for several screens worth just for this issue
19:19:32FromDiscord<Yardanico> yeah that's fine, just post the link
19:19:47FromDiscord<Yardanico> it's much easier to "try" the code itself than to guess from parts of it
19:20:12FromDiscord<Yardanico> kind of like watching someone else play the game vs playing the game yourself
19:22:04FromDiscord<Yardanico> @PMunch and yeah, in general PRs don't get backported to 1.6 at all so that's why your PR wasn't backported
19:22:24FromDiscord<Yardanico> they only get backported if the author (or someone else) explicitly asked for it either in PR name/commit message or in github commentrs
19:22:26FromDiscord<Yardanico> (edit) "commentrs" => "comments"
19:23:49PMunchYardanico, yeah I keep forgetting this :P
19:25:08FromDiscord<Phil> sent a long message, see http://ix.io/3XRu
19:25:48FromDiscord<Phil> (edit) "http://ix.io/3XRu" => "http://ix.io/3XRv"
19:32:34FromDiscord<Andreas> In reply to @Yardanico "<@754284517316886598> one thing to": hmm, so low they never fire on generics ? Given my signature for `Node[K,V]` = `=destroy[Node](n: var Node) = echo "node died"` never fires ?
19:35:34FromDiscord<huantian> Shouldn’t it be =destroy[K, V](n: var Node[K, V])
19:35:38FromDiscord<Yardanico> yeah
19:35:58FromDiscord<Yardanico> In reply to @Isofruit "In that case, small": i've hit some constructor macro bug, but I'll come to your bug after that :)
19:39:55FromDiscord<Andreas> In reply to @huantian "Shouldn’t it be =destroy[K,": computer says no ` identifier expected, but got ','`
19:40:26FromDiscord<Yardanico> In reply to @Andreas "computer says no `": are you sure you have it this exact way?
19:40:34FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XRy
19:40:53FromDiscord<Yardanico> huantian just omitted ` for =destroy
19:41:26FromDiscord<Andreas> In reply to @Yardanico "are you sure you": yes
19:45:06FromDiscord<Phil> In reply to @Yardanico "i've hit some constructor": Wait, you have?
19:45:11FromDiscord<Phil> Dang
19:45:17FromDiscord<Yardanico> i guess it wasn't checked to work on devel
19:45:47FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XRz
19:46:06FromDiscord<Yardanico> it fails at the assertion in micros/utils.nim `isa(n, ObjectDef)`
19:46:12FromDiscord<Phil> Ohhh constructor bug as in, bug within the constructor package... unrelated from my own?
19:46:21FromDiscord<Phil> (edit) "own?" => "own project?"
19:46:41FromDiscord<Yardanico> because apparently micros walks up the inheritance chain but gets Model as nnkIdent
19:47:07FromDiscord<Yardanico> constructor, not micros
19:47:47FromDiscord<Yardanico> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: when you come online \:)↵(@Yardanico)
19:48:22FromDiscord<Yardanico> In reply to @Isofruit "Ohhh constructor bug as": yeah
19:50:10*droidrage quit (Quit: Gateway shutdown)
19:50:10*qwestion quit (Quit: Gateway shutdown)
19:51:11*xet7 quit (Remote host closed the connection)
19:53:24FromDiscord<Elegantbeef> Untyped AST causes the issue↵(@Yardanico)
19:53:31FromDiscord<Elegantbeef> I apparently dumbly used micros for this but forgot the AST is untyped so it cannot walk up the tree
19:53:37FromDiscord<Yardanico> heh
19:53:48FromDiscord<Yardanico> but how it works for @Phil 🤔
19:53:54FromDiscord<Yardanico> (edit) "but how ... itwork" added "does" | "works" => "work"
19:54:06FromDiscord<Elegantbeef> Older constructor version?
19:54:16FromDiscord<Yardanico> hmm, I used nimble just as him
19:54:16FromDiscord<Phil> Have I transcended into the spaces of "It works and nobody knows why?"
19:54:23FromDiscord<Yardanico> requires "constructor >= 1.0.3"
19:54:27FromDiscord<Phil> Let me check my downloaded constructor version
19:55:05FromDiscord<Yardanico> ah constructor doesn't have tags
19:55:07FromDiscord<Phil> I've got constructor 1.0.3 and only that version
19:55:30FromDiscord<Yardanico> constructor has been at 1.0.3 for 4 months
19:55:39FromDiscord<Elegantbeef> Ah forgot to bump it for the last version
19:55:53FromDiscord<Elegantbeef> Though to be fair i didnt expect any API changes
19:55:59FromDiscord<Yardanico> guess commit 12ffdb55baabbd33f33aec490659d74ae8293232 of constructor will work for me for now
19:56:28FromDiscord<Yardanico> yeah that compiles
19:56:48FromDiscord<Elegantbeef> I assume the error appears in the fields iterator
19:56:50FromDiscord<Yardanico> btw @Phil you forgot to put miniz into nimble requirements :)
19:57:19FromDiscord<Phil> In reply to @Yardanico "btw <@180601887916163073> you forgot": Ahhh right, the compression of the outgoing HTTP response is something I only threw in relatively recently
19:57:24FromDiscord<Yardanico> and is there a reason it's used instead of zippy ? zippy seems to support deflate as well
19:58:40FromDiscord<Phil> I have both, and miniz was just the first one I used.↵I think it compressed on average like 2-3 % more in terms of size, but that's testing by hand for like 3 endpoints or sth
19:59:08FromDiscord<Phil> Overall they were very close to one another in both speed and amount of compression, so I just left it at miniz
20:00:05FromDiscord<Phil> Is there a maintenance reason to prefer one over the other?
20:00:36*ehmry quit (Ping timeout: 240 seconds)
20:01:13FromDiscord<Yardanico> less dependencies, miniz is effectively abandoned, and I can't install it for some reason :)
20:01:28FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/975488100249784340/unknown.png
20:01:32FromDiscord<Elegantbeef> Clearly just use supersnappy 😄
20:02:09FromDiscord<Yardanico> In reply to @Elegantbeef "Clearly just use supersnappy": http doesn't have snappy as a support compression method
20:02:36FromDiscord<Yardanico> (edit) "support" => "supported"
20:03:12FromDiscord<Phil> I'll throw a commit up swapping to zippy and add the necessary readme text
20:04:39FromDiscord<Yardanico> also would be good if the repo had an examplke settings.json already for prologue :)
20:04:53FromDiscord<Yardanico> but I think now i'm close to running the project
20:05:09FromDiscord<Yardanico> "Error: unhandled exception: TINYPOOL: Tried to use uninitialized database connection pool. Did you forget to call 'initConnectionPool' on startup? [PoolDefect]" maybe not
20:06:11FromDiscord<Yardanico> "let databasePath: string = settings.getOrDefault("databasePath").getStr()" ah
20:06:40*ehmry joined #nim
20:06:59FromDiscord<Phil> I'm not that faaaaaast 😄
20:08:10PMunchHmm, so I'd really want to get VUSB wrapped on the Attiny85.. That way I can use serial over USB
20:08:39PMunchAnd since Ratel programs are so tiny the overhead really doesn't matter much :P
20:08:47FromDiscord<Phil> Okay, just pushed an example settings file
20:09:33FromDiscord<Yardanico> yeah it's fine I figured the settings by now :)
20:10:03FromDiscord<Phil> regarding sqlite, since I don't particularly fancy throwing a public version of my db sqlite up, I'll send you one via DMs
20:10:46FromDiscord<Yardanico> well i can do fine with the dev version, I just need a way to trigger your bug
20:11:35FromDiscord<Phil> The main issue really is that I don't have a dev version 😄 ↵The project is tiny enough that it's nothing major anyway, the target userbase is in the lower double digits and I'll never do any sort of payment stuff on this
20:11:39*wallabra quit (Ping timeout: 260 seconds)
20:15:17*PMunch quit (Quit: leaving)
20:37:17FromDiscord<treeform> In reply to @Alea "ah shit that's it,": I think it's an issue with nim's constant type stuff, it does not go far enough and is too eager to turn into float64
20:38:54*kenran quit (Quit: WeeChat info:version)
20:51:05*wallabra joined #nim
21:25:13*jmd_ quit (Ping timeout: 248 seconds)
21:44:36*tk quit (Ping timeout: 252 seconds)
21:44:53*tk joined #nim
22:10:16*def- quit (Quit: -)
22:31:34*noeontheend joined #nim
22:36:56*noeontheend quit (Quit: noeontheend)
22:48:39*def- joined #nim
22:54:37*noeontheend joined #nim
22:54:42FromDiscord<Zectbumo> I just now noticed that the documentation separates parameters with semi-colon ;↵why is that? why not coma , like the declaration is?
22:55:03FromDiscord<Elegantbeef> Semicolon is more explicit
22:55:50FromDiscord<Elegantbeef> Explictly shows where typing of a group of variables end
22:56:04FromDiscord<Elegantbeef> parameters\
22:56:38FromDiscord<Zectbumo> oh is semi-colon allowed in the language? so this is not out of the ordinary
22:56:44FromDiscord<Phil> Which is an argument. I disagree with that assessment and personally stick with the default as outlined by most other languages I know, but it's a point one may agree with
22:56:47FromDiscord<Elegantbeef> Yes
22:57:16FromDiscord<Elegantbeef> `proc doThing(a, b: string, c: int)` and `proc doThing(a, b: string; c: int)` are both valid
22:57:30FromDiscord<Elegantbeef> The latter is more explicit in where the declaration of types end
22:57:52FromDiscord<Elegantbeef> Most other languages dont do group type declarations so moot point↵(@Phil)
22:57:52FromDiscord<Zectbumo> ah very cool. good to know. and even though the source code isn't like that the manual makes it explicit
22:58:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XSh
22:58:59FromDiscord<Zectbumo> I do like that type declaration shortcut
22:59:17FromDiscord<Generic> the semicolon also has another important function for default typed parameters
22:59:25FromDiscord<Generic> you see this most often with generics:
22:59:57FromDiscord<Elegantbeef> Well the semicolon ends the typing of generic parameters `[T; Y: string or int]` is not equivlent to `[T, Y: string or int]`
23:00:16FromDiscord<Zectbumo> oh
23:00:17FromDiscord<Generic> yeah exactly
23:00:33FromDiscord<Elegantbeef> The former case the generic is anything
23:00:37FromDiscord<Elegantbeef> The latter case it's `string or int`
23:00:44FromDiscord<Elegantbeef> T that is
23:00:47FromDiscord<Zectbumo> I was wondering about that case, not that I needed it but I saw that it would come one day
23:01:12FromDiscord<Yardanico> semicolons are also needed with `using`
23:01:20FromDiscord<Elegantbeef> I honestly cant find another language that does group parameter typing
23:01:29FromDiscord<Elegantbeef> Good thing no one uses using
23:01:34FromDiscord<Generic> I use it
23:01:35FromDiscord<Elegantbeef> He repeats to himself
23:02:06FromDiscord<Generic> https://github.com/RSDuck/hocuspocube/blob/master/hocuspocube/gekko/interpreter/ppcinterpreter_int.nim
23:02:06FromDiscord<Yardanico> In reply to @Yardanico "semicolons are also needed": for those who don't know - https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement
23:02:33FromDiscord<Generic> I dare you to repeat `state: var PpcState` so many times
23:02:39FromDiscord<Elegantbeef> I wouldnt
23:02:48FromDiscord<Elegantbeef> I'd do `type MutState = var PpcState`
23:02:59FromDiscord<Elegantbeef> Checkmate atheists
23:03:06FromDiscord<Generic> that's possible?
23:03:22FromDiscord<Generic> though even then you'd need to explictly give that type every time
23:03:39FromDiscord<Elegantbeef> Yes it is
23:03:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XSl
23:05:43FromDiscord<Zectbumo> if you had a ton of procs I can see using being very useful. though, if that's the case then the reader would have to scroll way up to see what these parameters are typed. so maybe copy and paste / search and replace is everyone's friend
23:06:22FromDiscord<Elegantbeef> I just dont like using, it's an odd feature imo, so i just dont use it and pretend it doesnt exist
23:06:33FromDiscord<Generic> you do you, I'm glad it exists
23:07:19FromDiscord<Zectbumo> there is something here for everyone, and that's something I like about nim. and, usually if you don't like it there are answers to that too to change it
23:08:32FromDiscord<Zectbumo> now we just need a "delete keyword" feature for beef
23:08:49FromDiscord<Yardanico> delete what?
23:08:53FromDiscord<Zectbumo> using
23:09:15FromDiscord<Zectbumo> https://discord.com/channels/371759389889003530/371759389889003532/975534637059293254
23:09:38FromDiscord<Elegantbeef> I never collide with it so it's hardly a needed feature
23:09:53FromDiscord<Generic> that's really one of the few things I really don't like about Nim
23:09:57FromDiscord<Generic> it's such a keyword hog
23:10:10FromDiscord<Generic> type, end, block, addr
23:10:24FromDiscord<Zectbumo> answer for that too ↵let `using` = "be your friend"
23:10:34FromDiscord<Zectbumo> (edit) "`using`" => "\`using\`"
23:10:46FromDiscord<Generic> I know this works, but it's ugly
23:10:56FromDiscord<Elegantbeef> Eh nim doesnt have that many keywords
23:11:11FromDiscord<Generic> but they're all things I want to name my variables
23:11:12FromDiscord<Elegantbeef> the only one i've tripped over is bind
23:11:16FromDiscord<Generic> oh yeah bind
23:11:52FromDiscord<Zectbumo> I tripped over "method" the other day
23:12:14FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/975536110006579270/image.png
23:12:17FromDiscord<Elegantbeef> It's not too bad though
23:13:09FromDiscord<Generic> what's end even reserved for?
23:13:12FromDiscord<Generic> secret pascal mode?
23:13:35FromDiscord<Elegantbeef> Better to reserve a keyword and not need it then need it and not reserve it
23:14:23FromDiscord<Generic> I "wrote" (translated fits better) an interval tree and I had to come up with a better name for end
23:14:25FromDiscord<Yardanico> In reply to @Generic "what's end even reserved": at some point a endX syntax skin was planned
23:14:30FromDiscord<Yardanico> because braces skin was there already
23:14:43FromDiscord<Generic> oh I didn't knew syntax skins were ever implemented
23:14:59FromDiscord<Elegantbeef> Used to have {} syntax and whitespace at the same time 😄
23:17:09FromDiscord<Zectbumo> I haven't been using nim long enough, but I can see myself with a desktop stickynote holding my basic imports: stdtabs, strformat, sequtils, ... what do you guys do? copy n paste a standard header line for all new .nim files?
23:17:28FromDiscord<Yardanico> i just remember quite a lot of the stdlib
23:17:28FromDiscord<Generic> I'm import what I need
23:17:31FromDiscord<Yardanico> so i import things what I need
23:17:32FromDiscord<Elegantbeef> You can make a `config.nims` that has `--import` statements
23:17:50FromDiscord<Elegantbeef> Yea i just import what i need
23:18:02FromDiscord<Generic> (if you want to pollute the namespace even more, not that that's very bad in Nim)
23:18:32FromDiscord<Elegantbeef> Especially with the overloadable(overridable?) enums it's not an issue imo
23:19:15FromDiscord<Generic> I always feel a bit bad for nimsuggest
23:19:41FromDiscord<Generic> though my project recently reached it's breaking point, so it's not an issue anymore
23:48:51FromDiscord<Zectbumo> what is a `none(int)` ?↵https://nim-lang.org/docs/cookies.html#setCookie%2Cstring%2Cstring%2Cstring%2Cstring%2Cstring
23:49:08FromDiscord<Yardanico> std/options
23:49:12FromDiscord<Yardanico> https://nim-lang.org/docs/options.html
23:49:22FromDiscord<Generic> https://nim-lang.org/docs/options.html#none%2Ctypedesc
23:54:56FromDiscord<Zectbumo> interesting. it avoids the nil issue, but the docs don't say what the nil issue is (as it says sometimes it's a "bad idea") and I can't find any docs on it in the tutorials and manual.
23:55:47FromDiscord<Yardanico> In reply to @Zectbumo "interesting. it avoids the": std/options in this case is used for cookies so you can denote the absence of a value
23:56:12FromDiscord<Yardanico> because maxAge is an optional cookie parameter
23:56:21FromDiscord<Yardanico> and it can also be zero or negative
23:56:21FromDiscord<Zectbumo> I got that part, but what are they talking about in the std/options docs saying "nil not always available, or not a good solution"
23:56:36FromDiscord<huantian> Nil is only an option for reference types
23:56:38FromDiscord<Elegantbeef> Options force you to unpack nilable types
23:56:44FromDiscord<Yardanico> the nil idea is to use `nil` as the absence of value for ref types
23:56:52FromDiscord<huantian> and the problem is nil is that you don't know, at compile time, if something can be nil or not
23:56:59FromDiscord<Elegantbeef> So you cannot accidently use nil`var a: ref int; echo a[]`
23:57:16FromDiscord<Elegantbeef> you do `var a: Option[ref int]; if a.isSome: echo a.get()[]`
23:57:41FromDiscord<Elegantbeef> Some people view that as the wrong wrapping of a nilable type
23:57:43FromDiscord<Elegantbeef> YMMV
23:57:54FromDiscord<Zectbumo> I see
23:58:12FromDiscord<Zectbumo> I would copy and paste that into the tutorial, beef
23:58:34FromDiscord<Yardanico> @beef
23:58:38FromDiscord<Elegantbeef> PRs welcome 😄
23:58:44FromDiscord<Elegantbeef> Lol yard