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:04 | fn | <ForumUpdaterBot99> New post on r/nim by chrisbot5000: Printing tabular data, see https://reddit.com/r/nim/comments/olukny/printing_tabular_data/ |
01:40:42 | FromDiscord | <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:48 | FromDiscord | <ElegantBeef> You want to over ride the ctrl + c behaviour? |
01:49:50 | FromDiscord | <@bracketmaster-5a708063d73408ce4> like this? |
01:49:59 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/system.html#setControlCHook%2Cproc%29 |
01:50:18 | FromDiscord | <@bracketmaster-5a708063d73408ce4> nvm |
01:50:30 | FromDiscord | <@bracketmaster-5a708063d73408ce4> can I do fancy type constraint in Nim? |
01:50:37 | FromDiscord | <@bracketmaster-5a708063d73408ce4> sent a long message, see http://ix.io/3tdD |
01:50:44 | FromDiscord | <ElegantBeef> Jeez the bridge destroyed that |
01:51:34 | FromDiscord | <@bracketmaster-5a708063d73408ce4> https://play.nim-lang.org/#ix=3tdE |
01:52:30 | FromDiscord | <ElegantBeef> I dont think you can |
01:54:15 | FromDiscord | <ElegantBeef> It also doesnt make any sense |
01:55:01 | FromDiscord | <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:10 | FromDiscord | <ElegantBeef> and that logic applies to all static ints < 3 |
01:56:13 | FromDiscord | <ElegantBeef> (edit) "<" => "<=" |
01:58:27 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Actually, I wanted to do something where the function has two argument, each of type obj |
01:58:52 | FromDiscord | <@bracketmaster-5a708063d73408ce4> the proc signature enforces that one obj must be one larger than the other |
01:58:55 | FromDiscord | <ElegantBeef> Ok |
02:03:55 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I'm not sure that is possible either |
02:07:21 | FromDiscord | <theangryepicbanana> In reply to @@bracketmaster-5a708063d73408ce4 "type obj\*[n": there's a chance you could do this with concepts |
02:07:37 | FromDiscord | <@bracketmaster-5a708063d73408ce4> concepts |
02:07:44 | FromDiscord | <@bracketmaster-5a708063d73408ce4> what's that? |
02:07:54 | FromDiscord | <theangryepicbanana> they're a somewhat experimental feature |
02:08:03 | FromDiscord | <theangryepicbanana> basically typeclasses (if you've ever used those) |
02:08:41 | FromDiscord | <theangryepicbanana> https://nim-lang.org/docs/manual_experimental.html#concepts |
02:08:50 | FromDiscord | <@bracketmaster-5a708063d73408ce4> https://play.nim-lang.org/#ix=3tdL |
02:09:02 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Do concepts support that? |
02:09:09 | FromDiscord | <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:44 | FromDiscord | <theangryepicbanana> In reply to @@bracketmaster-5a708063d73408ce4 "Do concepts support that?": probably in combination with macros or a second generic parameter |
02:10:51 | FromDiscord | <carmysilna> In reply to @ElegantBeef "https://nim-lang.org/docs/system.html#setControlCHo": Thanks, that looks like exactly what I want |
02:12:12 | FromDiscord | <ElegantBeef> It's not ideal but you could do this https://play.nim-lang.org/#ix=3tdO |
02:12:24 | FromDiscord | <ElegantBeef> Not too far off what you were doing |
02:12:42 | FromDiscord | <ElegantBeef> Though the constraint is moved into the body instead of the procdef |
02:12:53 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I honestly think that will work |
02:13:04 | FromDiscord | <@bracketmaster-5a708063d73408ce4> its still compile time - so yeah, I'm happy |
02:13:13 | FromDiscord | <ElegantBeef> Though truthfully you dont need the `static Int` part |
02:13:20 | FromDiscord | <ElegantBeef> you cannot make an `obj` with anything but static cint |
02:14:00 | FromDiscord | <ElegantBeef> So this works fine https://play.nim-lang.org/#ix=3tdP |
02:14:33 | FromDiscord | <@bracketmaster-5a708063d73408ce4> you still had static[int] |
02:15:06 | FromDiscord | <ElegantBeef> refresh ix.io is a bit glitchy sometimes |
02:18:59 | FromDiscord | <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:06 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=3tdS congrats banana you had a better solution than i |
02:29:42 | FromDiscord | <generic linux user> babana where? |
02:29:52 | FromDiscord | <generic linux user> oh |
02:32:15 | FromDiscord | <theangryepicbanana> In reply to @ElegantBeef "https://play.nim-lang.org/#ix=3tdS congrats banana ": yay |
02:32:29 | FromDiscord | <theangryepicbanana> been doing some hacking into concepts lately ;) |
02:33:06 | FromDiscord | <ElegantBeef> Yea i dont touch them much but i've been slowly moving towards them |
02:33:12 | FromDiscord | <ElegantBeef> They have a lot of power, especially paired with macros |
02:33:16 | FromDiscord | <theangryepicbanana> they're pretty pog |
02:33:30 | FromDiscord | <theangryepicbanana> waiting for runtime concepts though (i.e interfaces) |
02:33:52 | FromDiscord | <ElegantBeef> I still dont get how iface doesnt solve that for you |
02:34:06 | FromDiscord | <ElegantBeef> I'm a numpty and it seems to match 1:1 what you want |
02:34:23 | FromDiscord | <theangryepicbanana> supposedly they were in the spec via vtref and vtptr for about 8 months before being removed for some reason |
02:34:56 | FromDiscord | <ElegantBeef> I mean araq does want to make it happen which is one reason for new style concepts |
02:34:56 | FromDiscord | <theangryepicbanana> In reply to @ElegantBeef "I still dont get": because I need actual inheritance behavior, not golang interfaces |
02:35:14 | FromDiscord | <ElegantBeef> So you need C# style interfaces? |
02:35:22 | FromDiscord | <theangryepicbanana> essentially yeah |
02:35:34 | FromDiscord | <theangryepicbanana> or like, interfaces in any language except golang |
02:35:43 | FromDiscord | <theangryepicbanana> (edit) "in" => "from" |
02:35:49 | FromDiscord | <ElegantBeef> hey i havent used many languages |
02:36:32 | FromDiscord | <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:38 | FromDiscord | <theangryepicbanana> basically interfaces form an "is-a" relationship with the types they're implemented in, similar to object inheritance |
02:36:46 | FromDiscord | <ElegantBeef> Well i know how they work |
02:36:53 | FromDiscord | <ElegantBeef> i've used them afterall |
02:37:00 | FromDiscord | <theangryepicbanana> I'm describing the behavior I need |
02:37:09 | FromDiscord | <ElegantBeef> Ah |
02:37:59 | FromDiscord | <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:11 | FromDiscord | <ElegantBeef> Sounds hellish |
02:38:29 | FromDiscord | <theangryepicbanana> pretty much yeah |
02:39:24 | FromDiscord | <ElegantBeef> With macros + macro cache this actually might be pretty reasonably achieved |
02:39:44 | FromDiscord | <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:59 | FromDiscord | <theangryepicbanana> (edit) "I can understand why it's difficult to make concepts a runtime thing ... though.languages" added "in nim" | "language" => "languages" |
02:40:16 | FromDiscord | <theangryepicbanana> scratch that, it's just raku lol |
02:40:32 | FromDiscord | <ElegantBeef> I swear if you have me writing an interface system.... đ |
02:40:42 | FromDiscord | <theangryepicbanana> oh raku is plenty fun |
02:41:10 | FromDiscord | <theangryepicbanana> imagine runtime concepts that also double as refinement types |
02:41:55 | FromDiscord | <ElegantBeef> presently thinking about making runtime concepts |
02:42:09 | FromDiscord | <theangryepicbanana> I mean it's possible |
02:42:50 | FromDiscord | <theangryepicbanana> probably easier to stick with concepts that are treated as interfaces though |
02:43:35 | FromDiscord | <theangryepicbanana> (so it's just has to check the is-a relationship) |
02:43:41 | FromDiscord | <theangryepicbanana> (edit) "it's" => "it" |
02:44:57 | FromDiscord | <theangryepicbanana> either way I'm sure it'll be fun |
02:45:29 | FromDiscord | <theangryepicbanana> yeah like that |
02:45:34 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3tdT |
02:48:49 | FromDiscord | <ElegantBeef> Trying to get away from the nested ifelse is a tricky thing đ |
02:49:33 | FromDiscord | <ElegantBeef> Cause you need to bake runtime information on instantiation of the object |
02:51:49 | FromDiscord | <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:38 | FromDiscord | <ElegantBeef> Oh right ranges dont default init to their range |
03:15:36 | FromDiscord | <theangryepicbanana> In reply to @ElegantBeef "Oh right ranges dont": you could always use high/low? |
03:17:02 | FromDiscord | <ElegantBeef> I mean you'd still have to convert it to the type to get that, so it'd be pointless |
03:18:58 | FromDiscord | <theangryepicbanana> yeah |
03:19:02 | FromDiscord | <theangryepicbanana> or actually |
03:20:08 | FromDiscord | <theangryepicbanana> In reply to @ElegantBeef "I mean you'd still": `typeof(default(Clickable).clickableId).high`? |
03:38:32 | FromDiscord | <Tuatarian> In reply to @ElegantBeef "Since around Nim 1.4.6(maybe": Will do, I have 1.4.4 |
04:01:44 | FromDiscord | <@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:10 | FromDiscord | <ElegantBeef> 4 different procs with 4 different bodies |
04:06:37 | * | supakeen joined #nim |
04:06:55 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I'm hoping nim re-uses the procs in the emitted code |
04:07:25 | FromDiscord | <ElegantBeef> Well depends what you're doing |
04:07:30 | FromDiscord | <@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:47 | FromDiscord | <ElegantBeef> Well if it's the same parameters it'd reuse it |
04:07:48 | FromDiscord | <juan_carlos> Different types can be optimized differently, etc. |
04:12:31 | FromDiscord | <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:02 | FromDiscord | <generic linux user> in a switch , will it be good if i use char instaed of int? |
05:18:08 | FromDiscord | <generic linux user> save memory? |
05:18:27 | FromDiscord | <generic linux user> after 9 i i used A,B.... |
05:20:03 | FromDiscord | <ElegantBeef> It's best to just make a program work then optimize it after |
05:20:12 | FromDiscord | <ElegantBeef> If you just need a char, use a char |
06:10:17 | FromDiscord | <Rika> In reply to @ElegantBeef "Well what i'm thinking": sounds easy |
06:10:35 | FromDiscord | <Rika> relative to other things i mean |
06:10:57 | FromDiscord | <ElegantBeef> Yea the one issue i see is the whole how to get what it is without having an ifelse branch |
06:11:15 | FromDiscord | <Rika> probably a set? |
06:11:39 | FromDiscord | <Rika> rtinfo: set[interfacetypes] # or whatever |
06:12:59 | FromDiscord | <Rika> well |
06:13:00 | FromDiscord | <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:12 | FromDiscord | <Rika> the issue with that is now you need access to the names of every concept used as an interface |
06:13:24 | FromDiscord | <Rika> prolly something to do with macrocache again, ive never used macrocache |
06:13:40 | FromDiscord | <ElegantBeef> Yea macrocache can do all the heavy lifting |
06:13:44 | FromDiscord | <Rika> In reply to @ElegantBeef "Well say it's a": when you implements: it adds the interface type to rtinfo |
06:14:15 | FromDiscord | <Rika> so you just check if type in rtinfo or w/e |
06:14:28 | FromDiscord | <Rika> i dont see what's wrong with one if branch |
06:14:51 | FromDiscord | <ElegantBeef> Well that doesnt help since each type has it's own implementation of the procedure |
06:15:30 | FromDiscord | <Rika> hm i dont really follow because ive never used anything like interfaceds |
06:15:31 | FromDiscord | <Rika> (edit) "interfaceds" => "interfaces" |
06:15:45 | FromDiscord | <ElegantBeef> Well interfaces can be overridden per object that implements them |
06:16:00 | FromDiscord | <Rika> okay, then |
06:16:01 | FromDiscord | <ElegantBeef> So you need some quick way to go from the base non specified object to the actual object |
06:16:15 | FromDiscord | <Rika> what? |
06:16:56 | FromDiscord | <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:19 | FromDiscord | <ElegantBeef> The thing is these interfaces behave like inherited objects, you can lose type information |
06:17:47 | FromDiscord | <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:01 | FromDiscord | <Rika> you cannot avoid if branches if you're doing that i dont thinkj |
06:18:13 | FromDiscord | <Rika> you cant embed types because theyre static info, you cant do a lot of things |
06:18:21 | FromDiscord | <Rika> vtable, hm |
06:18:28 | FromDiscord | <Rika> what's the trouble with using a vtable |
06:18:54 | FromDiscord | <ElegantBeef> well i was trying to figure out a way to embed the type id into the type for that |
06:19:09 | FromDiscord | <ElegantBeef> That way you arent reliant on using a specific procedure to intialize them |
06:19:23 | FromDiscord | <Rika> well you basically just assign a hash/random number to a type and have a lut for that i guess? |
06:20:52 | FromDiscord | <Rika> wait why do you need the type id w/e stuff, vtables dont have something like that do they? |
06:22:33 | FromDiscord | <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:01 | FromDiscord | <ElegantBeef> Though i was going to use the macrocache to not use a pointer |
06:23:54 | FromDiscord | <ElegantBeef> (edit) "Though i was going to use the macrocache to not use a pointer ... " added "directly" |
06:27:23 | FromDiscord | <Rika> dont think thats possible |
06:28:55 | FromDiscord | <ElegantBeef> What do you mean? |
06:30:27 | FromDiscord | <Rika> how would you not use a pointer directly? |
06:30:32 | FromDiscord | <Rika> well |
06:30:41 | FromDiscord | <Rika> okay its possible just less ergonomic i feel |
06:31:15 | FromDiscord | <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:01 | FromDiscord | <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:39 | FromDiscord | <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:01 | FromDiscord | <aleclarson> oh i found it \:)â”`seq[1..^1] |
08:10:04 | FromDiscord | <aleclarson> (edit) "\:)â”`seq[1..^1]" => "\:)â”`seq[1..^1]`" |
08:46:51 | * | sagax joined #nim |
09:00:06 | FromDiscord | <sealmove> wow! I am learning Kotlin and it's the most similar language to Nim in some aspects that I've seen |
09:01:35 | FromDiscord | <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:42 | FromDiscord | <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:48 | FromDiscord | <generic linux user> didnt even strip it |
09:43:00 | FromDiscord | <Rika> What? |
09:43:17 | FromDiscord | <Rika> Parse? |
09:43:26 | FromDiscord | <Rika> Put them inside where |
09:43:39 | FromDiscord | <generic linux user> inside you .nim file |
09:43:46 | FromDiscord | <Rika> Parse what? |
09:43:50 | FromDiscord | <generic linux user> copy the procs from stdlib |
09:44:07 | FromDiscord | <Rika> Does your program still work precisely as intended |
09:44:15 | FromDiscord | <generic linux user> https://media.discordapp.net/attachments/371759389889003532/865891637796274186/Screenshot_2021-07-17-15-14-04.jpeg |
09:44:22 | FromDiscord | <sealmove> how do you manage dependencies? |
09:44:25 | FromDiscord | <generic linux user> In reply to @Rika "Does your program still": yiss |
09:44:29 | FromDiscord | <Rika> Nim has dead code elimination so there should be no reason for the difference |
09:44:36 | FromDiscord | <generic linux user> there is |
09:44:44 | FromDiscord | <generic linux user> In reply to @Rika "Nim has dead code": i didnt know btw |
09:45:47 | FromDiscord | <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:46 | FromDiscord | <sealmove> So it's not a consistent way. The dead code elimination not working perfectly is interesting to investigate. |
09:48:23 | FromDiscord | <generic linux user> yess |
09:48:43 | FromDiscord | <generic linux user> a .nim file with nothing inside takes 44K(arm64) release |
09:48:47 | FromDiscord | <generic linux user> thats the baseline |
09:55:55 | FromDiscord | <generic linux user> @sealmoveâ”{.deadCodeElim: on.} doesnt seem to do anything |
09:56:50 | FromDiscord | <Rika> Itâs on by default |
09:57:20 | FromDiscord | <Rika> Why wouldnât you use opt size though |
09:58:17 | FromDiscord | <generic linux user> i dont really need it to be small |
09:58:28 | FromDiscord | <generic linux user> just optimizing size without losing performance |
09:58:50 | FromDiscord | <generic linux user> turing the switch on and off doesnt change the bin size tho |
09:58:59 | FromDiscord | <Rika> Which |
10:00:57 | FromDiscord | <generic linux user> https://media.discordapp.net/attachments/371759389889003532/865895839325749268/Screenshot_2021-07-17-15-30-46.jpeg |
10:01:03 | FromDiscord | <generic linux user> SUS |
10:01:16 | FromDiscord | <Rika> I said already itâs on by default |
10:01:22 | FromDiscord | <generic linux user> i tunred it off |
10:01:24 | FromDiscord | <Rika> Turning it on manually wonât change anything |
10:01:27 | FromDiscord | <Rika> Ah |
10:01:33 | FromDiscord | <Rika> I donât think you can turn it off either |
10:01:38 | FromDiscord | <Rika> Itâs a deprecated switch |
10:01:41 | FromDiscord | <generic linux user> a |
10:01:57 | FromDiscord | <generic linux user> wait |
10:02:18 | FromDiscord | <generic linux user> https://media.discordapp.net/attachments/371759389889003532/865896179539116032/Screenshot_2021-07-17-15-32-08.jpeg |
10:02:23 | FromDiscord | <generic linux user> oops |
10:03:07 | FromDiscord | <generic linux user> yes |
10:06:01 | FromDiscord | <generic linux user> thats convinient lol |
10:36:20 | * | al1ranger quit (Quit: Leaving) |
10:44:06 | FromDiscord | <hiros> What's a recommended profiler/debugger for nim? |
10:48:42 | FromDiscord | <Yinisiki> In reply to @hiros "What's a recommended profiler/debugger": i am using code runner plugin from vscode |
10:49:15 | FromDiscord | <Yinisiki> install code runner and type Ctrl+Alt+N in a nim code file |
10:53:30 | FromDiscord | <Yinisiki> Guys, i am facing a roadblock.... |
10:54:02 | FromDiscord | <Yinisiki> At line 19 column 8.... its showing this error https://media.discordapp.net/attachments/371759389889003532/865909196141625374/unknown.png |
10:54:34 | FromDiscord | <Yinisiki> this error https://media.discordapp.net/attachments/371759389889003532/865909338299170836/unknown.png |
10:55:40 | FromDiscord | <Yinisiki> I am stuck... please help! |
10:56:17 | FromDiscord | <pointystick> Missing a colon at the end of the 'for' line |
10:57:20 | FromDiscord | <Yinisiki> oops... worked like magic..... |
10:57:30 | FromDiscord | <Yinisiki> Thx @pointystick |
11:09:59 | FromDiscord | <0ffh> If a proc returns a ref tuple, does it auto-allocate or do I need to to new(result)? |
11:10:28 | FromDiscord | <0ffh> (edit) "to" => "do" |
11:11:52 | FromDiscord | <Rika> new result |
11:11:56 | FromDiscord | <Rika> oh wait |
11:12:11 | FromDiscord | <Rika> wdym? if the proc you're writing returns ref tuple? |
11:12:21 | FromDiscord | <Rika> if its your proc yes you need to do new result at the top |
11:12:30 | FromDiscord | <0ffh> Okay, thanks! |
11:13:35 | FromDiscord | <hiros> Is GDB really the best way to debug & profile my nim programs? |
11:14:07 | fn | <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:42 | FromDiscord | <hamidb80> hey |
11:37:28 | FromDiscord | <hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3tfl |
11:38:35 | FromDiscord | <hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3tfm |
11:39:30 | FromDiscord | <hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3tfn |
11:39:31 | FromDiscord | <Rika> need macro |
11:40:08 | FromDiscord | <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:14 | FromDiscord | <hamidb80> typed macro can help i guees |
11:45:06 | FromDiscord | <Rika> yes |
11:45:06 | FromDiscord | <hamidb80> since it resolves `ident`s to `sym` |
11:45:30 | FromDiscord | <hamidb80> (edit) "`ident`s" => "`ident`" |
11:57:42 | arkanoid | !evan 5/0 |
11:57:48 | arkanoid | !eval 5/0 |
11:57:49 | * | max22- quit (Ping timeout: 246 seconds) |
11:57:50 | NimBot | Compile failed: /usercode/in.nim(1, 2) Error: expression '5 / 0' is of type 'float' and has to be used (or discarded) |
11:57:58 | arkanoid | !eval echp(5/0) |
11:57:59 | NimBot | Compile failed: /usercode/in.nim(1, 1) Error: undeclared identifier: 'echp' |
11:58:08 | arkanoid | :( damn broken keyboard |
11:58:16 | FromDiscord | <Rika> needs fixin |
11:58:25 | FromDiscord | <Rika> !eval echo 5/0 |
11:58:27 | NimBot | inf |
11:58:39 | FromDiscord | <Rika> đ€ not nan? |
11:58:55 | FromDiscord | <Rika> !eval import fenv; echo 5/0 |
11:58:57 | NimBot | inf |
11:59:54 | FromDiscord | <Rika> !eval echo 5f64/0f64 |
11:59:56 | NimBot | inf |
12:02:40 | FromDiscord | <hamidb80> nan is for 0.0 / 0.0 |
12:02:54 | FromDiscord | <hamidb80> !eval echo 0.0/0.0 |
12:02:56 | NimBot | nan |
12:03:20 | FromDiscord | <Rika> hm i guess, but then should there not be a divbyzero exc.? |
12:03:39 | FromDiscord | <hamidb80> it should be |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:37 | * | supakeen joined #nim |
12:07:42 | FromDiscord | <hamidb80> In reply to @hiros "Is GDB really the": take a look at this:â”https://github.com/treeform/hottie |
12:07:45 | fn | <R2D299> itHub: 7"Sampling profiler that finds hot paths in your code." |
12:28:50 | FromDiscord | <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:18 | FromDiscord | <exelotl> it's a pointer to some memory that was allocated and filled with the contents of the file. |
12:31:26 | FromDiscord | <System64 ~ Flandre Scarlet> ah so P is a pointer? |
12:31:40 | FromDiscord | <leorize> p is that variable p declared aboveâ”(@System64 ~ Flandre Scarlet) |
12:31:42 | FromDiscord | <Rika> yes it shows in `void p` |
12:32:05 | FromDiscord | <System64 ~ Flandre Scarlet> okay so in nim I have to indicate it returns a pointer? |
12:32:13 | FromDiscord | <exelotl> the return type of the function is `char ` which would be `cstring` in Nim |
12:32:23 | FromDiscord | <exelotl> most likely |
12:32:46 | FromDiscord | <System64 ~ Flandre Scarlet> ah yeah I'm dumb lol |
12:32:58 | FromDiscord | <Rika> lol |
12:33:59 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/dmitrysmagin/a2t_play/blob/master/src/sdl.câ”But maybe it's a stream of bytes |
12:35:33 | FromDiscord | <System64 ~ Flandre Scarlet> 'cause one char is one byte |
12:35:43 | FromDiscord | <Rika> depends |
12:35:45 | FromDiscord | <System64 ~ Flandre Scarlet> so you can use a cstring as a stream of bytes |
12:35:48 | FromDiscord | <Rika> yes |
12:36:02 | FromDiscord | <Rika> if you explicitly want bytes probably `ptr UncheckedArray[byte]` |
12:36:22 | FromDiscord | <System64 ~ Flandre Scarlet> I'll still return a cstring since it's a cstring |
12:36:40 | FromDiscord | <Rika> In reply to @Rika "if you explicitly want": this is "equivalent" to a cstring though? |
12:37:27 | FromDiscord | <System64 ~ Flandre Scarlet> I think logically yeah |
12:38:36 | FromDiscord | <System64 ~ Flandre Scarlet> yeah it's used as a stream of bytes https://media.discordapp.net/attachments/371759389889003532/865935517489037312/unknown.png |
12:40:17 | FromDiscord | <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:53 | FromDiscord | <System64 ~ Flandre Scarlet> I guess my interop is done https://media.discordapp.net/attachments/371759389889003532/865936340121813032/unknown.png |
12:42:21 | FromDiscord | <exelotl> awesome :D |
12:42:24 | FromDiscord | <System64 ~ Flandre Scarlet> https://nim-lang.org/docs/backends.htmlâ”Followed that |
12:42:31 | FromDiscord | <Rika> sometimes it is better to be pedantic |
12:42:56 | FromDiscord | <System64 ~ Flandre Scarlet> But now I'll suffer with compilation 'cause WIndows is badly made |
12:43:24 | FromDiscord | <System64 ~ Flandre Scarlet> why the fck Microsoft you didn't do a lib folder or dunno what like Linux??? |
12:43:48 | FromDiscord | <System64 ~ Flandre Scarlet> On Linux AAALLLL your libs are in one place |
12:43:57 | FromDiscord | <Rika> because windows isnt programmer-first |
12:44:33 | FromDiscord | <System64 ~ Flandre Scarlet> Linux too I guess?â”I meant, Ubuntu or Mint for exemple are for all people |
12:45:40 | FromDiscord | <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:53 | FromDiscord | <System64 ~ Flandre Scarlet> yeah true |
12:46:11 | FromDiscord | <System64 ~ Flandre Scarlet> but I think Microsoft should put efforts for devs |
12:46:53 | FromDiscord | <Rika> wsl |
12:47:45 | FromDiscord | <System64 ~ Flandre Scarlet> it's still Linux so if you compile from there, you compile for Linux |
12:47:59 | FromDiscord | <System64 ~ Flandre Scarlet> I might got wrong but I think you compile for Linux |
12:48:16 | FromDiscord | <Rika> yes indeed |
12:48:23 | FromDiscord | <Rika> do you need to run this on windows? |
12:48:30 | FromDiscord | <System64 ~ Flandre Scarlet> yeah it's for my game |
12:48:46 | FromDiscord | <Rika> i dont know windows too much so gl lol |
12:48:56 | FromDiscord | <System64 ~ Flandre Scarlet> and also, Windows is the most used operating system so Windows has priority for me |
12:49:15 | FromDiscord | <System64 ~ Flandre Scarlet> I don't reject Linux, I love Linux, but to hit more people I need Windows first |
12:49:22 | FromDiscord | <Rika> wasnt gonna say anything about that |
12:49:35 | FromDiscord | <System64 ~ Flandre Scarlet> My secondary PC runs Arch btw |
12:49:43 | FromDiscord | <System64 ~ Flandre Scarlet> (well Archcraft in fact) |
12:50:21 | FromDiscord | <System64 ~ Flandre Scarlet> and no, it's not as unstable as most of people think |
12:52:51 | arkanoid | I 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:51 | FromDiscord | <haxscramper> We dont' have HKT |
12:54:09 | FromDiscord | <haxscramper> There is no sane workaround IIRC |
12:54:44 | arkanoid | didn't even realize I was touching that subject |
12:54:49 | FromDiscord | <haxscramper> And I don't think there is any hack that would be barely usable either |
12:55:06 | FromDiscord | <haxscramper> `M[T]` |
12:55:07 | FromDiscord | <haxscramper> If I'm not mistaken this is a HKT |
12:55:55 | arkanoid | possibly, yes |
12:57:58 | arkanoid | General question: if I have "type MyType[A]", what is MyType and what is MyType[int] when reading the documentation? |
12:58:17 | arkanoid | MyType is a type? Is a generic type? MyType[int] is a real type? |
13:01:10 | FromDiscord | <haxscramper> You mean when `MyType` is used like foo/bar? |
13:01:21 | FromDiscord | <haxscramper> Otherwise it depends on context of course |
13:01:50 | FromDiscord | <haxscramper> `MyType` is a name of the type, `MyType[int]` is a concrete specialization that might have some additional semantics |
13:06:02 | arkanoid | is it possible to extract type "int" from type "MyType[int]" in a template? |
13:08:54 | arkanoid | got it, is https://nim-lang.org/docs/typetraits.html#genericParams.t%2Ctypedesc |
13:12:18 | arkanoid | no, it's not working as expected |
13:14:08 | arkanoid | eval! import typetraits; type Foo[T] = object; func bar[A]() = echo genericParams(A); bar[Foo[int]] |
13:14:51 | arkanoid | eval! import typetraits; type Foo[T] = object; func bar[A]() = echo genericParams(A); bar[Foo[int]]() |
13:15:19 | FromDiscord | <haxscramper> you can't declare function and use it in one lien |
13:15:31 | FromDiscord | <haxscramper> `; bar[Foo[int]]` is a part of the function |
13:17:12 | arkanoid | https://play.nim-lang.org/#ix=3tfK |
13:17:44 | FromDiscord | <hiros> For those with experience with gdscript, how different is gdscript from nim? Because both nim and gdscript are python like. |
13:18:13 | arkanoid | but this one works correcly, just by avoiding generic parameter: https://play.nim-lang.org/#ix=3tfL |
13:22:20 | FromDiscord | <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:44 | FromDiscord | <haxscramper> So before you go into this I warn you - most likely it will be 95% frustration |
13:22:53 | FromDiscord | <haxscramper> 4% maybe things working |
13:23:25 | FromDiscord | <haxscramper> And 1% of useful knowledge that yes, you can in fact do something with it, sometimes, in simple cases |
13:26:13 | arkanoid | yeah 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:18 | FromDiscord | <hiros> Is there a GUI IDE for nim you recommend that has stuff like graphical profiling and the like? |
13:26:19 | arkanoid | this works https://play.nim-lang.org/#ix=3tfL |
13:27:30 | FromDiscord | <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:29 | arkanoid | a template without params but just type params has to be called without()!? |
13:31:20 | arkanoid | If I change "bar[Foo[int]]" in "bar[Foo[int]]()" int https://play.nim-lang.org/#ix=3tfL it doesn't work |
13:31:42 | FromDiscord | <Rika> what? |
13:32:19 | FromDiscord | <Rika> can you say that again, the bridge mangled it |
13:32:25 | * | aeverr joined #nim |
13:33:11 | FromDiscord | <Rika> arkanoid mind saying that again? |
13:33:43 | arkanoid | Rika, 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:50 | FromDiscord | <Bung> @haxscramper how is the example yesterday you talk about ? |
13:34:09 | arkanoid | I might be just getting confused by generics+templating |
13:34:11 | aeverr | arkanoid, so you mean bar()()? |
13:34:55 | arkanoid | aeverr: no, I mean replace "bar[Foo[int]]" with "bar[Foo[int]]()" |
13:35:12 | FromDiscord | <konsumlamm> there is no "bar[Foo[int]]" in your code |
13:35:18 | aeverr | had the wrong link open |
13:35:23 | aeverr | wait i didnt?? |
13:35:33 | * | max22- joined #nim |
13:35:33 | FromDiscord | <haxscramper> You need it literally now or this can wait?â”(@Bung) |
13:35:39 | aeverr | i think you have the wrong link |
13:35:56 | arkanoid | oh! wait, you're right, my browser cache went nuts. 1 secs |
13:36:15 | FromDiscord | <Bung> wait for api I can call with args directlyđ |
13:36:23 | arkanoid | https://play.nim-lang.org/#ix=3tfM |
13:37:08 | aeverr | seems like a bug |
13:37:21 | aeverr | you can add () if you make the template say `echo genericParams(type M)` |
13:37:44 | aeverr | its kind of odd but i think its consistent |
13:38:39 | arkanoid | well it really seems that templates can be called without parethesis: https://play.nim-lang.org/#ix=3tfN |
13:41:44 | arkanoid | aeverr: 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:56 | aeverr | huh true |
13:42:04 | arkanoid | I need to extract generic param, so second version is not correct |
13:42:08 | aeverr | i get why |
13:42:18 | aeverr | because it becomes typedesc[Foo[int]] |
13:42:26 | aeverr | okay so hm then its probably a bug |
13:43:01 | aeverr | wait |
13:43:04 | aeverr | that doesnt make sense |
13:43:12 | aeverr | genericParams takes a typedesc |
13:43:19 | aeverr | so that should totally work |
13:44:06 | arkanoid | also 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:43 | aeverr | https://play.nim-lang.org/#ix=3tfQ stranger way to do this |
13:44:50 | arkanoid | well, 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:20 | aeverr | you cannot store the result i assume because it is a tuple of types |
13:47:22 | arkanoid | but 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:02 | FromDiscord | <hiros> Nim isn't putting the C file where I'm telling it to. |
13:50:46 | aeverr | arkanoid thats because it's a type, i just discovered. `(int, )` is a type referring to a tuple with one int i believe |
13:51:00 | aeverr | yup indeed it is |
13:51:13 | FromDiscord | <haxscramper> `--nimcache:your/cache/directory`â”(@hiros) |
13:51:15 | aeverr | you can use `get` in typetraits as well |
13:51:32 | aeverr | so `let bar: genericParams(M).get(0)` |
13:53:02 | arkanoid | aeverr: it works! thanks |
13:53:18 | FromDiscord | <hiros> Thanks @haxscramper that worked. |
13:53:18 | aeverr | nice |
13:53:37 | aeverr | btw im rika i switched to irc just to check the thing you said w/o the bridge fucking shit |
13:56:32 | arkanoid | if 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:46 | arkanoid | not a real deal |
13:57:54 | FromDiscord | <Rika> its an internal error |
13:58:00 | FromDiscord | <Rika> so its prolly a bug |
13:58:14 | FromDiscord | <Rika> either already in an issue or needs to be made an issue |
13:58:18 | arkanoid | what's the difference between "typedescr" and "typed" in template parameters, both seems to work for my playground |
13:59:40 | arkanoid | possibly this error https://github.com/nim-lang/Nim/issues/16600 |
13:59:47 | aeverr | typedesc is a type, typed is an expression |
14:00:05 | aeverr | "type description", "typed code" |
14:04:27 | FromDiscord | <konsumlamm> sometimes i feel like some parts of Nim are just horribly broken beyond any hope of repair |
14:05:21 | arkanoid | konsumlamm, it's the same boundary I'm trying to touch before using nim in production |
14:06:39 | arkanoid | yet for now I feel it is the most advanced system languages I know |
14:07:27 | FromDiscord | <konsumlamm> well, there aren't that many systems languages to begin with :P |
14:07:50 | FromDiscord | <konsumlamm> Rust's type system is also quite advanced, even more in some areas, but less in others |
14:07:57 | arkanoid | I 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:33 | FromDiscord | <konsumlamm> `type MyType = genericParams(M).get(0)`? |
14:12:00 | * | SebastianM quit (Ping timeout: 255 seconds) |
14:12:52 | arkanoid | yeah, it worked |
14:13:20 | arkanoid | quite sure I tried that first .... |
14:13:28 | FromDiscord | <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:16 | FromDiscord | <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:18 | arkanoid | I 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:40 | arkanoid | the first (T: type params) seems just sugar for generics |
14:37:05 | arkanoid | typed is a thing for templates, but typedesc puzzles me |
14:38:36 | FromDiscord | <Rika> chars can be signed in C |
14:49:53 | FromDiscord | <hiros> I don't think gdb with nim works on windows. |
14:50:45 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "chars can be signed": ah alright |
14:50:56 | FromDiscord | <System64 ~ Flandre Scarlet> so the equivalent in nim? |
14:51:05 | FromDiscord | <System64 ~ Flandre Scarlet> uInt8? |
14:51:48 | FromDiscord | <System64 ~ Flandre Scarlet> ah ptr uInt8 yeah |
14:56:06 | * | SebastianM quit (Ping timeout: 255 seconds) |
14:58:56 | FromDiscord | <System64 ~ Flandre Scarlet> I have to put the compile pragma before each proc? https://media.discordapp.net/attachments/371759389889003532/865970833050042368/unknown.png |
15:00:25 | FromDiscord | <Rika> no |
15:02:53 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
15:08:34 | arkanoid | is 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:11 | FromDiscord | <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:23 | FromDiscord | <Rika> you have to start typing wdym |
15:22:51 | FromDiscord | <System64 ~ Flandre Scarlet> yeah what I did |
15:22:51 | fn | <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:04 | FromDiscord | <System64 ~ Flandre Scarlet> nothing https://media.discordapp.net/attachments/371759389889003532/865976907592761354/unknown.png |
15:31:25 | FromDiscord | <System64 ~ Flandre Scarlet> t doesn't suggest anything |
15:31:58 | FromDiscord | <Rika> nimsuggest probably died again then |
15:32:06 | FromDiscord | <SolitudeSF> damn, that sucks... |
15:33:27 | FromDiscord | <System64 ~ Flandre Scarlet> Even worse, it displays an error but my proc exists https://media.discordapp.net/attachments/371759389889003532/865979516311961661/unknown.png |
15:34:34 | FromDiscord | <Rika> might not be exported |
15:34:34 | FromDiscord | <Rika> lol |
15:34:38 | FromDiscord | <Rika> i just checked your old image |
15:34:41 | FromDiscord | <Rika> indeed not exported |
15:34:57 | FromDiscord | <System64 ~ Flandre Scarlet> what should I do? |
15:35:21 | FromDiscord | <Rika> in the file with compile |
15:35:37 | FromDiscord | <Rika> add a `` before the parentheses of each proc |
15:35:52 | FromDiscord | <SolitudeSF> read tutorial |
15:38:03 | FromDiscord | <System64 ~ Flandre Scarlet> Aaaah yeah sorry |
15:59:39 | FromDiscord | <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:01 | FromDiscord | <generic linux user> and it does work tho |
16:01:14 | FromDiscord | <generic linux user> just asked if it was better than using int |
16:04:05 | * | stkrdknmibalz joined #nim |
16:31:19 | fn | <ForumUpdaterBot99> New question by georgehu: implementing setInterval/clearInterval in nim, see https://stackoverflow.com/questions/68422361/implementing-setinterval-clearinterval-in-nim |
17:11:05 | arkanoid | I 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:49 | arkanoid | this is the line executed by vscodium "nim c -r "/home/arkanoid/nim/experiments/myproject.nim"" |
17:15:25 | arkanoid | If I rename myproject.nims into config.nims it works correctly |
17:15:43 | arkanoid | is this page updated? https://nim-lang.org/docs/nims.html |
17:28:55 | * | max22- quit (Ping timeout: 246 seconds) |
17:37:47 | FromDiscord | <SolitudeSF> arkanoid, works on my machine |
17:38:23 | arkanoid | classic |
17:40:24 | FromDiscord | <SolitudeSF> does compiler output hint `used config file myproject.nims`? |
17:43:13 | FromDiscord | <Rika> prolly has to be in the same pwd |
17:44:14 | FromDiscord | <SolitudeSF> no |
17:44:23 | arkanoid | no it doesn't output that |
17:44:53 | fn | <Prestige99> weird, I thought it did đ€ |
17:49:08 | FromDiscord | <haxscramper> It does, but at verbosity\:3 and hints enabled |
17:49:27 | FromDiscord | <generic linux user> :3 <- why this tho |
17:50:24 | FromDiscord | <timotheecour> `--hint:conf` |
17:51:25 | FromDiscord | <aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3thW |
17:52:11 | FromDiscord | <SolitudeSF> {.discardable.} |
17:52:30 | arkanoid | I've another problem with httpclient: Error: unhandled exception: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure [SslError] |
17:52:48 | FromDiscord | <generic linux user> sslerror |
17:52:49 | arkanoid | same url opens correctly with: browser/openssl -s client/curl |
17:52:56 | FromDiscord | <generic linux user> i have it too |
17:53:05 | FromDiscord | <generic linux user> in nimble |
18:00:34 | arkanoid | I've solved the problem by lowering the SSL cypher levels in SSL context (probably connecting to old site) |
18:00:47 | arkanoid | let sslContext = newContext(protVersion = protSSLv23, verifyMode = CVerifyPeer, CiphersOld) |
18:00:55 | arkanoid | https://nim-lang.org/docs/ssl_config.html#CiphersOld |
18:05:40 | arkanoid | sorry, pasted incomplete line: let sslContext = newContext(protVersion = protSSLv23, verifyMode = CVerifyPeer, cipherList = CiphersOld) |
18:06:38 | FromDiscord | <dom96> interesting, can you add this trick to our docs? đ |
18:40:24 | arkanoid | dom96 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:26 | FromDiscord | <dom96> still, might be worth to add it in so that this problem is searchable |
19:12:05 | FromDiscord | <hamidb80> ۧ۫Űș |
19:12:07 | FromDiscord | <hamidb80> hey |
19:12:20 | FromDiscord | <hamidb80> can i raise custom exception with custom fields? |
19:12:57 | FromDiscord | <haxscramper> yes, |
19:13:09 | FromDiscord | <haxscramper> `YourException = object of CatchableError` |
19:13:51 | FromDiscord | <hamidb80> ok how to raise it ( and fill those cutom fields)? |
19:14:08 | FromDiscord | <hamidb80> `newException` seems not useful |
19:14:10 | FromDiscord | <hamidb80> here |
19:14:22 | FromDiscord | <haxscramper> Write a constructor for your exception |
19:14:28 | FromDiscord | <theangryepicbanana> don't you use `raise YourException()` |
19:14:30 | FromDiscord | <theangryepicbanana> lol |
19:14:40 | FromDiscord | <haxscramper> Or do `var exception = newException(YourException, msg)` |
19:14:49 | FromDiscord | <haxscramper> Then set necessary fields |
19:14:55 | FromDiscord | <hamidb80> thanks |
19:15:32 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3til |
19:15:47 | FromDiscord | <haxscramper> Your constructor must return `ref` type, but it is better to define exception as non-ref type |
19:16:14 | FromDiscord | <haxscramper> `newException` internally doers `(ref ErrType)(msg: "text")` |
19:17:56 | FromDiscord | <hamidb80> +1 |
19:18:25 | FromDiscord | <haxscramper> if you want to know more concrete timeline - I started working on the example for nimscripter, @Bung |
19:19:27 | FromDiscord | <haxscramper> Though it looks like `Error: illformed AST:` will drive my crazy earlier |
19:35:42 | * | neceve joined #nim |
19:38:32 | FromDiscord | <hamidb80> how can i convert a var that has a type `T` to a `ref T` ? |
19:39:06 | FromDiscord | <hamidb80> `(ref T)(myVar)` ? |
19:39:11 | FromDiscord | <Rika> `var a = new T; a[] = old` |
19:39:38 | FromDiscord | <Rika> well, can be `let` |
19:40:56 | FromDiscord | <aleclarson> In reply to @SolitudeSF "{.discardable.}": thx Solitude ^^ |
19:50:29 | * | koltrast quit (Quit: ZNC - http://znc.in) |
19:51:09 | arkanoid | why parseJson is not available at compile time? I'm reading static json from file with readFile into const |
19:52:14 | FromDiscord | <Rika> parseJson is a deeply nested ref object which afaik isnt supported in nimscript |
19:53:05 | FromDiscord | <timotheecour> upvote https://github.com/nim-lang/Nim/pull/15528 if you want to allow it in future |
19:54:42 | arkanoid | (y) |
20:00:26 | arkanoid | the 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:36 | FromDiscord | <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:32 | arkanoid | no? |
20:08:04 | FromDiscord | <Rika> i'm confused, what are you trying to do exactly |
20:08:19 | FromDiscord | <Rika> you use `%` to convert something to a JsonNode |
20:08:28 | FromDiscord | <Rika> (i believe?) |
20:09:46 | arkanoid | I'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:12 | arkanoid | I'm using "$$" of marshal module on the data structure, not |
20:10:14 | arkanoid | *now |
20:11:23 | FromDiscord | <Rika> yes and i believe it's % to go back to json |
20:11:29 | FromDiscord | <Rika> or % i dont remember |
20:13:28 | arkanoid | you're right! thanks |
20:15:12 | FromDiscord | <System64 ~ Flandre Scarlet> I try to interop with C but : https://media.discordapp.net/attachments/371759389889003532/866050423102373928/unknown.png |
20:15:43 | FromDiscord | <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:41 | FromDiscord | <System64 ~ Flandre Scarlet> is it normal? |
20:36:20 | FromDiscord | <haxscramper> Normal programs tend to compile, so probably no |
20:36:27 | FromDiscord | <haxscramper> You are missing linkage with some static library |
20:39:28 | FromDiscord | <System64 ~ Flandre Scarlet> It's C source code |
20:40:48 | FromDiscord | <System64 ~ Flandre Scarlet> so I need to compile the C code first? |
20:40:59 | * | vicfred joined #nim |
20:41:28 | FromDiscord | <haxscramper> ... |
20:41:33 | FromDiscord | <haxscramper> Yes, you need to compile whole program |
20:41:46 | FromDiscord | <System64 ~ Flandre Scarlet> Ah |
20:41:56 | FromDiscord | <haxscramper> Nim has `{.compile:` for external c files |
20:42:06 | FromDiscord | <haxscramper> So you don't have to manually run GCC on the files |
20:42:32 | FromDiscord | <System64 ~ Flandre Scarlet> so maybe I have to put a compile for all C files? |
20:43:34 | FromDiscord | <haxscramper> Yes, add all files to .compile., that should work |
20:43:39 | FromDiscord | <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:36 | FromDiscord | <haxscramper> That is simply a procedure that takes two arguments |
20:44:54 | FromDiscord | <haxscramper> Not an operator, the just omitted parentheses |
20:45:12 | FromDiscord | <System64 ~ Flandre Scarlet> and it works! |
20:48:26 | FromDiscord | <bernardo> In reply to @haxscramper "Not an operator, the": do you mean the `ok` omits the parentheses?â”is that an implicit return? |
20:49:18 | FromDiscord | <Rika> nim MCS |
20:49:34 | FromDiscord | <Rika> you can omit parentheses in "method style call" |
20:49:45 | FromDiscord | <ElegantBeef> Well it's not MCS it's the command syntax đ |
20:49:48 | FromDiscord | <SolitudeSF> thats not mcs |
20:50:12 | FromDiscord | <Rika> ok i read "operator" and thought binary operator |
20:50:20 | FromDiscord | <Rika> thought they saw `x.ok y` |
20:50:28 | FromDiscord | <Rika> usually what people mistake as operators |
20:51:19 | FromDiscord | <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:45 | FromDiscord | <ElegantBeef> in this example you cannot supply anymore than 1 extra argument to `fooTwo` due to the result being passed to foo |
20:51:54 | FromDiscord | <Rika> haskell `$` when |
20:53:15 | FromDiscord | <Rika> In reply to @Rika "ok i read "operator"": if you want more explanation, i dont open linkts |
20:53:17 | FromDiscord | <Rika> links |
20:53:24 | FromDiscord | <Rika> it takes me a few seconds to load a link |
20:53:35 | FromDiscord | <ElegantBeef> It's ok rika we believe you |
20:53:47 | FromDiscord | <Rika> sure |
20:53:55 | FromDiscord | <ElegantBeef> Anywho @bernardo it's documented here https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax |
20:56:29 | FromDiscord | <treeform> In reply to @arkanoid "why parseJson is not": jsony can parse json at compile time. |
20:56:55 | FromDiscord | <treeform> https://github.com/treeform/jsony |
20:56:57 | fn | <R2D299> itHub: 7"A loose, direct to object json parser with hooks." |
20:57:07 | arkanoid | treeform, that's a good news! thanks! |
20:57:18 | FromDiscord | <bernardo> In reply to @ElegantBeef "Anywho <@!602790129500684308> it's": thanks! so `ok` is actually a procedure? |
20:57:24 | FromDiscord | <Rika> yes |
21:07:41 | * | max22- joined #nim |
21:08:52 | * | Lord_Nightmare quit (Ping timeout: 245 seconds) |
21:16:58 | FromDiscord | <bernardo> ok found it, it's actually a template: https://github.com/status-im/nim-stew/blob/3c91b8694e15137a81ec7db37c6c58194ec94a6a/stew/results.nim#L292 |
21:18:26 | FromDiscord | <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:38 | FromDiscord | <ElegantBeef> ctrl click the `ok` |
21:20:09 | FromDiscord | <bernardo> In reply to @ElegantBeef "ctrl click the `ok`": just did it, got nothing |
21:21:08 | FromDiscord | <ElegantBeef> If nimstew was installed as a nimble package it should've worked |
21:21:27 | FromDiscord | <ElegantBeef> Assuming your goto definition works |
21:25:04 | FromDiscord | <bernardo> In reply to @ElegantBeef "*Assuming your goto definition": is that the same as right-click, `Go to Definition (F12)`? |
21:25:28 | FromDiscord | <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:17 | FromDiscord | <bernardo> aha! I had two different extensions (`kosz78.nim` + `nimsaem.nimvscode`), disabling `kosz78.nim` made goto work |
21:30:25 | FromDiscord | <ElegantBeef> Ah there you go |
21:31:12 | FromDiscord | <bernardo> In reply to @ElegantBeef "Ah there you go": thanks again! |
22:44:35 | FromDiscord | <System64 ~ Flandre Scarlet> it works I implemented OPL3 emulation |
22:57:57 | * | max22- quit (Remote host closed the connection) |
23:18:49 | FromDiscord | <dom96> No wonder AVs are marking the compiler as malicious https://huskyhacks.dev/2021/07/17/nim-exploit-dev/ |
23:19:30 | FromDiscord | <VVX7> seeing a lot of red teams playing with Nim |
23:19:44 | FromDiscord | <VVX7> so yeah, not surprised by that |
23:19:57 | FromDiscord | <dom96> _wonders what a "red team" is_ |
23:20:08 | fn | <Prestige99> offensive hacking |
23:37:32 | FromDiscord | <Daniel> but any programming language can be use for malicious purposes |
23:53:56 | fn | <Prestige99> depends on the requirements |
23:59:30 | arkanoid | treeform, jsony is great! |