<< 17-07-2021 >>

00:28:33*Onionhammer2 joined #nim
00:28:33*Onionhammer quit (Read error: Connection reset by peer)
00:28:33*Onionhammer2 is now known as Onionhammer
01:24:04fn<ForumUpdaterBot99> New post on r/nim by chrisbot5000: Printing tabular data, see https://reddit.com/r/nim/comments/olukny/printing_tabular_data/
01:40:42FromDiscord<carmysilna> How would I catch a Ctrl-C SIGINT from `stdin.readLine`? `try...catch IOError` isn't doing it
01:46:06*arkurious quit (Quit: Leaving)
01:49:48FromDiscord<ElegantBeef> You want to over ride the ctrl + c behaviour?
01:49:50FromDiscord<@bracketmaster-5a708063d73408ce4> like this?
01:49:59FromDiscord<ElegantBeef> https://nim-lang.org/docs/system.html#setControlCHook%2Cproc%29
01:50:18FromDiscord<@bracketmaster-5a708063d73408ce4> nvm
01:50:30FromDiscord<@bracketmaster-5a708063d73408ce4> can I do fancy type constraint in Nim?
01:50:37FromDiscord<@bracketmaster-5a708063d73408ce4> sent a long message, see http://ix.io/3tdD
01:50:44FromDiscord<ElegantBeef> Jeez the bridge destroyed that
01:51:34FromDiscord<@bracketmaster-5a708063d73408ce4> https://play.nim-lang.org/#ix=3tdE
01:52:30FromDiscord<ElegantBeef> I dont think you can
01:54:15FromDiscord<ElegantBeef> It also doesnt make any sense
01:55:01FromDiscord<ElegantBeef> in this case you give it `obj[3]` which means `T = 3` but then the parameter is expecting `T + 1` so that means you needed to pass a `obj[4]`
01:56:10FromDiscord<ElegantBeef> and that logic applies to all static ints < 3
01:56:13FromDiscord<ElegantBeef> (edit) "<" => "<="
01:58:27FromDiscord<@bracketmaster-5a708063d73408ce4> Actually, I wanted to do something where the function has two argument, each of type obj
01:58:52FromDiscord<@bracketmaster-5a708063d73408ce4> the proc signature enforces that one obj must be one larger than the other
01:58:55FromDiscord<ElegantBeef> Ok
02:03:55FromDiscord<@bracketmaster-5a708063d73408ce4> I'm not sure that is possible either
02:07:21FromDiscord<theangryepicbanana> In reply to @@bracketmaster-5a708063d73408ce4 "type obj\*[n": there's a chance you could do this with concepts
02:07:37FromDiscord<@bracketmaster-5a708063d73408ce4> concepts
02:07:44FromDiscord<@bracketmaster-5a708063d73408ce4> what's that?
02:07:54FromDiscord<theangryepicbanana> they're a somewhat experimental feature
02:08:03FromDiscord<theangryepicbanana> basically typeclasses (if you've ever used those)
02:08:41FromDiscord<theangryepicbanana> https://nim-lang.org/docs/manual_experimental.html#concepts
02:08:50FromDiscord<@bracketmaster-5a708063d73408ce4> https://play.nim-lang.org/#ix=3tdL
02:09:02FromDiscord<@bracketmaster-5a708063d73408ce4> Do concepts support that?
02:09:09FromDiscord<carmysilna> In reply to @ElegantBeef "You want to over": Yeah, I want to be able to exit quietly instead of providing a stack trace
02:09:44FromDiscord<theangryepicbanana> In reply to @@bracketmaster-5a708063d73408ce4 "Do concepts support that?": probably in combination with macros or a second generic parameter
02:10:51FromDiscord<carmysilna> In reply to @ElegantBeef "https://nim-lang.org/docs/system.html#setControlCHo": Thanks, that looks like exactly what I want
02:12:12FromDiscord<ElegantBeef> It's not ideal but you could do this https://play.nim-lang.org/#ix=3tdO
02:12:24FromDiscord<ElegantBeef> Not too far off what you were doing
02:12:42FromDiscord<ElegantBeef> Though the constraint is moved into the body instead of the procdef
02:12:53FromDiscord<@bracketmaster-5a708063d73408ce4> I honestly think that will work
02:13:04FromDiscord<@bracketmaster-5a708063d73408ce4> its still compile time - so yeah, I'm happy
02:13:13FromDiscord<ElegantBeef> Though truthfully you dont need the `static Int` part
02:13:20FromDiscord<ElegantBeef> you cannot make an `obj` with anything but static cint
02:14:00FromDiscord<ElegantBeef> So this works fine https://play.nim-lang.org/#ix=3tdP
02:14:33FromDiscord<@bracketmaster-5a708063d73408ce4> you still had static[int]
02:15:06FromDiscord<ElegantBeef> refresh ix.io is a bit glitchy sometimes
02:18:59FromDiscord<theangryepicbanana> In reply to @@bracketmaster-5a708063d73408ce4 "you still had static[int]": this should theoretically work but idk why it doesn't https://play.nim-lang.org/#ix=3tdQ
02:29:06FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3tdS congrats banana you had a better solution than i
02:29:42FromDiscord<generic linux user> babana where?
02:29:52FromDiscord<generic linux user> oh
02:32:15FromDiscord<theangryepicbanana> In reply to @ElegantBeef "https://play.nim-lang.org/#ix=3tdS congrats banana ": yay
02:32:29FromDiscord<theangryepicbanana> been doing some hacking into concepts lately ;)
02:33:06FromDiscord<ElegantBeef> Yea i dont touch them much but i've been slowly moving towards them
02:33:12FromDiscord<ElegantBeef> They have a lot of power, especially paired with macros
02:33:16FromDiscord<theangryepicbanana> they're pretty pog
02:33:30FromDiscord<theangryepicbanana> waiting for runtime concepts though (i.e interfaces)
02:33:52FromDiscord<ElegantBeef> I still dont get how iface doesnt solve that for you
02:34:06FromDiscord<ElegantBeef> I'm a numpty and it seems to match 1:1 what you want
02:34:23FromDiscord<theangryepicbanana> supposedly they were in the spec via vtref and vtptr for about 8 months before being removed for some reason
02:34:56FromDiscord<ElegantBeef> I mean araq does want to make it happen which is one reason for new style concepts
02:34:56FromDiscord<theangryepicbanana> In reply to @ElegantBeef "I still dont get": because I need actual inheritance behavior, not golang interfaces
02:35:14FromDiscord<ElegantBeef> So you need C# style interfaces?
02:35:22FromDiscord<theangryepicbanana> essentially yeah
02:35:34FromDiscord<theangryepicbanana> or like, interfaces in any language except golang
02:35:43FromDiscord<theangryepicbanana> (edit) "in" => "from"
02:35:49FromDiscord<ElegantBeef> hey i havent used many languages
02:36:32FromDiscord<ElegantBeef> That's actually not to bad considering you're transpiling to nim though, since you can make a typedef, subscribe to a vtable and all in the generated nim file
02:36:38FromDiscord<theangryepicbanana> basically interfaces form an "is-a" relationship with the types they're implemented in, similar to object inheritance
02:36:46FromDiscord<ElegantBeef> Well i know how they work
02:36:53FromDiscord<ElegantBeef> i've used them afterall
02:37:00FromDiscord<theangryepicbanana> I'm describing the behavior I need
02:37:09FromDiscord<ElegantBeef> Ah
02:37:59FromDiscord<theangryepicbanana> now I've kinda come up with a workaround using an unhealthy amount of dummy procs/methods, generics, concepts, and typedesc, but it still isn't perfect
02:38:11FromDiscord<ElegantBeef> Sounds hellish
02:38:29FromDiscord<theangryepicbanana> pretty much yeah
02:39:24FromDiscord<ElegantBeef> With macros + macro cache this actually might be pretty reasonably achieved
02:39:44FromDiscord<theangryepicbanana> I can understand why it's difficult to make concepts a runtime thing though. afaik liquid haskell and raku are the only language with such a feature
02:39:59FromDiscord<theangryepicbanana> (edit) "I can understand why it's difficult to make concepts a runtime thing ... though.languages" added "in nim" | "language" => "languages"
02:40:16FromDiscord<theangryepicbanana> scratch that, it's just raku lol
02:40:32FromDiscord<ElegantBeef> I swear if you have me writing an interface system.... 😄
02:40:42FromDiscord<theangryepicbanana> oh raku is plenty fun
02:41:10FromDiscord<theangryepicbanana> imagine runtime concepts that also double as refinement types
02:41:55FromDiscord<ElegantBeef> presently thinking about making runtime concepts
02:42:09FromDiscord<theangryepicbanana> I mean it's possible
02:42:50FromDiscord<theangryepicbanana> probably easier to stick with concepts that are treated as interfaces though
02:43:35FromDiscord<theangryepicbanana> (so it's just has to check the is-a relationship)
02:43:41FromDiscord<theangryepicbanana> (edit) "it's" => "it"
02:44:57FromDiscord<theangryepicbanana> either way I'm sure it'll be fun
02:45:29FromDiscord<theangryepicbanana> yeah like that
02:45:34FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3tdT
02:48:49FromDiscord<ElegantBeef> Trying to get away from the nested ifelse is a tricky thing 😄
02:49:33FromDiscord<ElegantBeef> Cause you need to bake runtime information on instantiation of the object
02:51:49FromDiscord<ElegantBeef> Just thought of the dumbest way and that's to add an `clickableId: 1..1` replacing `1..1` with the id of the object
02:56:38FromDiscord<ElegantBeef> Oh right ranges dont default init to their range
03:15:36FromDiscord<theangryepicbanana> In reply to @ElegantBeef "Oh right ranges dont": you could always use high/low?
03:17:02FromDiscord<ElegantBeef> I mean you'd still have to convert it to the type to get that, so it'd be pointless
03:18:58FromDiscord<theangryepicbanana> yeah
03:19:02FromDiscord<theangryepicbanana> or actually
03:20:08FromDiscord<theangryepicbanana> In reply to @ElegantBeef "I mean you'd still": `typeof(default(Clickable).clickableId).high`?
03:38:32FromDiscord<Tuatarian> In reply to @ElegantBeef "Since around Nim 1.4.6(maybe": Will do, I have 1.4.4
04:01:44FromDiscord<@bracketmaster-5a708063d73408ce4> I have a proc that has some static when conditions that are predicated on the proc's argument's type. The proc as of compile time might actual be 4 different procs depending on the argument types. Does nim generate 4 different procs and end up re-using the code in the emitted C?
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:10FromDiscord<ElegantBeef> 4 different procs with 4 different bodies
04:06:37*supakeen joined #nim
04:06:55FromDiscord<@bracketmaster-5a708063d73408ce4> I'm hoping nim re-uses the procs in the emitted code
04:07:25FromDiscord<ElegantBeef> Well depends what you're doing
04:07:30FromDiscord<@bracketmaster-5a708063d73408ce4> that is, if I call proc\_variant\_2() three different places in my code, nim shouldn't be re-emitting the proc
04:07:47FromDiscord<ElegantBeef> Well if it's the same parameters it'd reuse it
04:07:48FromDiscord<juan_carlos> Different types can be optimized differently, etc.
04:12:31FromDiscord<ElegantBeef> Remember you can always look at the C source to see what it emits
04:13:24*xet7 quit (Remote host closed the connection)
04:14:24*xet7 joined #nim
05:18:02FromDiscord<generic linux user> in a switch , will it be good if i use char instaed of int?
05:18:08FromDiscord<generic linux user> save memory?
05:18:27FromDiscord<generic linux user> after 9 i i used A,B....
05:20:03FromDiscord<ElegantBeef> It's best to just make a program work then optimize it after
05:20:12FromDiscord<ElegantBeef> If you just need a char, use a char
06:10:17FromDiscord<Rika> In reply to @ElegantBeef "Well what i'm thinking": sounds easy
06:10:35FromDiscord<Rika> relative to other things i mean
06:10:57FromDiscord<ElegantBeef> Yea the one issue i see is the whole how to get what it is without having an ifelse branch
06:11:15FromDiscord<Rika> probably a set?
06:11:39FromDiscord<Rika> rtinfo: set[interfacetypes] # or whatever
06:12:59FromDiscord<Rika> well
06:13:00FromDiscord<ElegantBeef> Well say it's a button, how do you know it's a button so you can call the button procedure without the branches
06:13:12FromDiscord<Rika> the issue with that is now you need access to the names of every concept used as an interface
06:13:24FromDiscord<Rika> prolly something to do with macrocache again, ive never used macrocache
06:13:40FromDiscord<ElegantBeef> Yea macrocache can do all the heavy lifting
06:13:44FromDiscord<Rika> In reply to @ElegantBeef "Well say it's a": when you implements: it adds the interface type to rtinfo
06:14:15FromDiscord<Rika> so you just check if type in rtinfo or w/e
06:14:28FromDiscord<Rika> i dont see what's wrong with one if branch
06:14:51FromDiscord<ElegantBeef> Well that doesnt help since each type has it's own implementation of the procedure
06:15:30FromDiscord<Rika> hm i dont really follow because ive never used anything like interfaceds
06:15:31FromDiscord<Rika> (edit) "interfaceds" => "interfaces"
06:15:45FromDiscord<ElegantBeef> Well interfaces can be overridden per object that implements them
06:16:00FromDiscord<Rika> okay, then
06:16:01FromDiscord<ElegantBeef> So you need some quick way to go from the base non specified object to the actual object
06:16:15FromDiscord<Rika> what?
06:16:56FromDiscord<ElegantBeef> Say you have all your clickables in a sequence, you want some quick way figure out what actual type it is and be able to invoke it's procedure
06:17:19FromDiscord<ElegantBeef> The thing is these interfaces behave like inherited objects, you can lose type information
06:17:47FromDiscord<ElegantBeef> So you can relatively easily get it back with nested elifs but you'd rather a vtable where it's super cheap
06:18:01FromDiscord<Rika> you cannot avoid if branches if you're doing that i dont thinkj
06:18:13FromDiscord<Rika> you cant embed types because theyre static info, you cant do a lot of things
06:18:21FromDiscord<Rika> vtable, hm
06:18:28FromDiscord<Rika> what's the trouble with using a vtable
06:18:54FromDiscord<ElegantBeef> well i was trying to figure out a way to embed the type id into the type for that
06:19:09FromDiscord<ElegantBeef> That way you arent reliant on using a specific procedure to intialize them
06:19:23FromDiscord<Rika> well you basically just assign a hash/random number to a type and have a lut for that i guess?
06:20:52FromDiscord<Rika> wait why do you need the type id w/e stuff, vtables dont have something like that do they?
06:22:33FromDiscord<ElegantBeef> > Whenever a class defines a virtual function (or method), most compilers add a hidden member variable to the class that points to an array of pointers to (virtual) functions called the virtual method table. These pointers are used at runtime to invoke the appropriate function implementations, because at compile time it may not yet be known if the base function is to be called or a derived one implemented by a class that inherits from
06:23:01FromDiscord<ElegantBeef> Though i was going to use the macrocache to not use a pointer
06:23:54FromDiscord<ElegantBeef> (edit) "Though i was going to use the macrocache to not use a pointer ... " added "directly"
06:27:23FromDiscord<Rika> dont think thats possible
06:28:55FromDiscord<ElegantBeef> What do you mean?
06:30:27FromDiscord<Rika> how would you not use a pointer directly?
06:30:32FromDiscord<Rika> well
06:30:41FromDiscord<Rika> okay its possible just less ergonomic i feel
06:31:15FromDiscord<ElegantBeef> The symbols are looked up in the macrocache so when using whatever macro magic to call the procedure it can just unpack and run in place
06:33:01FromDiscord<ElegantBeef> Yes probably dot operators would be used
06:51:52*PMunch quit (Quit: leaving)
06:54:57*beshr joined #nim
06:54:57*beshr quit (Changing host)
06:54:57*beshr joined #nim
06:59:21*max22- joined #nim
06:59:37*max22- quit (Remote host closed the connection)
06:59:59*max22- joined #nim
07:01:29*neceve joined #nim
07:18:46*Vladar joined #nim
07:28:04*Guest81 joined #nim
07:28:11*Guest81 quit (Client Quit)
08:08:39FromDiscord<aleclarson> is there a shorthand for slicing a seq from one index to the end?↔or is this the most concise `seq[1..(seq.len - 1)]`
08:10:01FromDiscord<aleclarson> oh i found it \:)↔`seq[1..^1]
08:10:04FromDiscord<aleclarson> (edit) "\:)↔`seq[1..^1]" => "\:)↔`seq[1..^1]`"
08:46:51*sagax joined #nim
09:00:06FromDiscord<sealmove> wow! I am learning Kotlin and it's the most similar language to Nim in some aspects that I've seen
09:01:35FromDiscord<sealmove> I mean the way you play arround with basic types and the overloaded operators are very similar
09:19:25*koltrast quit (Quit: ZNC - http://znc.in)
09:24:59*koltrast joined #nim
09:40:42FromDiscord<generic linux user> i found a way to reduce the size of the binary (w/o using --opt:size) .instead of importing the library as a whole , parse the procs from the library and put them inside,↔i did it for 3procs , and i reduced it from 288K to 180K
09:40:48FromDiscord<generic linux user> didnt even strip it
09:43:00FromDiscord<Rika> What?
09:43:17FromDiscord<Rika> Parse?
09:43:26FromDiscord<Rika> Put them inside where
09:43:39FromDiscord<generic linux user> inside you .nim file
09:43:46FromDiscord<Rika> Parse what?
09:43:50FromDiscord<generic linux user> copy the procs from stdlib
09:44:07FromDiscord<Rika> Does your program still work precisely as intended
09:44:15FromDiscord<generic linux user> https://media.discordapp.net/attachments/371759389889003532/865891637796274186/Screenshot_2021-07-17-15-14-04.jpeg
09:44:22FromDiscord<sealmove> how do you manage dependencies?
09:44:25FromDiscord<generic linux user> In reply to @Rika "Does your program still": yiss
09:44:29FromDiscord<Rika> Nim has dead code elimination so there should be no reason for the difference
09:44:36FromDiscord<generic linux user> there is
09:44:44FromDiscord<generic linux user> In reply to @Rika "Nim has dead code": i didnt know btw
09:45:47FromDiscord<generic linux user> In reply to @àžŁŃ”àž„É­àč“à菦©Ń” "how do you manage": mine is a small file , so there seems no dependencies↔the dependencies seem not to be for the procs that i am using
09:46:04*al1ranger joined #nim
09:47:46FromDiscord<sealmove> So it's not a consistent way. The dead code elimination not working perfectly is interesting to investigate.
09:48:23FromDiscord<generic linux user> yess
09:48:43FromDiscord<generic linux user> a .nim file with nothing inside takes 44K(arm64) release
09:48:47FromDiscord<generic linux user> thats the baseline
09:55:55FromDiscord<generic linux user> @sealmove↔{.deadCodeElim: on.} doesnt seem to do anything
09:56:50FromDiscord<Rika> It’s on by default
09:57:20FromDiscord<Rika> Why wouldn’t you use opt size though
09:58:17FromDiscord<generic linux user> i dont really need it to be small
09:58:28FromDiscord<generic linux user> just optimizing size without losing performance
09:58:50FromDiscord<generic linux user> turing the switch on and off doesnt change the bin size tho
09:58:59FromDiscord<Rika> Which
10:00:57FromDiscord<generic linux user> https://media.discordapp.net/attachments/371759389889003532/865895839325749268/Screenshot_2021-07-17-15-30-46.jpeg
10:01:03FromDiscord<generic linux user> SUS
10:01:16FromDiscord<Rika> I said already it’s on by default
10:01:22FromDiscord<generic linux user> i tunred it off
10:01:24FromDiscord<Rika> Turning it on manually won’t change anything
10:01:27FromDiscord<Rika> Ah
10:01:33FromDiscord<Rika> I don’t think you can turn it off either
10:01:38FromDiscord<Rika> It’s a deprecated switch
10:01:41FromDiscord<generic linux user> a
10:01:57FromDiscord<generic linux user> wait
10:02:18FromDiscord<generic linux user> https://media.discordapp.net/attachments/371759389889003532/865896179539116032/Screenshot_2021-07-17-15-32-08.jpeg
10:02:23FromDiscord<generic linux user> oops
10:03:07FromDiscord<generic linux user> yes
10:06:01FromDiscord<generic linux user> thats convinient lol
10:36:20*al1ranger quit (Quit: Leaving)
10:44:06FromDiscord<hiros> What's a recommended profiler/debugger for nim?
10:48:42FromDiscord<Yinisiki> In reply to @hiros "What's a recommended profiler/debugger": i am using code runner plugin from vscode
10:49:15FromDiscord<Yinisiki> install code runner and type Ctrl+Alt+N in a nim code file
10:53:30FromDiscord<Yinisiki> Guys, i am facing a roadblock....
10:54:02FromDiscord<Yinisiki> At line 19 column 8.... its showing this error https://media.discordapp.net/attachments/371759389889003532/865909196141625374/unknown.png
10:54:34FromDiscord<Yinisiki> this error https://media.discordapp.net/attachments/371759389889003532/865909338299170836/unknown.png
10:55:40FromDiscord<Yinisiki> I am stuck... please help!
10:56:17FromDiscord<pointystick> Missing a colon at the end of the 'for' line
10:57:20FromDiscord<Yinisiki> oops... worked like magic.....
10:57:30FromDiscord<Yinisiki> Thx @pointystick
11:09:59FromDiscord<0ffh> If a proc returns a ref tuple, does it auto-allocate or do I need to to new(result)?
11:10:28FromDiscord<0ffh> (edit) "to" => "do"
11:11:52FromDiscord<Rika> new result
11:11:56FromDiscord<Rika> oh wait
11:12:11FromDiscord<Rika> wdym? if the proc you're writing returns ref tuple?
11:12:21FromDiscord<Rika> if its your proc yes you need to do new result at the top
11:12:30FromDiscord<0ffh> Okay, thanks!
11:13:35FromDiscord<hiros> Is GDB really the best way to debug & profile my nim programs?
11:14:07fn<ForumUpdaterBot99> New thread by Murabito: Open nims with proper highlighting, see https://forum.nim-lang.org/t/8237
11:20:49*arkurious joined #nim
11:35:42FromDiscord<hamidb80> hey
11:37:28FromDiscord<hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3tfl
11:38:35FromDiscord<hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3tfm
11:39:30FromDiscord<hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3tfn
11:39:31FromDiscord<Rika> need macro
11:40:08FromDiscord<Rika> i dont exactly know how to get there but it probably involves getting the type of the proc and seeing the return type
11:44:14FromDiscord<hamidb80> typed macro can help i guees
11:45:06FromDiscord<Rika> yes
11:45:06FromDiscord<hamidb80> since it resolves `ident`s to `sym`
11:45:30FromDiscord<hamidb80> (edit) "`ident`s" => "`ident`"
11:57:42arkanoid!evan 5/0
11:57:48arkanoid!eval 5/0
11:57:49*max22- quit (Ping timeout: 246 seconds)
11:57:50NimBotCompile failed: /usercode/in.nim(1, 2) Error: expression '5 / 0' is of type 'float' and has to be used (or discarded)
11:57:58arkanoid!eval echp(5/0)
11:57:59NimBotCompile failed: /usercode/in.nim(1, 1) Error: undeclared identifier: 'echp'
11:58:08arkanoid:( damn broken keyboard
11:58:16FromDiscord<Rika> needs fixin
11:58:25FromDiscord<Rika> !eval echo 5/0
11:58:27NimBotinf
11:58:39FromDiscord<Rika> đŸ€” not nan?
11:58:55FromDiscord<Rika> !eval import fenv; echo 5/0
11:58:57NimBotinf
11:59:54FromDiscord<Rika> !eval echo 5f64/0f64
11:59:56NimBotinf
12:02:40FromDiscord<hamidb80> nan is for 0.0 / 0.0
12:02:54FromDiscord<hamidb80> !eval echo 0.0/0.0
12:02:56NimBotnan
12:03:20FromDiscord<Rika> hm i guess, but then should there not be a divbyzero exc.?
12:03:39FromDiscord<hamidb80> it should be
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:37*supakeen joined #nim
12:07:42FromDiscord<hamidb80> In reply to @hiros "Is GDB really the": take a look at this:↔https://github.com/treeform/hottie
12:07:45fn<R2D299> itHub: 7"Sampling profiler that finds hot paths in your code."
12:28:50FromDiscord<System64 ~ Flandre Scarlet> Do you know what "p" is in the return statement please? It's for interop https://media.discordapp.net/attachments/371759389889003532/865933056866123836/unknown.png
12:31:18FromDiscord<exelotl> it's a pointer to some memory that was allocated and filled with the contents of the file.
12:31:26FromDiscord<System64 ~ Flandre Scarlet> ah so P is a pointer?
12:31:40FromDiscord<leorize> p is that variable p declared above↔(@System64 ~ Flandre Scarlet)
12:31:42FromDiscord<Rika> yes it shows in `void p`
12:32:05FromDiscord<System64 ~ Flandre Scarlet> okay so in nim I have to indicate it returns a pointer?
12:32:13FromDiscord<exelotl> the return type of the function is `char ` which would be `cstring` in Nim
12:32:23FromDiscord<exelotl> most likely
12:32:46FromDiscord<System64 ~ Flandre Scarlet> ah yeah I'm dumb lol
12:32:58FromDiscord<Rika> lol
12:33:59FromDiscord<System64 ~ Flandre Scarlet> https://github.com/dmitrysmagin/a2t_play/blob/master/src/sdl.c↔But maybe it's a stream of bytes
12:35:33FromDiscord<System64 ~ Flandre Scarlet> 'cause one char is one byte
12:35:43FromDiscord<Rika> depends
12:35:45FromDiscord<System64 ~ Flandre Scarlet> so you can use a cstring as a stream of bytes
12:35:48FromDiscord<Rika> yes
12:36:02FromDiscord<Rika> if you explicitly want bytes probably `ptr UncheckedArray[byte]`
12:36:22FromDiscord<System64 ~ Flandre Scarlet> I'll still return a cstring since it's a cstring
12:36:40FromDiscord<Rika> In reply to @Rika "if you explicitly want": this is "equivalent" to a cstring though?
12:37:27FromDiscord<System64 ~ Flandre Scarlet> I think logically yeah
12:38:36FromDiscord<System64 ~ Flandre Scarlet> yeah it's used as a stream of bytes https://media.discordapp.net/attachments/371759389889003532/865935517489037312/unknown.png
12:40:17FromDiscord<exelotl> I guess if being pedantic then you could argue a cstring should be an actual null-terminated string and hold text rather than raw data. That said, I do use string and cstring for data most of the time, just cause they're easily available and there's no real downside to using them that way.
12:41:53FromDiscord<System64 ~ Flandre Scarlet> I guess my interop is done https://media.discordapp.net/attachments/371759389889003532/865936340121813032/unknown.png
12:42:21FromDiscord<exelotl> awesome :D
12:42:24FromDiscord<System64 ~ Flandre Scarlet> https://nim-lang.org/docs/backends.html↔Followed that
12:42:31FromDiscord<Rika> sometimes it is better to be pedantic
12:42:56FromDiscord<System64 ~ Flandre Scarlet> But now I'll suffer with compilation 'cause WIndows is badly made
12:43:24FromDiscord<System64 ~ Flandre Scarlet> why the fck Microsoft you didn't do a lib folder or dunno what like Linux???
12:43:48FromDiscord<System64 ~ Flandre Scarlet> On Linux AAALLLL your libs are in one place
12:43:57FromDiscord<Rika> because windows isnt programmer-first
12:44:33FromDiscord<System64 ~ Flandre Scarlet> Linux too I guess?↔I meant, Ubuntu or Mint for exemple are for all people
12:45:40FromDiscord<Rika> yes but they inherit from linux (and didnt change the fs structure because that would be a massive pain) and linux inherits from unix therefore
12:45:53FromDiscord<System64 ~ Flandre Scarlet> yeah true
12:46:11FromDiscord<System64 ~ Flandre Scarlet> but I think Microsoft should put efforts for devs
12:46:53FromDiscord<Rika> wsl
12:47:45FromDiscord<System64 ~ Flandre Scarlet> it's still Linux so if you compile from there, you compile for Linux
12:47:59FromDiscord<System64 ~ Flandre Scarlet> I might got wrong but I think you compile for Linux
12:48:16FromDiscord<Rika> yes indeed
12:48:23FromDiscord<Rika> do you need to run this on windows?
12:48:30FromDiscord<System64 ~ Flandre Scarlet> yeah it's for my game
12:48:46FromDiscord<Rika> i dont know windows too much so gl lol
12:48:56FromDiscord<System64 ~ Flandre Scarlet> and also, Windows is the most used operating system so Windows has priority for me
12:49:15FromDiscord<System64 ~ Flandre Scarlet> I don't reject Linux, I love Linux, but to hit more people I need Windows first
12:49:22FromDiscord<Rika> wasnt gonna say anything about that
12:49:35FromDiscord<System64 ~ Flandre Scarlet> My secondary PC runs Arch btw
12:49:43FromDiscord<System64 ~ Flandre Scarlet> (well Archcraft in fact)
12:50:21FromDiscord<System64 ~ Flandre Scarlet> and no, it's not as unstable as most of people think
12:52:51arkanoidI need to define "func foo[M, T](callback: proc(value: T): M[T])" but compiler says "Error: no generic parameters allowed for M". How would you workaround this?
12:53:51FromDiscord<haxscramper> We dont' have HKT
12:54:09FromDiscord<haxscramper> There is no sane workaround IIRC
12:54:44arkanoiddidn't even realize I was touching that subject
12:54:49FromDiscord<haxscramper> And I don't think there is any hack that would be barely usable either
12:55:06FromDiscord<haxscramper> `M[T]`
12:55:07FromDiscord<haxscramper> If I'm not mistaken this is a HKT
12:55:55arkanoidpossibly, yes
12:57:58arkanoidGeneral question: if I have "type MyType[A]", what is MyType and what is MyType[int] when reading the documentation?
12:58:17arkanoidMyType is a type? Is a generic type? MyType[int] is a real type?
13:01:10FromDiscord<haxscramper> You mean when `MyType` is used like foo/bar?
13:01:21FromDiscord<haxscramper> Otherwise it depends on context of course
13:01:50FromDiscord<haxscramper> `MyType` is a name of the type, `MyType[int]` is a concrete specialization that might have some additional semantics
13:06:02arkanoidis it possible to extract type "int" from type "MyType[int]" in a template?
13:08:54arkanoidgot it, is https://nim-lang.org/docs/typetraits.html#genericParams.t%2Ctypedesc
13:12:18arkanoidno, it's not working as expected
13:14:08arkanoideval! import typetraits; type Foo[T] = object; func bar[A]() = echo genericParams(A); bar[Foo[int]]
13:14:51arkanoideval! import typetraits; type Foo[T] = object; func bar[A]() = echo genericParams(A); bar[Foo[int]]()
13:15:19FromDiscord<haxscramper> you can't declare function and use it in one lien
13:15:31FromDiscord<haxscramper> `; bar[Foo[int]]` is a part of the function
13:17:12arkanoidhttps://play.nim-lang.org/#ix=3tfK
13:17:44FromDiscord<hiros> For those with experience with gdscript, how different is gdscript from nim? Because both nim and gdscript are python like.
13:18:13arkanoidbut this one works correcly, just by avoiding generic parameter: https://play.nim-lang.org/#ix=3tfL
13:22:20FromDiscord<haxscramper> Last time I tried to make something meaningful with `genericParams` it was complete and horrible mess of hacks around hacks around random compiler crashes
13:22:44FromDiscord<haxscramper> So before you go into this I warn you - most likely it will be 95% frustration
13:22:53FromDiscord<haxscramper> 4% maybe things working
13:23:25FromDiscord<haxscramper> And 1% of useful knowledge that yes, you can in fact do something with it, sometimes, in simple cases
13:26:13arkanoidyeah I do know I'm walking on quicksand, but is still just a toy project around monads: now trying to unittest the 3 basic monad laws via generic template
13:26:18FromDiscord<hiros> Is there a GUI IDE for nim you recommend that has stuff like graphical profiling and the like?
13:26:19arkanoidthis works https://play.nim-lang.org/#ix=3tfL
13:27:30FromDiscord<Rika> In reply to @hiros "Is there a GUI": a gui for gdb (gdbgui) works well enough. otherwise not really
13:29:40*SebastianM joined #nim
13:30:29arkanoida template without params but just type params has to be called without()!?
13:31:20arkanoidIf I change "bar[Foo[int]]" in "bar[Foo[int]]()" int https://play.nim-lang.org/#ix=3tfL it doesn't work
13:31:42FromDiscord<Rika> what?
13:32:19FromDiscord<Rika> can you say that again, the bridge mangled it
13:32:25*aeverr joined #nim
13:33:11FromDiscord<Rika> arkanoid mind saying that again?
13:33:43arkanoidRika, sure. Please open "https://play.nim-lang.org/#ix=3tfL" and run it, then change last line and add "()" at the end if it, it doesn't work anymore
13:33:50FromDiscord<Bung> @haxscramper how is the example yesterday you talk about ?
13:34:09arkanoidI might be just getting confused by generics+templating
13:34:11aeverrarkanoid, so you mean bar()()?
13:34:55arkanoidaeverr: no, I mean replace "bar[Foo[int]]" with "bar[Foo[int]]()"
13:35:12FromDiscord<konsumlamm> there is no "bar[Foo[int]]" in your code
13:35:18aeverrhad the wrong link open
13:35:23aeverrwait i didnt??
13:35:33*max22- joined #nim
13:35:33FromDiscord<haxscramper> You need it literally now or this can wait?↔(@Bung)
13:35:39aeverri think you have the wrong link
13:35:56arkanoidoh! wait, you're right, my browser cache went nuts. 1 secs
13:36:15FromDiscord<Bung> wait for api I can call with args directly😄
13:36:23arkanoidhttps://play.nim-lang.org/#ix=3tfM
13:37:08aeverrseems like a bug
13:37:21aeverryou can add () if you make the template say `echo genericParams(type M)`
13:37:44aeverrits kind of odd but i think its consistent
13:38:39arkanoidwell it really seems that templates can be called without parethesis: https://play.nim-lang.org/#ix=3tfN
13:41:44arkanoidaeverr: if I change genericParams(M) to genericParams(type M) I get a different result. With the first one from "Foo[int]" I get (int,), with the second with same input I get (Foo[system.int],)
13:41:56aeverrhuh true
13:42:04arkanoidI need to extract generic param, so second version is not correct
13:42:08aeverri get why
13:42:18aeverrbecause it becomes typedesc[Foo[int]]
13:42:26aeverrokay so hm then its probably a bug
13:43:01aeverrwait
13:43:04aeverrthat doesnt make sense
13:43:12aeverrgenericParams takes a typedesc
13:43:19aeverrso that should totally work
13:44:06arkanoidalso I'm failing to save the result of genericParams to a variable: "let myvar = genericParams(M)" result in "Error: invalid type: 'type (float,)' for let"
13:44:43aeverrhttps://play.nim-lang.org/#ix=3tfQ stranger way to do this
13:44:50arkanoidwell, I'm not expecting to get a lot from this, haxscramper has already warned me that I was going into the rabbit hole
13:45:20aeverryou cannot store the result i assume because it is a tuple of types
13:47:22arkanoidbut if I try to use the genericParams(M)[0] as a type like in "let bar: genericParams(M)[0]" I'm getting "Error: type expecte"
13:47:50*Vladar quit (Remote host closed the connection)
13:50:02FromDiscord<hiros> Nim isn't putting the C file where I'm telling it to.
13:50:46aeverrarkanoid thats because it's a type, i just discovered. `(int, )` is a type referring to a tuple with one int i believe
13:51:00aeverryup indeed it is
13:51:13FromDiscord<haxscramper> `--nimcache:your/cache/directory`↔(@hiros)
13:51:15aeverryou can use `get` in typetraits as well
13:51:32aeverrso `let bar: genericParams(M).get(0)`
13:53:02arkanoidaeverr: it works! thanks
13:53:18FromDiscord<hiros> Thanks @haxscramper that worked.
13:53:18aeverrnice
13:53:37aeverrbtw im rika i switched to irc just to check the thing you said w/o the bridge fucking shit
13:56:32arkanoidif you replace "template" with "proc" in https://play.nim-lang.org/#ix=3tfT a "Error: internal error: /build/Nim/compiler/semtypes.nim(1900, 26)" is reached
13:56:46arkanoidnot a real deal
13:57:54FromDiscord<Rika> its an internal error
13:58:00FromDiscord<Rika> so its prolly a bug
13:58:14FromDiscord<Rika> either already in an issue or needs to be made an issue
13:58:18arkanoidwhat's the difference between "typedescr" and "typed" in template parameters, both seems to work for my playground
13:59:40arkanoidpossibly this error https://github.com/nim-lang/Nim/issues/16600
13:59:47aeverrtypedesc is a type, typed is an expression
14:00:05aeverr"type description", "typed code"
14:04:27FromDiscord<konsumlamm> sometimes i feel like some parts of Nim are just horribly broken beyond any hope of repair
14:05:21arkanoidkonsumlamm, it's the same boundary I'm trying to touch before using nim in production
14:06:39arkanoidyet for now I feel it is the most advanced system languages I know
14:07:27FromDiscord<konsumlamm> well, there aren't that many systems languages to begin with :P
14:07:50FromDiscord<konsumlamm> Rust's type system is also quite advanced, even more in some areas, but less in others
14:07:57arkanoidI can compile successfully "var x: genericParams(M).get(0)", but I don't want to type "var x: genericParams(M).get(0)" every time, but how can I define such a temporary type?
14:08:33FromDiscord<konsumlamm> `type MyType = genericParams(M).get(0)`?
14:12:00*SebastianM quit (Ping timeout: 255 seconds)
14:12:52arkanoidyeah, it worked
14:13:20arkanoidquite sure I tried that first ....
14:13:28FromDiscord<hiros> Whenever I use gdb and type l or list, it says a nim file that I certainly have doesn't exist.
14:13:58*stkrdknmibalz quit (Ping timeout: 246 seconds)
14:27:16FromDiscord<System64 ~ Flandre Scarlet> why insigned char? char is always insigned no? https://media.discordapp.net/attachments/371759389889003532/865962863318007878/unknown.png
14:31:59*SebastianM joined #nim
14:32:18arkanoidI really do need to find good examples of the differences and uses of "T: type", "T: typed" and "T: typedesc" inside proc/templates
14:36:40arkanoidthe first (T: type params) seems just sugar for generics
14:37:05arkanoidtyped is a thing for templates, but typedesc puzzles me
14:38:36FromDiscord<Rika> chars can be signed in C
14:49:53FromDiscord<hiros> I don't think gdb with nim works on windows.
14:50:45FromDiscord<System64 ~ Flandre Scarlet> In reply to @Rika "chars can be signed": ah alright
14:50:56FromDiscord<System64 ~ Flandre Scarlet> so the equivalent in nim?
14:51:05FromDiscord<System64 ~ Flandre Scarlet> uInt8?
14:51:48FromDiscord<System64 ~ Flandre Scarlet> ah ptr uInt8 yeah
14:56:06*SebastianM quit (Ping timeout: 255 seconds)
14:58:56FromDiscord<System64 ~ Flandre Scarlet> I have to put the compile pragma before each proc? https://media.discordapp.net/attachments/371759389889003532/865970833050042368/unknown.png
15:00:25FromDiscord<Rika> no
15:02:53FromDiscord<System64 ~ Flandre Scarlet> ah alright
15:08:34arkanoidis it possible to loop base types at compile time and run a generic/type arg function for all of them?
15:15:22*systemdsucks quit (Ping timeout: 268 seconds)
15:15:22*blackbeard420 quit (Ping timeout: 268 seconds)
15:15:30*blackbeard420_ joined #nim
15:15:31*systemdsucks joined #nim
15:18:11FromDiscord<System64 ~ Flandre Scarlet> I imported a module but I have no suggestions, is it normal? https://media.discordapp.net/attachments/371759389889003532/865975674031964208/unknown.png
15:20:23FromDiscord<Rika> you have to start typing wdym
15:22:51FromDiscord<System64 ~ Flandre Scarlet> yeah what I did
15:22:51fn<ForumUpdaterBot99> New thread by Geohuz: Problem of run procedure with interval and stop the running , see https://forum.nim-lang.org/t/8238
15:23:04FromDiscord<System64 ~ Flandre Scarlet> nothing https://media.discordapp.net/attachments/371759389889003532/865976907592761354/unknown.png
15:31:25FromDiscord<System64 ~ Flandre Scarlet> t doesn't suggest anything
15:31:58FromDiscord<Rika> nimsuggest probably died again then
15:32:06FromDiscord<SolitudeSF> damn, that sucks...
15:33:27FromDiscord<System64 ~ Flandre Scarlet> Even worse, it displays an error but my proc exists https://media.discordapp.net/attachments/371759389889003532/865979516311961661/unknown.png
15:34:34FromDiscord<Rika> might not be exported
15:34:34FromDiscord<Rika> lol
15:34:38FromDiscord<Rika> i just checked your old image
15:34:41FromDiscord<Rika> indeed not exported
15:34:57FromDiscord<System64 ~ Flandre Scarlet> what should I do?
15:35:21FromDiscord<Rika> in the file with compile
15:35:37FromDiscord<Rika> add a `` before the parentheses of each proc
15:35:52FromDiscord<SolitudeSF> read tutorial
15:38:03FromDiscord<System64 ~ Flandre Scarlet> Aaaah yeah sorry
15:59:39FromDiscord<generic linux user> In reply to @ElegantBeef "If you just need": i dont need anything , it just some input to know what switch(block) to go for , so if char does use less memeory
16:01:01FromDiscord<generic linux user> and it does work tho
16:01:14FromDiscord<generic linux user> just asked if it was better than using int
16:04:05*stkrdknmibalz joined #nim
16:31:19fn<ForumUpdaterBot99> New question by georgehu: implementing setInterval/clearInterval in nim, see https://stackoverflow.com/questions/68422361/implementing-setinterval-clearinterval-in-nim
17:11:05arkanoidI have myproject.nim and myproject.nims in the same folder. the nims file contains only 'switch("define", "ssl")' only and I'm compiling the .nim file with vscodium (pressing F6). The nims file seems not parsed. Docs says "A project can also have a project specific configuration file named $project.nims that resides in the same directory as $project.nim."
17:12:49arkanoidthis is the line executed by vscodium "nim c -r "/home/arkanoid/nim/experiments/myproject.nim""
17:15:25arkanoidIf I rename myproject.nims into config.nims it works correctly
17:15:43arkanoidis this page updated? https://nim-lang.org/docs/nims.html
17:28:55*max22- quit (Ping timeout: 246 seconds)
17:37:47FromDiscord<SolitudeSF> arkanoid, works on my machine
17:38:23arkanoidclassic
17:40:24FromDiscord<SolitudeSF> does compiler output hint `used config file myproject.nims`?
17:43:13FromDiscord<Rika> prolly has to be in the same pwd
17:44:14FromDiscord<SolitudeSF> no
17:44:23arkanoidno it doesn't output that
17:44:53fn<Prestige99> weird, I thought it did đŸ€”
17:49:08FromDiscord<haxscramper> It does, but at verbosity\:3 and hints enabled
17:49:27FromDiscord<generic linux user> :3 <- why this tho
17:50:24FromDiscord<timotheecour> `--hint:conf`
17:51:25FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3thW
17:52:11FromDiscord<SolitudeSF> {.discardable.}
17:52:30arkanoidI've another problem with httpclient: Error: unhandled exception: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure [SslError]
17:52:48FromDiscord<generic linux user> sslerror
17:52:49arkanoidsame url opens correctly with: browser/openssl -s client/curl
17:52:56FromDiscord<generic linux user> i have it too
17:53:05FromDiscord<generic linux user> in nimble
18:00:34arkanoidI've solved the problem by lowering the SSL cypher levels in SSL context (probably connecting to old site)
18:00:47arkanoidlet sslContext = newContext(protVersion = protSSLv23, verifyMode = CVerifyPeer, CiphersOld)
18:00:55arkanoidhttps://nim-lang.org/docs/ssl_config.html#CiphersOld
18:05:40arkanoidsorry, pasted incomplete line: let sslContext = newContext(protVersion = protSSLv23, verifyMode = CVerifyPeer, cipherList = CiphersOld)
18:06:38FromDiscord<dom96> interesting, can you add this trick to our docs? 🙂
18:40:24arkanoiddom96 is not really a trick, when you have to deal with outdated TLS sockets it's quite common to have to "downgrade" cipher level
18:49:30*neceve quit (Ping timeout: 240 seconds)
19:00:26FromDiscord<dom96> still, might be worth to add it in so that this problem is searchable
19:12:05FromDiscord<hamidb80> ۧ۫Űș
19:12:07FromDiscord<hamidb80> hey
19:12:20FromDiscord<hamidb80> can i raise custom exception with custom fields?
19:12:57FromDiscord<haxscramper> yes,
19:13:09FromDiscord<haxscramper> `YourException = object of CatchableError`
19:13:51FromDiscord<hamidb80> ok how to raise it ( and fill those cutom fields)?
19:14:08FromDiscord<hamidb80> `newException` seems not useful
19:14:10FromDiscord<hamidb80> here
19:14:22FromDiscord<haxscramper> Write a constructor for your exception
19:14:28FromDiscord<theangryepicbanana> don't you use `raise YourException()`
19:14:30FromDiscord<theangryepicbanana> lol
19:14:40FromDiscord<haxscramper> Or do `var exception = newException(YourException, msg)`
19:14:49FromDiscord<haxscramper> Then set necessary fields
19:14:55FromDiscord<hamidb80> thanks
19:15:32FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3til
19:15:47FromDiscord<haxscramper> Your constructor must return `ref` type, but it is better to define exception as non-ref type
19:16:14FromDiscord<haxscramper> `newException` internally doers `(ref ErrType)(msg: "text")`
19:17:56FromDiscord<hamidb80> +1
19:18:25FromDiscord<haxscramper> if you want to know more concrete timeline - I started working on the example for nimscripter, @Bung
19:19:27FromDiscord<haxscramper> Though it looks like `Error: illformed AST:` will drive my crazy earlier
19:35:42*neceve joined #nim
19:38:32FromDiscord<hamidb80> how can i convert a var that has a type `T` to a `ref T` ?
19:39:06FromDiscord<hamidb80> `(ref T)(myVar)` ?
19:39:11FromDiscord<Rika> `var a = new T; a[] = old`
19:39:38FromDiscord<Rika> well, can be `let`
19:40:56FromDiscord<aleclarson> In reply to @SolitudeSF "{.discardable.}": thx Solitude ^^
19:50:29*koltrast quit (Quit: ZNC - http://znc.in)
19:51:09arkanoidwhy parseJson is not available at compile time? I'm reading static json from file with readFile into const
19:52:14FromDiscord<Rika> parseJson is a deeply nested ref object which afaik isnt supported in nimscript
19:53:05FromDiscord<timotheecour> upvote https://github.com/nim-lang/Nim/pull/15528 if you want to allow it in future
19:54:42arkanoid(y)
20:00:26arkanoidthe json module unmarshall function "to" function accepts Option type to handle missing values, but equivalent function "to" in marshal module to turn back data structure into json writes Options as {val:...}
20:01:36FromDiscord<Rika> you dont use marshal module to turn a struct into json
20:02:22*beshr quit (Remote host closed the connection)
20:04:48*neceve quit (Ping timeout: 255 seconds)
20:07:32arkanoidno?
20:08:04FromDiscord<Rika> i'm confused, what are you trying to do exactly
20:08:19FromDiscord<Rika> you use `%` to convert something to a JsonNode
20:08:28FromDiscord<Rika> (i believe?)
20:09:46arkanoidI'm reading a json from a static file with readFile + parseJson, then I'm unmarshalling it via "to" function of json module, then I'm editing some attributes of the unmarshalled data structure via internal logic, now I have to re-convert the data structure into json
20:10:12arkanoidI'm using "$$" of marshal module on the data structure, not
20:10:14arkanoid*now
20:11:23FromDiscord<Rika> yes and i believe it's % to go back to json
20:11:29FromDiscord<Rika> or % i dont remember
20:13:28arkanoidyou're right! thanks
20:15:12FromDiscord<System64 ~ Flandre Scarlet> I try to interop with C but : https://media.discordapp.net/attachments/371759389889003532/866050423102373928/unknown.png
20:15:43FromDiscord<System64 ~ Flandre Scarlet> UnDeFiNeD ReFeReNcE To...↔Raaaah I hate theses linker errors
20:29:22*DrWhax left #nim (#nim)
20:29:50*beshr joined #nim
20:29:50*beshr quit (Changing host)
20:29:50*beshr joined #nim
20:32:17*koltrast joined #nim
20:34:41FromDiscord<System64 ~ Flandre Scarlet> is it normal?
20:36:20FromDiscord<haxscramper> Normal programs tend to compile, so probably no
20:36:27FromDiscord<haxscramper> You are missing linkage with some static library
20:39:28FromDiscord<System64 ~ Flandre Scarlet> It's C source code
20:40:48FromDiscord<System64 ~ Flandre Scarlet> so I need to compile the C code first?
20:40:59*vicfred joined #nim
20:41:28FromDiscord<haxscramper> ...
20:41:33FromDiscord<haxscramper> Yes, you need to compile whole program
20:41:46FromDiscord<System64 ~ Flandre Scarlet> Ah
20:41:56FromDiscord<haxscramper> Nim has `{.compile:` for external c files
20:42:06FromDiscord<haxscramper> So you don't have to manually run GCC on the files
20:42:32FromDiscord<System64 ~ Flandre Scarlet> so maybe I have to put a compile for all C files?
20:43:34FromDiscord<haxscramper> Yes, add all files to .compile., that should work
20:43:39FromDiscord<bernardo> Nim beginner here.↔Anyone could help me understand how the `ok` operator works? https://github.com/status-im/nim-json-rpc/blob/364dd2ebd132d7eb5e4516099250060b094c3daa/json_rpc/clients/httpclient.nim#L90↔↔I couldn't find anything in the docs
20:44:36FromDiscord<haxscramper> That is simply a procedure that takes two arguments
20:44:54FromDiscord<haxscramper> Not an operator, the just omitted parentheses
20:45:12FromDiscord<System64 ~ Flandre Scarlet> and it works!
20:48:26FromDiscord<bernardo> In reply to @haxscramper "Not an operator, the": do you mean the `ok` omits the parentheses?↔is that an implicit return?
20:49:18FromDiscord<Rika> nim MCS
20:49:34FromDiscord<Rika> you can omit parentheses in "method style call"
20:49:45FromDiscord<ElegantBeef> Well it's not MCS it's the command syntax 😄
20:49:48FromDiscord<SolitudeSF> thats not mcs
20:50:12FromDiscord<Rika> ok i read "operator" and thought binary operator
20:50:20FromDiscord<Rika> thought they saw `x.ok y`
20:50:28FromDiscord<Rika> usually what people mistake as operators
20:51:19FromDiscord<ElegantBeef> Command syntax lets you drop `()` if it's a single statement, if it's nested you can only drop them for the next for example `foo a.fooTwo b`
20:51:45FromDiscord<ElegantBeef> in this example you cannot supply anymore than 1 extra argument to `fooTwo` due to the result being passed to foo
20:51:54FromDiscord<Rika> haskell `$` when
20:53:15FromDiscord<Rika> In reply to @Rika "ok i read "operator"": if you want more explanation, i dont open linkts
20:53:17FromDiscord<Rika> links
20:53:24FromDiscord<Rika> it takes me a few seconds to load a link
20:53:35FromDiscord<ElegantBeef> It's ok rika we believe you
20:53:47FromDiscord<Rika> sure
20:53:55FromDiscord<ElegantBeef> Anywho @bernardo it's documented here https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax
20:56:29FromDiscord<treeform> In reply to @arkanoid "why parseJson is not": jsony can parse json at compile time.
20:56:55FromDiscord<treeform> https://github.com/treeform/jsony
20:56:57fn<R2D299> itHub: 7"A loose, direct to object json parser with hooks."
20:57:07arkanoidtreeform, that's a good news! thanks!
20:57:18FromDiscord<bernardo> In reply to @ElegantBeef "Anywho <@!602790129500684308> it's": thanks! so `ok` is actually a procedure?
20:57:24FromDiscord<Rika> yes
21:07:41*max22- joined #nim
21:08:52*Lord_Nightmare quit (Ping timeout: 245 seconds)
21:16:58FromDiscord<bernardo> ok found it, it's actually a template: https://github.com/status-im/nim-stew/blob/3c91b8694e15137a81ec7db37c6c58194ec94a6a/stew/results.nim#L292
21:18:26FromDiscord<bernardo> I had to manually break the `ok` statement to get some clues that it was actually a template, and then I had to manually search through the imported modules↔↔I'm using VSCode, is there some shorter path I could have used to find this?
21:18:38FromDiscord<ElegantBeef> ctrl click the `ok`
21:20:09FromDiscord<bernardo> In reply to @ElegantBeef "ctrl click the `ok`": just did it, got nothing
21:21:08FromDiscord<ElegantBeef> If nimstew was installed as a nimble package it should've worked
21:21:27FromDiscord<ElegantBeef> Assuming your goto definition works
21:25:04FromDiscord<bernardo> In reply to @ElegantBeef "*Assuming your goto definition": is that the same as right-click, `Go to Definition (F12)`?
21:25:28FromDiscord<bernardo> In reply to @ElegantBeef "If nimstew was installed": `nim-stew` is installed, along with all the dependencies for `nim-json-rpc`
21:28:56*Lord_Nightmare joined #nim
21:30:17FromDiscord<bernardo> aha! I had two different extensions (`kosz78.nim` + `nimsaem.nimvscode`), disabling `kosz78.nim` made goto work
21:30:25FromDiscord<ElegantBeef> Ah there you go
21:31:12FromDiscord<bernardo> In reply to @ElegantBeef "Ah there you go": thanks again!
22:44:35FromDiscord<System64 ~ Flandre Scarlet> it works I implemented OPL3 emulation
22:57:57*max22- quit (Remote host closed the connection)
23:18:49FromDiscord<dom96> No wonder AVs are marking the compiler as malicious https://huskyhacks.dev/2021/07/17/nim-exploit-dev/
23:19:30FromDiscord<VVX7> seeing a lot of red teams playing with Nim
23:19:44FromDiscord<VVX7> so yeah, not surprised by that
23:19:57FromDiscord<dom96> _wonders what a "red team" is_
23:20:08fn<Prestige99> offensive hacking
23:37:32FromDiscord<Daniel> but any programming language can be use for malicious purposes
23:53:56fn<Prestige99> depends on the requirements
23:59:30arkanoidtreeform, jsony is great!