<< 13-07-2021 >>

00:03:12*vicfred joined #nim
00:19:06FromDiscord<retkid> Is there anyway I can program on my phone
00:19:07FromDiscord<retkid> Ugh
00:19:10FromDiscord<retkid> I just miss it
00:19:15FromDiscord<retkid> I need to practice
00:20:35FromDiscord<theangryepicbanana> In reply to @retkid "Is there anyway I": replit.com supports a (somewhat) recent version of nim
00:21:07FromDiscord<theangryepicbanana> the mobile code editor is really good
00:21:26FromDiscord<konsumlamm> ime, repl.it on mobile is horrible
00:21:34FromDiscord<theangryepicbanana> how long ago did you try it?
00:21:40FromDiscord<retkid> I can try it
00:21:43FromDiscord<konsumlamm> few months maybe
00:21:50FromDiscord<retkid> I’ll probably airplay it to my monitor
00:22:06FromDiscord<konsumlamm> entering a comma would repeat the input or some shit
00:22:13FromDiscord<theangryepicbanana> In reply to @konsumlamm "few months maybe": it's been getting worked on over the last several months (ik the person who's working on it)
00:22:24FromDiscord<theangryepicbanana> (edit) "worked on" => "improved"
00:23:13FromDiscord<theangryepicbanana> I use it on my phone sometimes and I haven't had any major issues
00:23:17FromDiscord<theangryepicbanana> (edit) "I use it on my phone sometimes and I haven't had any major issues ... " added "recently"
00:25:33FromDiscord<retkid> In reply to @theangryepicbanana "it's been getting improved": Why don’t you become a person working on it
00:26:13FromDiscord<theangryepicbanana> In reply to @retkid "Why don’t you become": I have been, just not specifically on the mobile controls (although that'll be fixed eventually anyways)
00:26:47FromDiscord<theangryepicbanana> (edit) "anyways)" => "anyways for reasons)"
00:27:19FromDiscord<theangryepicbanana> I can send a screen recording of me using nim on my phone if you want
00:27:45FromDiscord<retkid> I wanna learn how Nim compiled w JS n see if I can get some stuff working
00:27:53FromDiscord<retkid> Also Nim to Java compilation
00:28:07FromDiscord<theangryepicbanana> nim doesn't compile to java but sure lol
00:28:25FromDiscord<retkid> Compiles to C
00:28:31FromDiscord<retkid> Which can
00:29:04FromDiscord<theangryepicbanana> java doesn't compile to c
00:29:39FromDiscord<retkid> No you can compile to Java using weird tools
00:29:41FromDiscord<theangryepicbanana> But anyways here's the thing https://media.discordapp.net/attachments/371759389889003532/864302525863297034/video0.mov
00:30:13FromDiscord<theangryepicbanana> cut off a bit early at the end but eh
00:30:19FromDiscord<ElegantBeef> You could also use termux
00:30:26FromDiscord<theangryepicbanana> this works on ios too tho
00:30:27FromDiscord<ElegantBeef> But phone programming is scary
00:30:39FromDiscord<theangryepicbanana> nah
00:30:47FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/864302801080680458/image0.png
00:30:50FromDiscord<retkid> Or I can try this
00:30:55FromDiscord<theangryepicbanana> I mean
00:31:02FromDiscord<theangryepicbanana> if you really want to go the hard way then sure
00:31:23FromDiscord<theangryepicbanana> oh did you meant testing java > nim separately from your phone thingy
00:31:29FromDiscord<theangryepicbanana> (edit) ">" => "->"
00:31:50FromDiscord<retkid> Kinda but this Linux stuff can’t really run in my phone or cloud
00:32:07FromDiscord<theangryepicbanana> no it'll work anyways
00:32:15FromDiscord<theangryepicbanana> replit doesn't run the code directly on your device
00:32:31FromDiscord<retkid> Ooo
00:32:44fn<ForumUpdaterBot99> New post on r/nim by shujidev: Create an object in a macro, see https://reddit.com/r/nim/comments/oj4bnz/create_an_object_in_a_macro/
00:32:48FromDiscord<theangryepicbanana> it's run elsewhere (on a "cloud vm") and then it communicates with your phone like ssh or something
00:32:49FromDiscord<retkid> I wonder if I can get a Minecraft plugin to work
00:32:56FromDiscord<theangryepicbanana> yeah you can
00:33:11FromDiscord<theangryepicbanana> it's basically a virtual computer, even supports graphics and stuff
00:33:25FromDiscord<theangryepicbanana> that's why I can run nim on my iphone lol
00:33:34FromDiscord<retkid> I mean for jnim
00:33:38FromDiscord<theangryepicbanana> ah
00:33:43FromDiscord<theangryepicbanana> ig
00:33:49FromDiscord<retkid> Testing it on Minecraft won’t work haha
00:34:17FromDiscord<theangryepicbanana> you could technically run nim/java in minecraft lol
00:34:21FromDiscord<retkid> I also wanna see if I can get the Minecraft rending engine to render in an ascii pipe then play on terminal
00:34:36FromDiscord<retkid> In reply to @theangryepicbanana "you could technically run": Not for plugins tho I think those have to be Java
00:34:49FromDiscord<retkid> Think for mods you can use C binaries
00:34:59FromDiscord<theangryepicbanana> In reply to @retkid "Not for plugins tho": nah have you seen langcraft (or whatever it's called?)
00:35:29FromDiscord<theangryepicbanana> it's basically a version of llvm that compiles to minecraft datapacka
00:35:30FromDiscord<theangryepicbanana> (edit) "datapacka" => "datapacks"
00:36:02FromDiscord<theangryepicbanana> there's a video of someone running rust in minecraft, so I'm sure java/nim are possible ;)
00:36:31FromDiscord<retkid> I’m happy and sad to be alive in 2021
00:36:38FromDiscord<theangryepicbanana> this came out last year
00:36:42FromDiscord<theangryepicbanana> maybe 2019 idk
00:36:45FromDiscord<theangryepicbanana> very pog tho
00:36:54FromDiscord<retkid> All the good ideas are taken but also I have to do no work
00:37:13FromDiscord<theangryepicbanana> lol
00:44:23*Figworm joined #nim
01:05:39FromDiscord<Rika> a person here tried running nim for minecraft before
01:05:49FromDiscord<Rika> i dont know if they still use the same name as before
01:47:59FromDiscord<theangryepicbanana> I think I asked about this yesterday, but has there been any work done to (at least partially) implement vtable types or converter typeclasses?
01:48:24FromDiscord<theangryepicbanana> (would this be a better question for #internals?)
01:57:49FromDiscord<Bung> Error: cannot 'importc' variable at compile time; pipe, why I cant call io related proc like execCmdEx in macro ? since the macro only returns ast
02:00:17FromDiscord<Elegantbeef> Do you mean call it from the emitted code or from the code ran inside?
02:01:14FromDiscord<Elegantbeef> The nim vm cannot call C code so use `gorge` or `staticExec` in place of `execCmdEx`
02:10:46FromDiscord<Bung> I mean inside macro body
02:15:44FromDiscord<Bung> nvm, give up
03:07:48*arkurious quit (Quit: Leaving)
03:44:55FromDiscord<theangryepicbanana> found this black magic. dunno if it still works https://forum.nim-lang.org/t/3642#22706
03:46:40*rockcavera joined #nim
03:46:40*rockcavera quit (Changing host)
03:46:40*rockcavera joined #nim
03:50:21FromDiscord<Rika> Not recommended
03:53:34FromDiscord<theangryepicbanana> In reply to @Rika "Not recommended": why not?
03:53:41FromDiscord<theangryepicbanana> I don't care about overhead
03:54:16FromDiscord<Rika> Unsafe
03:54:21FromDiscord<Rika> Casting pointers to integers
03:54:29FromDiscord<theangryepicbanana> lol even better
03:54:52FromDiscord<theangryepicbanana> as long as it works without leaking too much memory, I don't mind
03:55:05FromDiscord<Rika> If you’re making a library, I advise against it
03:55:09FromDiscord<Rika> Otherwise whatever
03:55:10FromDiscord<theangryepicbanana> I'm not
03:55:35FromDiscord<Rika> Maybe look at the last link at the bottom of the page
03:55:46FromDiscord<theangryepicbanana> ok
03:55:59FromDiscord<theangryepicbanana> In reply to @Rika "Otherwise whatever": I'm, uh, compiling my language to nim in order to bootstrap it lol
03:56:35FromDiscord<theangryepicbanana> nim has pretty much everything I need except vtable types/interfaces
03:58:09FromDiscord<theangryepicbanana> my other solution was going to be abusing genericHead and concepts, but I like this more
03:59:04FromDiscord<theangryepicbanana> In reply to @Rika "Maybe look at the": bookmarked, will use as a backup
04:02:52FromDiscord<theangryepicbanana> oh imma assume neither of these will like generic virtual methods huh
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:38*supakeen joined #nim
05:00:55*rockcavera quit (Remote host closed the connection)
05:44:53fn<ForumUpdaterBot99> New thread by Xioren: Don't understand macros compile error, see https://forum.nim-lang.org/t/8229
06:05:40*stkrdknmibalz quit (Remote host closed the connection)
06:22:37*Vladar joined #nim
07:07:53FromDiscord<Bung> @ElegantBeef any news of nimscripter ?
07:09:20*neceve joined #nim
07:10:23FromDiscord<ElegantBeef> Nope
07:13:23FromDiscord<Bung> gotcha
07:14:52FromDiscord<haxscramper> Have you looked at compiler API? You can basically write a frontend for your language and reuse all the other compilation parts (like C/Js/C++ backend) while not having to go through intermediate files↵(@theangryepicbanana)
07:15:04FromDiscord<haxscramper> That you call compiler on later
07:17:36FromDiscord<haxscramper> And I think that "nim has pretty much everything I need except vtable types/interfaces ... so I'm going to generate nim code" sounds a lot like macros. I'm pretty sure someone mentioned this already but still
07:22:57*vicfred quit (Quit: Leaving)
07:25:26fn<ForumUpdaterBot99> New post on r/nim by dild0ge: Any tutorials for absolute beginners?, see https://reddit.com/r/nim/comments/ojak73/any_tutorials_for_absolute_beginners/
08:00:44*max22- joined #nim
08:14:20*mahlon quit (Ping timeout: 256 seconds)
08:15:46*Vladar quit (Quit: Leaving)
08:24:07*mahlon joined #nim
09:01:30*pro joined #nim
09:13:31*xet7 quit (Remote host closed the connection)
09:22:41FromDiscord<bolino> Hi! Sorry for the stupid question. I couldn't find in the doc a good example of a function with an optional argument.
09:22:57FromDiscord<bolino> Hi! Sorry for the stupid question. I couldn't find in the doc a good example of a function with an optional argument.
09:25:57FromDiscord<bolino> sent a long message, see http://ix.io/3sPC
09:26:19FromDiscord<ElegantBeef> Well nim strings are not nilable
09:26:42FromDiscord<ElegantBeef> so it's just `size = ""` or `size: string = ""`
09:27:17FromDiscord<ElegantBeef> Do you want an `Option` or an optional argument?
09:27:24FromDiscord<ElegantBeef> They're two different things
09:28:05FromDiscord<bolino> Thanks. I guess I'm a bit confused between the two
09:28:08FromDiscord<haxscramper> sent a code paste, see https://paste.rs/8Jk
09:28:10FromDiscord<haxscramper> If you want to use an option
09:28:44FromDiscord<ElegantBeef> Options are for having values that may or may not be present, a common case is having exceptionless error handling
09:28:51FromDiscord<ElegantBeef> They can be unpacked to get their internal value
09:29:30FromDiscord<ElegantBeef> Optional arguments are so you can just not include that parameter when calling so `proc a(huh = 30) echo huh` can be called `a(300)` or `a()`
09:31:45*max22- quit (Ping timeout: 276 seconds)
09:31:48FromDiscord<ElegantBeef> In the case that the return type is an `Option` you are supposed to do what hax shared where you check if it's some before doing `size.get` to retrieve that value
09:36:23*sidro_ joined #nim
09:36:32*sidro_ left #nim (Konversation terminated!)
09:40:24FromDiscord<bolino> Thanks!
09:40:26FromDiscord<bolino> Will try
09:41:11*xet7 joined #nim
09:51:36FromDiscord<System64 ~ Flandre Scarlet> In reply to @System64 "why do I have": Do you know why I have theses errors please? fg is already declared and used
09:56:20FromDiscord<Rika> probably the indentation level
10:08:18*pro quit (Quit: WeeChat 3.2)
10:10:19*pro joined #nim
10:19:28FromDiscord<bolino> If we want a function to return a string in some case, and nothing in other case, should the return type be `Option[string]`?
10:19:58FromDiscord<Rika> yes
10:20:21FromDiscord<bolino> ...and in that case, to return nothing, it should be `return some(nil)`?
10:21:21FromDiscord<bolino> (I thought it should be either `nil` or `some(string)`)
10:21:26FromDiscord<Rann> hey can ask here faster-than-requests install ?
10:21:27FromDiscord<Rika> none(string)
10:21:54*Vladar joined #nim
10:22:03FromDiscord<bolino> Haaaa `some(string)`. Gotcha. Thanks!!!
10:22:36FromDiscord<Rika> remove the thought of "nil" when you're working with options
10:40:07FromDiscord<Rann> Hey i try install the pack "faster-than-requests" but get ERROR: Could not find a version that satisfies the requirement faster-than-requests↵ERROR: No matching distribution found for faster-than-requests
10:44:21FromDiscord<System64 ~ Flandre Scarlet> I still have one error with fg https://media.discordapp.net/attachments/371759389889003532/864457215993839616/unknown.png
10:46:18FromDiscord<haxscramper> can you show definition of the `onInject`
10:48:03FromDiscord<System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/864458140178055168/unknown.png
10:48:07FromDiscord<System64 ~ Flandre Scarlet> it's a template
10:49:20FromDiscord<haxscramper> ffs, I'm sorry for salt overload, but can you just read the error then? It says "type mismatch for `instantiationInfo`" - so we can safely assume that you have it called somewhere. If we look at the line 27 we can clearly see that you are passing something to `onInject` that gets expanded to `instantiationInfo`
10:49:24FromDiscord<haxscramper> And it you pass something to instantnation info
10:49:49FromDiscord<haxscramper> Or more specifically you pass thing to `onInject` and it directly expands to `instantiationInfo`
10:50:28FromDiscord<haxscramper> And it gives you error for type mismatch, I think we can conclude that whatever you passed to instantiation info was not what it expected
10:50:53FromDiscord<haxscramper> Specifically, it wants `int` for a first argument (which it does say in the error message)
10:51:00FromDiscord<haxscramper> But you've passed `TLN_Tilemap`
10:51:26FromDiscord<haxscramper> Which it also says in the same error message, also showsing you that `fg` that you passed is of type `TLN_Tilemap`
10:51:42FromDiscord<haxscramper> And all of that happened on line 27, which is also provided by the error message
10:51:56FromDiscord<System64 ~ Flandre Scarlet> I thought it was for seeing the content of an object or something like that
10:52:06FromDiscord<haxscramper> Not the most readable form of the message, I can agree to that
10:52:08FromDiscord<haxscramper> But still
10:52:54FromDiscord<haxscramper> So I think you just need to remove `fg` argument from `onInject`
10:54:00FromDiscord<haxscramper> or at least don't pass it to the instantiation info
10:54:14FromDiscord<System64 ~ Flandre Scarlet> and I need to remove the "a" thing to the template?
10:54:49FromDiscord<haxscramper> yes
10:55:05FromDiscord<bolino> I guess I have another question!
10:56:45FromDiscord<bolino> I guess I have another question!↵If we want to pass an optional array arg2 to a function (meaning the function can work with or without the arg2 array), can we do `proc myFuntion(arg1: string, arg2: Option[array], arg3: string ="")` ?
10:57:25FromDiscord<haxscramper> yes, you can also do arg2\: array = \<some meaningful default value\>\`
10:57:49FromDiscord<haxscramper> most of the time you would want to just use some meaninful defaults instead of just `Option`
10:58:06FromDiscord<haxscramper> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/864460504814845953): yes, you can also do `arg2: array = <some meaningful default value>`
10:58:10FromDiscord<bolino> OK. Or an empty array like `arg2: array = array[]`? Then I'm not sure I know how to test if it's empty inside the function.
10:58:47FromDiscord<System64 ~ Flandre Scarlet> Interesting, I had an exception somewhere https://media.discordapp.net/attachments/371759389889003532/864460847546892308/unknown.png
10:58:50FromDiscord<haxscramper> 1. You can accept `seq[T]` and test it using `.len == 0`↵2. You can write a default value and avoid checking for thigns
10:59:06*max22- joined #nim
10:59:34FromDiscord<haxscramper> Can also inject printf call that uses `LINE` from C↵(@System64 ~ Flandre Scarlet)
10:59:43FromDiscord<haxscramper> `instantiationInfo` seems to be working in somewhat unexpected manner
11:00:55FromDiscord<System64 ~ Flandre Scarlet> why printing something with C?
11:01:59FromDiscord<System64 ~ Flandre Scarlet> ah still have random crashes so my try-excepts doesn't protect from them
11:05:41FromDiscord<haxscramper> `proc onInject() {.nodecl, importc: """printf("%d\n", LINE);//""".}`
11:05:58FromDiscord<haxscramper> Also can you just test code incrementally
11:06:43FromDiscord<System64 ~ Flandre Scarlet> it only occurs if I have the Raster Callback AND the Audio Callback enabled
11:13:10FromDiscord<System64 ~ Flandre Scarlet> aaah I understand, it prints the line number
11:19:23FromDiscord<Rann> In reply to @Rann "Hey i try install": someone ? its full track https://dpaste.org/CQnc#L
11:19:55FromDiscord<haxscramper> `> pip install `
11:19:56FromDiscord<bolino> > 1. You can accept seq[T] and test it using .len == 0↵> 2. You can write a default value and avoid checking for thigns↵Yes, but the idea is to be able to pass the second argument, or not. Like `myFunc(arg1, arg2)` or `myFunc(arg1)`
11:20:05FromDiscord<haxscramper> Sorry but this is a nim server, not python
11:20:23FromDiscord<haxscramper> Which both solutions allow↵(@bolino)
11:20:35FromDiscord<haxscramper> `defaulted: seq[int] = @[]`
11:20:50FromDiscord<haxscramper> `if defaulted.len == 0: # we know it was defaulted`
11:20:59FromDiscord<haxscramper> `defaulted: array[3, int] = [1,2,3]`\`
11:21:15FromDiscord<haxscramper> WE DON'T CARE IF IT WAS DEFAULTED SINCE VALUE IS MEANINGFUL ANYWA
11:22:08FromDiscord<haxscramper> and I personally prefer to use latter one (especially over `Option[]`), since users don't have to slap `some` all over the place
11:22:11FromDiscord<bolino> Gotcha!
11:22:48FromDiscord<bolino> Better to use `Option` only for function returns then?
11:22:48FromDiscord<haxscramper> so sensible defaults is the best solutiopn
11:23:11FromDiscord<haxscramper> It depends on use case, but in short - yes, `Optino` is good for return
11:23:21FromDiscord<bolino> Okaye
11:23:38FromDiscord<haxscramper> sent a code paste, see https://paste.rs/ikD
11:23:56FromDiscord<haxscramper> Since default value of the `AbsFile` is `""` which is an invalid state
11:24:09FromDiscord<haxscramper> Therefore I must explicitly say `Optional Absolute File`
11:24:29FromDiscord<haxscramper> But `forceBuild = false` is a perfectly fine default value, and `false` is a valid state for bool
11:24:51FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3sQt
11:25:39FromDiscord<haxscramper> `CliCheck` is `ref` itself, and this is a user-facing function, so I decided to just default to `nil` instead of an `Option`
11:26:06FromDiscord<haxscramper> So users can write `opt(check = cliCheckFor(int))` where `cliCheckFor` just returns `CliCheck` - not option
11:28:37FromDiscord<haxscramper> sent a long message, see http://ix.io/3sQv
11:29:47FromDiscord<haxscramper> 2.1.1\: "argument type does not have valid default state" or default state make things ambiguous. Things like `""` that might be valid by themselves, but don't convey "default value" in the given procedure
11:30:46FromDiscord<haxscramper> 3. You can use other arguments in expressions for default values `proc(input: AbsFile, output: AbsFile = input.withExt("out"))`
11:31:30FromDiscord<konsumlamm> In reply to @theangryepicbanana "nim has pretty much": i mean, if you're just compiling to Nim, you don't need those as Nim language features, assembly doesn't have vtables/interfaces either and C++ compiles to it just fine↵you can look how other languages implement them (for example, interfaces (or more generally, multiple inheritance) can be dine by using composition)
11:31:33FromDiscord<haxscramper> That is - if you want to have a cheat-sheet for this, but again - it all comes down to concrete use case
11:32:04FromDiscord<haxscramper> Does that make any sense? @bolino
11:33:17FromDiscord<bolino> Yes
11:33:25FromDiscord<bolino> Totally
11:34:43FromDiscord<Rika> In reply to @konsumlamm "i mean, if you're": I think they just want an easy solution
11:35:06FromDiscord<haxscramper> Though this does not always work, sometimes you can get "environment lacks \<other argument name\>" and I'm not sure how to fix this
11:35:45FromDiscord<haxscramper> And don't forget function can be called with named arguments, but I'm sure you are aware of that. Like `someProc("positional", defaultedArg = "hello")`
11:58:42*max22- quit (Ping timeout: 272 seconds)
11:59:52*pro quit (Ping timeout: 256 seconds)
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:37*supakeen joined #nim
12:14:30FromDiscord<theangryepicbanana> In reply to @konsumlamm "i mean, if you're": I specifically chose nim because of its type system, since it's the only language with a type system comparable to my own (which makes it easier to bootstrap my language since I can skip some typechecking)
12:20:35FromDiscord<theangryepicbanana> In reply to @haxscramper "Have you looked at": haxscramper: (idk if this will mention you on irc but eh) I kinda need Nim'a frontend though I think. Unless it has typechecking options/functionality, I'll need to keep targeting Nim itself because that's mainly why I'm doing so
12:21:22*xet7 quit (Remote host closed the connection)
12:21:27*Vladar quit (Quit: Leaving)
12:22:18*xet7 joined #nim
12:25:34*arkurious joined #nim
12:27:20FromDiscord<System64 ~ Flandre Scarlet> I noticed something weird↵If the audio callback produce an effect (printing something in the console, generating sound, ...) while the Raster callback is active, crash
12:27:59FromDiscord<System64 ~ Flandre Scarlet> and seems it's only when the audio callback produces an effect↵I tried with a variable assignement only, no crash
12:28:20*mal`` quit (Quit: Leaving)
12:29:27FromDiscord<konsumlamm> In reply to @theangryepicbanana "I specifically chose nim": what about Swift, C# or D?
12:32:30*Vladar joined #nim
12:32:57*mal`` joined #nim
12:35:02*mal`` quit (Excess Flood)
12:36:12FromDiscord<System64 ~ Flandre Scarlet> And I tried Nordaudio but the problem is, I have this error message https://media.discordapp.net/attachments/371759389889003532/864485360096903188/unknown.png
12:39:34arkanoidis it possible to define a polymorphic function type in nim?
12:40:03FromDiscord<System64 ~ Flandre Scarlet> a template I guess
12:40:04arkanoidI mean, how to "type" the function "func id[T](x: T): T = x" ?
12:40:28*mal`` joined #nim
12:42:07arkanoidI can write "type Fid = proc(x: int): int", but I need the generic type. Not sure if it is possible
12:42:45*xet7 quit (Remote host closed the connection)
12:43:55*xet7 joined #nim
12:44:18arkanoidnevermind, it was just "type Fid[T] = proc(x: T): T{.noSideEffect.}"
12:46:15FromDiscord<Bung> there's rfc about using func keyword like this
12:47:17arkanoidBung, was that a quesion?
12:47:35*xet7 quit (Remote host closed the connection)
12:47:54arkanoidthe compiler forces you to explicitly use proc+{.noSideEffect.} instead of func for function types
12:48:12FromDiscord<haxscramper> It can't find portaudio library↵(@System64 ~ Flandre Scarlet)
12:48:17FromDiscord<Bung> yeah, it's current behavior
12:48:34FromDiscord<Bung> might be change in future.
13:00:17FromDiscord<System64 ~ Flandre Scarlet> In reply to @haxscramper "It can't find portaudio": The dll is in the same folder than my code
13:04:48FromDiscord<konsumlamm> In reply to @theangryepicbanana "I specifically chose nim": what about Swift, C# or D?
13:12:32FromDiscord<theangryepicbanana> In reply to @konsumlamm "what about Swift, C#": swift doesn't have HKTs (higher-kinded types), and ref counting is also a bit of an issue. C# doesn't have complex generic constraints or HKTs, and D unfortunately doesn't support multiple inheritance
13:13:05FromDiscord<theangryepicbanana> like I could make D work, but it's probably more trouble than it's eorth
13:13:08FromDiscord<konsumlamm> Nim doesn't have HKTs either, does it?
13:13:11FromDiscord<theangryepicbanana> (edit) "eorth" => "worth"
13:13:15FromDiscord<theangryepicbanana> genericHead
13:13:27FromDiscord<theangryepicbanana> (& friends)
13:13:41FromDiscord<Rika> nim doesnt have multi inheritance either though?
13:14:15FromDiscord<theangryepicbanana> In reply to @Rika "nim doesnt have multi": as long as methods are a thing, I just need some form of interfaces
13:14:33FromDiscord<konsumlamm> uhh, that sounds like a horrible abuse of `genericHead`
13:14:46FromDiscord<theangryepicbanana> well that was gonna happen anyways lol
13:15:21FromDiscord<konsumlamm> In reply to @theangryepicbanana "as long as methods": D has interfaces and UFCS, so...
13:15:53FromDiscord<theangryepicbanana> In reply to @konsumlamm "D has interfaces and": yeah but interfaces can't have method bodies
13:16:03FromDiscord<theangryepicbanana> I also don't think D supports generic methods
13:16:08FromDiscord<konsumlamm> you mean default implementations?
13:16:14FromDiscord<theangryepicbanana> yeah basically
13:16:16FromDiscord<konsumlamm> why wouldn't it support generic methods?
13:16:32FromDiscord<theangryepicbanana> well, generic virtual methods
13:16:43FromDiscord<theangryepicbanana> same deal as c++
13:17:08FromDiscord<Rika> nim doesnt exactly have hkts either though??
13:17:19FromDiscord<theangryepicbanana> In reply to @theangryepicbanana "well, generic virtual methods": in nim they kinda work, which is better than not at all
13:17:20FromDiscord<Rika> as in you cant use a generic param as a type's head i believe
13:17:46FromDiscord<theangryepicbanana> In reply to @Rika "as in you cant": well also whichever other method lets you unpack a generic type
13:18:02FromDiscord<theangryepicbanana> either way, I can use more macros if necessary
13:18:16FromDiscord<Rika> i guess so
13:18:46FromDiscord<konsumlamm> In reply to @theangryepicbanana "genericHead": so how exactly does this work? instead of a HKT, you pass the type applied with some dummy type (e.g. `F[()]` instead of `F`) and then use `genericHead` on that?
13:19:07*rockcavera joined #nim
13:19:07*rockcavera quit (Changing host)
13:19:07*rockcavera joined #nim
13:19:29FromDiscord<theangryepicbanana> In reply to @konsumlamm "so how exactly does": something like that yeah
13:19:53arkanoidI'm doing some basic execises while reading a book about category theory. I need to type a function composition. How to fix the commented line? https://play.nim-lang.org/#ix=3sQU
13:20:04FromDiscord<theangryepicbanana> genericHead and stripGenericParams are basically what I need
13:20:59FromDiscord<konsumlamm> interesting, thanks for your explanations
13:21:18FromDiscord<theangryepicbanana> np
13:21:50FromDiscord<theangryepicbanana> here's a link to the lang if you're curious https://github.com/ALANVF/star
13:22:30FromDiscord<konsumlamm> thx
13:22:36FromDiscord<theangryepicbanana> you can think of the type system as a mix of c++20, scala 3, and nim (which is why it's difficult to typecheck lol)
13:23:15FromDiscord<theangryepicbanana> scala 3 would've worked if scala didn't have type erasure
13:23:37FromDiscord<konsumlamm> In reply to @arkanoid "I'm doing some basic": you want function composition... at the type level? do you know how this would work in something like Haskell (because i have no idea what you're trying to achieve here)
13:25:12FromDiscord<haxscramper> `> mix of c++20, scala 3, and nim (which is why it's difficult to typecheck`Considering your plans I think you need to have a standalone implementation
13:25:21FromDiscord<haxscramper> Instead of trying to mix things on top of nim system
13:25:58FromDiscord<haxscramper> I have a feeling it just be a constant bug hunt due to nim type system not being exactly how you would like it to be
13:26:34arkanoidkonsumlamm, the thing I'm trying to achieve is very easy in haskell (I don't know haskell, but book examples are in haskell). I'm just at page 3 :D. In haskell is the dot operator, it works like the pipe in bash: you have two functions, you pipe them together so the final function takes the input of the first one and returns the output of the second one https://wiki.haskell.org/Function_composition
13:26:50FromDiscord<haxscramper> And nim type system is not really that sophisticated I think - no HKT, single inheritance, no structural/SFINAE typing like in C++ templates
13:27:06FromDiscord<Rika> https://play.nim-lang.org/#ix=3sQX arkanoid
13:27:08FromDiscord<haxscramper> So it is not trivial as well, but
13:27:54FromDiscord<Rika> arkanoid please note that haskell's type system is much different from nim's...
13:28:27FromDiscord<konsumlamm> In reply to @Rika "arkanoid please note that": i just asked for the Haskell version because i'm familiar with it
13:28:43arkanoidRika, thanks a lot. I do know that the type system is different, but I don't want to bend nim into haskell, just want to know how to improve my nim programming by using nim type system
13:28:44FromDiscord<konsumlamm> In reply to @haxscramper "And nim type system": Nim has no SFINAE? since when?
13:28:50FromDiscord<Rika> ok
13:29:22FromDiscord<haxscramper> Since when did it have SFINAE?↵(@konsumlamm)
13:29:48FromDiscord<haxscramper> `[T: not int]` is a generic narrowing IIRC, SFINAE refers to different way of picing overload candidates
13:29:50FromDiscord<konsumlamm> In reply to @arkanoid "<@312654963694108674>, the thing I'm": there's a difference between what you're doing and the thing you linked: you're just creating a type and no implementation for it
13:30:21FromDiscord<System64 ~ Flandre Scarlet> In reply to @System64 "The dll is in": I dunno if I missnamed it or if I should but the dll in another place or if it needs something else
13:30:39FromDiscord<konsumlamm> In reply to @haxscramper "Since when did it": you can substitute arbitrary types for (unconstrained) type parameters and only upon instantiation it is checked if the thing compiles, isn't that what SFINAE is?
13:30:44FromDiscord<haxscramper> SFINAE implies more parts of structural typing for templates, to allow for things like \`std\:\:enable\_if\<std\:\:is\_integral\_type\`\`\`
13:30:53FromDiscord<theangryepicbanana> In reply to @haxscramper "I have a feeling": probably, but even then I prefer nim because its macros are much more powerful than anything I could do in haxe (the lang I'm writing in) because it's a bit of a pain to do anything in haxe. also still has generic virtual methods, which is very rare lol
13:31:05FromDiscord<theangryepicbanana> In reply to @haxscramper "SFINAE implies more parts": that's what concepts are for
13:31:20arkanoidkonsumlamm, sure, my exercise is about category theory so is all about thinking types first. The implementation comes later and may vary
13:31:40FromDiscord<konsumlamm> oh, so you're just trying to write down the type of the composition operator?
13:32:51FromDiscord<Rika> In reply to @theangryepicbanana "that's what concepts are": i dont think you can do what C++ can do just with concepts though?
13:33:48arkanoidkonsumlamm, the type of the composition operator first, and then a generic composition operator later. But yeah, that's the point
13:33:50FromDiscord<konsumlamm> well, typeclasses can do this specific case, but in general Nim's (new-style) concepts are less powerful than C++ concepts i think
13:34:10FromDiscord<theangryepicbanana> In reply to @Rika "i dont think you": I think nim's concepts are actually more powerful than those in c++
13:34:18FromDiscord<theangryepicbanana> wrong reply but eh
13:34:20arkanoidkonsumlamm, consider that I am noob at functional programming, so is all about bending the way think about nim types
13:34:49FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3sQY
13:34:50FromDiscord<Rika> idt this is possible
13:34:59FromDiscord<theangryepicbanana> it should be
13:35:04FromDiscord<Rika> well it isnt
13:35:09FromDiscord<Rika> (probably?)
13:35:10FromDiscord<Rika> therefore
13:35:13FromDiscord<Rika> no sfinae
13:35:25FromDiscord<theangryepicbanana> macro + typed + when should work then
13:35:26FromDiscord<Rika> (probably because ive never actually tested)
13:35:32FromDiscord<Rika> well that's not sfinae then
13:35:44FromDiscord<Rika> that's "manually doing sfinae"
13:35:51FromDiscord<theangryepicbanana> but I still think it's possible the other way
13:36:14FromDiscord<haxscramper> "Substitution Failure Is Not An Error"@konsumlamm)
13:36:14FromDiscord<haxscramper> So
13:36:30FromDiscord<haxscramper> So in short - I'm not sure if what nim does qualifies as SFINAE
13:36:41FromDiscord<haxscramper> concepts do something similar
13:36:51FromDiscord<haxscramper> Old concepts especally, with fields support and all that kind of stuff
13:37:15FromDiscord<haxscramper> But right now you can't put random constexpr in generic arguments
13:37:18FromDiscord<Rika> didnt araq say that new concepts can still express field existence?
13:37:22FromDiscord<haxscramper> To make it check for field existence say
13:37:28*tiorock joined #nim
13:37:28*tiorock quit (Changing host)
13:37:28*tiorock joined #nim
13:37:28*rockcavera is now known as Guest3116
13:37:28*tiorock is now known as rockcavera
13:37:37FromDiscord<haxscramper> I think it was "we will implement this"↵(@Rika)
13:37:46FromDiscord<Rika> so it can, just unimpl
13:37:46FromDiscord<Rika> okay
13:37:58FromDiscord<haxscramper> ye, of course everyone would ask for that
13:38:03FromDiscord<konsumlamm> arkanoid: i think you just want `Composition[A, B] = Function[A, B] -> Fid[A] -> Function[A, B]` (curried) or `Composition[A, B] = (Function[A, B], Fid[A]) -> Function[A, B]` (uncurried)
13:38:05FromDiscord<haxscramper> Maybe it even works RN
13:38:30*Guest3116 quit (Remote host closed the connection)
13:38:43*rockcavera quit (Remote host closed the connection)
13:38:45FromDiscord<Rika> In reply to @konsumlamm "arkanoid: i think you": that doesnt look right to me, there should be three types shouldnt there?
13:39:04FromDiscord<Rika> three generic params i mean
13:39:06*tiorock joined #nim
13:39:13FromDiscord<haxscramper> Also an interesting one https://github.com/nim-lang/Nim/blob/devel/compiler/sigmatch.nim#L1980
13:39:29*tiorock is now known as rockcavera
13:39:30*rockcavera quit (Changing host)
13:39:30*rockcavera joined #nim
13:39:49FromDiscord<konsumlamm> In reply to @Rika "that doesnt look right": if it's the type of the composition function, why would there be 3 parameters?
13:40:14FromDiscord<Rika> im trying to understand
13:40:43FromDiscord<Rika> it should take one `func[a,b] -> func[b,c] -> func[a,c]` no?
13:40:51FromDiscord<Rika> or am i mistaking something again
13:41:38arkanoidRika, don't think so as the two types are function types
13:41:49FromDiscord<theangryepicbanana> In reply to @haxscramper "Also an interesting one": interesting
13:41:56FromDiscord<Rika> ah thats what you mean
13:41:57FromDiscord<Rika> okay
13:42:09arkanoidbtw there's still something wrong then I try to implement a simple composition. Just try to run this: https://play.nim-lang.org/#ix=3sR0
13:42:10FromDiscord<Rika> i still dont get it but ok
13:43:55FromDiscord<konsumlamm> In reply to @Rika "it should take one": oh right, this makes more sense, i thought the second argument was supposed to be `Fid[A]`
13:44:26FromDiscord<Rika> im still confused
13:44:40FromDiscord<Rika> ok wait no yeah i think what i said is correct
13:50:43FromDiscord<System64 ~ Flandre Scarlet> @haxscramper Do you know how can I solve this issue please?
13:52:14FromDiscord<haxscramper> no
13:52:24FromDiscord<haxscramper> install missing libraries somehow
13:54:37*max22- joined #nim
13:55:59FromDiscord<System64 ~ Flandre Scarlet> I dunno how I can install them
13:58:59FromDiscord<System64 ~ Flandre Scarlet> And there is nothing else than PortAudio and SDL2 for low level audio
13:59:33*max22- quit (Ping timeout: 276 seconds)
14:05:37FromDiscord<konsumlamm> In reply to @theangryepicbanana "I also don't think": i wanted to try it out (<https://run.dlang.io/is/IKEqUt>) and got a linker error lol
14:13:19FromDiscord<theangryepicbanana> In reply to @konsumlamm "i wanted to try": yeah I figured lmao
14:18:29FromDiscord<aleclarson> why can't subranges be backwards? https://play.nim-lang.org/#ix=3sRp
14:18:52arkanoidkonsumlamm, I'm trying to follow your curried/uncurried compisition example, but I fear I'm not understanding it. Why Fid[A] comes into play?
14:19:03FromDiscord<Bung> can I get qualified name from typed arg in template ?
14:19:17FromDiscord<aleclarson> (edit) "https://play.nim-lang.org/#ix=3sRp" => "https://play.nim-lang.org/#ix=3sRp↵i can use `countdown` but the range syntax feels better \:P"
14:21:12FromDiscord<haxscramper> because it is not clear what correct semantics is↵(@aleclarson)
14:21:35FromDiscord<haxscramper> For example `for 0 .. someSeq.len - 1` currently iterates zero times
14:22:13FromDiscord<haxscramper> But with countdown it would iterate one time, giving `-1` value
14:22:13FromDiscord<haxscramper> You can overload `...` to make custom iterator for downcount
14:22:17FromDiscord<haxscramper> `getType`?↵(@Bung)
14:22:46FromDiscord<haxscramper> I'm not sure what do you mean by "qualified" thoug
14:22:46FromDiscord<haxscramper> `module.TypeName`?
14:25:34FromDiscord<Bung> eg. you get proc name want also get the module proc belongs
14:26:34FromDiscord<haxscramper> `.owner` is not explicitly exposed in the `std/macros`
14:26:35FromDiscord<konsumlamm> In reply to @arkanoid "<@312654963694108674>, I'm trying to": i misread the task, it should be `Function[B, C] -> Function[A, B] -> Function[A, C]` (curried)
14:26:56*xet7 joined #nim
14:27:18FromDiscord<haxscramper> You can try to `$` the type name and this might give you a module name
14:27:45FromDiscord<haxscramper> But in general macros can't go "up" in the semantic/syntactic tree
14:28:08*happycorsair[m] quit (*.net *.split)
14:28:08*fputs quit (*.net *.split)
14:28:14FromDiscord<haxscramper> You can't get field's owner, encolosing scope, procedure module and so on
14:28:17FromDiscord<haxscramper> And I think that's a good thing
14:31:48FromDiscord<Bung> ah, very clear.
14:32:00*xet7 quit (Remote host closed the connection)
14:32:48FromDiscord<Rika> In reply to @konsumlamm "i misread the task,": wait why is it backwards now
14:32:50FromDiscord<Bung> found another load routes.
14:32:57FromDiscord<Bung> another way
14:35:34arkanoidkonsumlamm, I think I've succeeded in implementing a trivial example https://play.nim-lang.org/#ix=3sRz
14:35:56*fputs joined #nim
14:37:58arkanoidis it possible to declare generic lambda?
14:38:09arkanoidor generic anonymous function
14:39:16FromDiscord<konsumlamm> In reply to @Rika "wait why is it": because composition is backwards in math
14:39:55FromDiscord<konsumlamm> In reply to @arkanoid "is it possible to": not with the lambda (`=>`) syntax sugar
14:40:17FromDiscord<konsumlamm> you can try to do `proc[T](...)`
14:49:48arkanoidkonsumlamm, seems not possible with anonymous functions: https://play.nim-lang.org/#ix=3sRC
14:51:07FromDiscord<konsumlamm> hmm, too bad
14:52:02FromDiscord<konsumlamm> ig variables can't be generic
14:52:23FromDiscord<konsumlamm> maybe it works when you're directly passing it
14:52:43FromDiscord<konsumlamm> but then you'd probably need to define it as a local proc, using normal syntax
14:58:04arkanoidkonsumlamm, no problem, it's just ok to know that
15:13:24FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3sS3
15:13:25FromDiscord<aleclarson> is there a shorthand for max possible `int`?
15:13:41FromDiscord<haxscramper> `high(int)`
15:13:58FromDiscord<aleclarson> thanks
15:17:40FromDiscord<haxscramper> Running the same compiled binary under gdb does not raise any exceptions
15:18:21FromDiscord<haxscramper> Certainly not from `nimBoolToStr`
15:18:21FromDiscord<haxscramper> I forgot to include last part of the message - `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` (after `rawAlloc`)
15:19:09FromDiscord<haxscramper> Switching to `orc` does solve the issue, but I need to use `refc` because I haven't ported other parts to new runtime yet
15:30:01FromDiscord<Ayy Lmao> Does anyone know how to compile a .rc file with Nim? passC doesn't seem to work
15:34:27arkanoidkonsumlamm, I've successful implemented the generic version of the function compose operator, problem is that the type generated by the generic function mismatch the type that should be https://play.nim-lang.org/#ix=3sSe
15:36:06arkanoidI'm also interested in hiding the "B" type value in the `|` compose operator
15:39:08*max22- joined #nim
15:41:03FromDiscord<konsumlamm> hmm, maybe a bug, maybe it's intended, idk
15:41:20FromDiscord<konsumlamm> Nim's type system isn't particularly good for that kinda stuff
15:42:00FromDiscord<konsumlamm> In reply to @arkanoid "I'm also interested in": i don't think that's possible or that it makes any sense
15:44:23FromDiscord<haxscramper> What is an rc file, and have you tried .compile.?↵(@Ayy Lmao)
15:45:29arkanoidkonsumlamm, it's very possible, I feel like pushing nim type system beyond the nim requirements
15:47:10FromDiscord<konsumlamm> you probably are
15:48:02FromDiscord<Ayy Lmao> @haxscramper It is the way to describe window layouts and such in the windows API apparently. It's looking like I have to compile it with a special compiler and link compiled file
15:51:18*xet7 joined #nim
16:04:02FromDiscord<Ayy Lmao> After many many hours of fiddling around I finally got a popup window to open in a Reaper extension. The windows API is a pain
16:05:38FromDiscord<Ayy Lmao> Pretty cool though that it can be done with Nim, considering Reaper expects it to be done in C++. I don't know if any other languages are capable of this kind of feat
16:07:57*stkrdknmibalz joined #nim
16:11:44*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
16:11:55FromDiscord<Rika> only C++? no possibility to do so in C?
16:12:40arkanoidhere's a minimal example of what is puzzling me: https://play.nim-lang.org/#ix=3sSJ
16:13:45FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3sSL
16:15:17FromDiscord<Rika> seems so indeed
16:19:51*stkrdknmibalz joined #nim
16:20:18FromDiscord<Rika> arkanoid need to specify calling convention in pragmas `type Fid[A] = proc(x: A): A {.noSideEffect, nimcall.}`
16:20:48FromDiscord<Rika> (default is closure for proc types i believe?)
16:20:49fn<ForumUpdaterBot99> New thread by Giaco: Function type check of generic function, see https://forum.nim-lang.org/t/8230
16:21:50FromDiscord<Bung> default closure
16:21:51arkanoidRika, sorry I've pasted on the forum before reading your question. Let me check
16:21:52FromDiscord<Rika> arkanoid, are you giaco?
16:21:56FromDiscord<Rika> okay
16:22:03arkanoidit has been a matter of seconds
16:22:13FromDiscord<Rika> bung confirmed that default is closure for proc types
16:22:24FromDiscord<Rika> so yeah thats the cause
16:22:43FromDiscord<Rika> (top level procs are always nimcall unless otherwise specified)
16:22:57FromDiscord<Rika> but they cannot be closure ever i believe
16:23:08FromDiscord<TurtleP> sent a code paste, see https://play.nim-lang.org/#ix=3sSQ
16:23:09arkanoidyeah it works by specifying closure. I have to read what is this call convention thing
16:24:32FromDiscord<Bung> use `;` seperate your args
16:25:53FromDiscord<Rika> bung it should still work even with ,
16:25:54FromDiscord<Rika> comma
16:27:13FromDiscord<Rika> and even with ; it doesnt seem to work
16:28:10FromDiscord<Rika> ah
16:28:12FromDiscord<Rika> i misred
16:28:21FromDiscord<Rika> you're missing a colon at the if statement
16:28:25FromDiscord<Rika> misread
16:28:28FromDiscord<TurtleP> oh ffs
16:28:35FromDiscord<Rika> lmao
16:28:43FromDiscord<TurtleP> .. why is it always the dumb stuff
16:28:46FromDiscord<TurtleP> 😅
16:28:48FromDiscord<Rika> yeah same
16:30:58FromDiscord<Bung> okay
16:33:08FromDiscord<dom96> #CommaGangRepresent
16:40:41FromDiscord<Rika> i didnt notice the colon too, been coding in solely C for a while lately
16:55:16*stkrdknmibalz quit (Remote host closed the connection)
16:57:11arkanoidwhere are pushed and popped pragmas applied? Seems not applied to function type declarations: https://play.nim-lang.org/#ix=3sT2
17:19:29FromDiscord<haxscramper> pushed pragmas are applied only to procedures
17:27:55FromDiscord<haxscramper> only to procedure declarations\
17:36:16arkanoidthanks
17:39:03arkanoidI'm doing some experiments with nimcall and closure call conventions. It seems that it is quite messy to handle mixed calling conventions while playing with some functional programming concepts (default nim behavior) and it won't compile declaring all of them nimcall, but it will declaring all them as closure. What's the cons?
17:40:21arkanoidthis goes agains the manual when it says "As a special extension, a procedure of the calling convention nimcall can be passed to a parameter that expects a proc of the calling convention closure."
17:42:32arkanoidhere is where you find the relevant doc https://nim-lang.org/docs/manual.html#types-procedural-type
17:43:30FromDiscord<Rika> can you give an example of what "goes against the manual"
17:49:29FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3sTy
17:49:46arkanoidI'm trying to reduce it to a minimal example. Do you know how to print the calling convention of a function?
17:49:50arkanoidit would help
17:50:29FromDiscord<haxscramper> Using `[]` explicitly works, but this is not a solution, since it looks extremely ugly - `[](1, 2 .. 3)`
17:57:12FromDiscord<gerwy> anyone here uses nim?
17:57:20FromDiscord<SolitudeSF> no
17:58:04arkanoidwhat is nim?
18:20:23arkanoidI'm going crazy writing a proc that converts a nimcall proc a a closure proc type
18:22:56*max22- quit (Ping timeout: 256 seconds)
18:47:21FromDiscord<ynfle (ynfle)> Why? What are you trying to do?
18:49:27arkanoidynfle, I'm trying to to write test cases where I check if a generic nimcall proc is of type declared into type block as generic proc type
18:50:42arkanoidmeanwhile, I've found this: https://github.com/nim-lang/Nim/blob/version-1-4/lib/system.nim#L1515 , why this?
18:52:00FromDiscord<ynfle (ynfle)> My guess for compiler magic
18:52:24FromDiscord<ynfle (ynfle)> I'm not quite sure what you mean. You want to know if a proc is generic?
19:00:16arkanoidynfle, no, let me show you my current experiment, but before that I need to understand why here I'm getting none: https://play.nim-lang.org/#ix=3sTZ
19:01:16arkanoid"compose" and "|" are exactly the same generic total funtion, but the "type" function works only for one of them
19:02:28*max22- joined #nim
19:03:48arkanoidis this a bug?
19:11:04FromDiscord<Rika> A `|` exists in system
19:11:17FromDiscord<Rika> So basically nim cannot tell which you refer to
19:11:33arkanoidRika, yes, here, and it is discarded https://github.com/nim-lang/Nim/blob/version-1-4/lib/system.nim#L1515
19:11:54arkanoidI'm overriding it, and the test confirms that it works correctly
19:12:12FromDiscord<Rika> You're not, you're overloading it
19:12:33FromDiscord<Rika> There is a fine distinction
19:12:55arkanoidwait, you're right, on the last line I'm not submitting parameters
19:13:01FromDiscord<Rika> Exactly
19:13:21arkanoidhow to point nim in the right direction without providing parameters?
19:13:48arkanoidthe `|` is declared in the root of the module, why is it picking the discarded one?
19:14:05FromDiscord<Rika> It's not picking the discarded one and it's not actually discarded?
19:14:15FromDiscord<Rika> It's an empty bodied proc not a discarded proc
19:14:46arkanoidit is not? :| what's the point
19:14:47FromDiscord<Rika> And why would nim give priority to a certain proc? That sounds like subtle bug to me
19:15:17FromDiscord<Rika> I don't know, it's probably there for some reason
19:15:30arkanoidsurely it is not picking the most obvious one
19:15:33FromDiscord<Rika> Used in template constraint as an or operator perhaps
19:15:44FromDiscord<Rika> It is no more obvious than the other proc
19:16:27arkanoidwell, how can I point to the one declared in module in that echo line?
19:18:15FromDiscord<Rika> I do not think there is a way currently
19:18:25FromDiscord<Rika> I feel like araq discussed a solution before
19:21:36arkanoidinteresting, but quite hard to track. Do you have any pointer?
19:22:46arkanoidin the meanwhile, I will just obviously change symbol (even if pipe was perfect for the job)
19:30:25*Helios quit (Read error: Connection reset by peer)
19:30:26*nixfreak_nim[m] quit (Read error: Connection reset by peer)
19:45:10arkanoidynfle, here the code: https://play.nim-lang.org/#ix=3sUb , point is understanding how nim behaves when checking type of generic procs. As you can see you can map the type without the generic, but not with the generic params unless the call convention matches
20:00:18*neceve quit (Ping timeout: 276 seconds)
20:10:23FromDiscord<theangryepicbanana> has the syntax highlighting for nim in vscode always been this bad?
20:10:33FromDiscord<theangryepicbanana> I feel like it used to be a lot better
20:12:55FromDiscord<theangryepicbanana> like I was able to do this in about 5 minutes tf https://media.discordapp.net/attachments/371759389889003532/864600298794385418/unknown.png
20:19:14FromDiscord<reilly> In reply to @theangryepicbanana "like I was able": Is this the OG one or the saem one?
20:19:53FromDiscord<theangryepicbanana> In reply to @reilly "Is this the OG": it's the main one (with 44k downloads), but I edited the syntax highlighting file very briefly because it was terrible
20:20:28FromDiscord<theangryepicbanana> is there really no good highlighting for any of the nim extensions?
20:20:34FromDiscord<theangryepicbanana> 🤔
20:22:15FromDiscord<reilly> Is saem's version not any better in that regard? That's the version I use, but I haven't bothered to compare the two, so I'm legitimately curious if it's any better.
20:22:25FromDiscord<theangryepicbanana> it's just as bad
20:23:20*def- quit (Quit: -)
20:23:26FromDiscord<reilly> Nim's tooling could really use some improvements, it seems. Not just syntax highlighting, either.
20:23:34FromDiscord<theangryepicbanana> yeah
20:23:41FromDiscord<theangryepicbanana> seems like a have another project ig
20:23:44*def- joined #nim
20:24:08FromDiscord<theangryepicbanana> (re: highlighting)
20:25:32FromDiscord<theangryepicbanana> one thing I'd look at is Haxe, which is a language with macro functionality similar to nim (minus templates). one thing that it does is integrate the LSP (autocompletion stuff) directly into the compiler/language so that it's easy to keep track of
20:25:50FromDiscord<theangryepicbanana> (edit) "one thing I'd look at ... is" added "for the tooling stuff"
20:26:13FromDiscord<theangryepicbanana> outside of LSP, it generally integrates that stuff into the compiler
20:26:19FromDiscord<theangryepicbanana> (edit) "outside of LSP, it generally integrates that ... stuff" added "kinda"
20:26:51FromDiscord<theangryepicbanana> (edit) "that kinda stuff" => "other tooling"
20:27:16FromDiscord<theangryepicbanana> anyways very pog
20:29:45FromDiscord<theangryepicbanana> oh yeah for reference on the thing earlier, I make syntax highlighting stuff as a hobby lol
20:42:16*rockcavera quit (Remote host closed the connection)
20:53:00*nixfreak_nim[m] joined #nim
20:54:09FromDiscord<jfmonty2> Any idea why storing threads and their args in an array works fine, but storing them in a seq causes my program to crash?
20:54:09*Helios joined #nim
20:54:10*happycorsair[m] joined #nim
20:55:20FromDiscord<jfmonty2> I know arrays are stack-allocated and seqs are heap-allocated, so maybe the thread has a pointer or something and then the seq gets moved?
20:55:51FromDiscord<ElegantBeef> If you're growing the seq a lot that could be it
20:56:02FromDiscord<ElegantBeef> Hard to say without seeing the code
20:56:48FromDiscord<jfmonty2> So what's the standard method for supporting a non-fixed number of threads? I can't just not store the thread anywhere because that causes it to crash too
20:57:14FromDiscord<konsumlamm> it should probably be reported as a bug, either way
20:57:38FromDiscord<ElegantBeef> I mean i use a seq for threads
20:57:54FromDiscord<ElegantBeef> I've done it multiple times
20:58:02FromDiscord<jfmonty2> I'm only putting 16 items into it, is that too many?
20:58:07FromDiscord<jfmonty2> one per logical cpu
20:58:11FromDiscord<ElegantBeef> It depends what you're doing
20:58:23FromDiscord<ElegantBeef> The thread sequence doesnt really matter since nothing should point at it
20:58:50FromDiscord<jfmonty2> that's what I was assuming
21:00:15FromDiscord<ElegantBeef> Do me a favour and try `--gc:orc` 😄
21:00:45FromDiscord<ElegantBeef> I forgot i recently had refc crash my program with my threading but orc didnt
21:00:55FromDiscord<ElegantBeef> So super odd behaviour that probably needs an issue made 😄
21:01:11FromDiscord<jfmonty2> hmm, well it gives me an IndexDefect now, where before it wasn't saying anything at all
21:01:14FromDiscord<jfmonty2> so... progress!
21:01:25FromDiscord<ElegantBeef> was it just a segmentation dump?
21:01:44FromDiscord<ElegantBeef> well segementation fault 😄
21:03:22FromDiscord<jfmonty2> not sure, I can' quite figure out where this index defect is coming from because I'm not doing any indexing that I can see
21:03:27FromDiscord<jfmonty2> (edit) "can'" => "can't"
21:05:19FromDiscord<konsumlamm> we can't help you if we don't know your code
21:06:05FromDiscord<reilly> Put it on play.nim-lang.org, maybe? :)
21:06:17FromDiscord<jfmonty2> I can post a snippet but it won't run without the whole program, is that a problem?
21:06:25FromDiscord<jfmonty2> I guess I could mock the stuff that's actually doing the work
21:07:37FromDiscord<jfmonty2> does play.nim-lang do threading?
21:08:19FromDiscord<reilly> I can't speak for everyone, but I probably wouldn't run it on the site itself. I'd copy it to a file and run it on my own machine.
21:08:33FromDiscord<reilly> (After checking the code is safe-looking, of course ;) )
21:08:54FromDiscord<reilly> (edit) "(After checking ... thelooks" added "that" | "is safe-looking," => "looks safe,"
21:09:26FromDiscord<reilly> Especially for something complicated like threading, since I don't know what's going on behind the scenes on that site.
21:10:04FromDiscord<ElegantBeef> Well the site doesnt have the thread flag enabled so you couldnt run it there
21:10:41FromDiscord<jfmonty2> I do have it in a public repo, would that work? https://git.jfmonty2.com/jfmonty2/camelcup
21:11:06FromDiscord<reilly> In regards to what code to give us, ideally it'll be the minimum amount of code required to reproduce the problem. Trying to figure out what code you don't need to include may also help you track down the bug yourself.
21:11:16FromDiscord<ElegantBeef> Yea public repos are fantastic for helping
21:11:18FromDiscord<jfmonty2> er, needs the branch: https://git.jfmonty2.com/jfmonty2/camelcup/src/branch/threads
21:11:32FromDiscord<reilly> The whole repo gets the job done too, of course.
21:11:43FromDiscord<jfmonty2> I'll see if I can make a toy version work as well
21:12:28FromDiscord<jfmonty2> specifically it's `test.nim` that I've been trying to compile and run
21:12:43FromDiscord<jfmonty2> which imports most of the other stuff
21:16:53FromDiscord<jfmonty2> the threading all happens in `randomGames` in `simulation.nim` though, should have mentioned that as well
21:18:01*neceve joined #nim
21:20:34*rockcavera joined #nim
21:20:34*rockcavera quit (Changing host)
21:20:34*rockcavera joined #nim
21:22:04FromDiscord<jfmonty2> ok, toy example appears to be exhibiting the same behavior: https://play.nim-lang.org/#ix=3sUy
21:26:32*max22- quit (Quit: Leaving)
21:31:47FromDiscord<jfmonty2> Apparently storing the threads/args in arrays vs. seqs had nothing to do with it? I am now getting the same crash regardless of how I store them
21:33:01FromDiscord<ElegantBeef> Well one issue is the way you're doing this
21:33:16FromDiscord<ElegantBeef> Why are you adding threads?
21:34:10FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3sUE is a better way of doing it
21:34:13FromDiscord<jfmonty2> to speed up execution, since the problem is embarrassingly parallel
21:34:31FromDiscord<ElegantBeef> No i mean why are you adding threads to a seq instead of just making the seq the size you want 😄
21:34:40FromDiscord<jfmonty2> oh 😛
21:34:44FromDiscord<jfmonty2> becuase I'm used to Python I guess
21:35:22FromDiscord<ElegantBeef> Thread is a value type so it doesnt work the way you want and on devel actually has a compile time error due to the `=copy` being set to error
21:36:21FromDiscord<jfmonty2> ah ok, interesting
21:37:11FromDiscord<ElegantBeef> Though this doesnt work properly as it returns 48 😄
21:37:24FromDiscord<ElegantBeef> Ah nvm
21:37:39FromDiscord<jfmonty2> that sounds right, 16 3?
21:37:40FromDiscord<ElegantBeef> Thought each thread ran independently didnt read
21:37:51FromDiscord<jfmonty2> nope sums em all up 😛
21:37:56FromDiscord<ElegantBeef> Then yea
21:37:58FromDiscord<jfmonty2> I just did that because it more closely mimics what I'm really trying to do
21:41:07FromDiscord<jfmonty2> Interestingly if I get rid of the seq entirely (just create a new `Thread` every iteration) it crashes again
21:41:22FromDiscord<jfmonty2> Is that because the thread goes out of scope and is therefore dropped at the end of the iteration?
21:43:49FromDiscord<ElegantBeef> Seems so, since with orc it works sometimes but othertimes it crashes
21:45:01FromDiscord<ElegantBeef> I've not overly used threads much so am just suggesting have a single collection of threads be it an array or seq create threads into it
21:45:41FromDiscord<jfmonty2> Yeah, that seems to work best.
21:45:53FromDiscord<jfmonty2> I feel like the old saying about regular expressions applies even more so to concurrency
21:46:10FromDiscord<raid sponsored by kadybat + dei> sent a long message, see http://ix.io/3sUG
21:46:14FromDiscord<aryn> very cool
21:46:15FromDiscord<raid sponsored by kadybat + dei> sent a long message, see https://paste.rs/v59
21:46:18FromDiscord<barton222> sad
21:46:19FromDiscord<raid sponsored by kadybat + dei> sent a long message, see http://ix.io/3sUG
21:46:19FromDiscord<bloatoo> CHAD
21:46:21FromDiscord<raid sponsored by kadybat + dei> sent a long message, see https://paste.rs/d6q
21:46:24FromDiscord<raid sponsored by kadybat + dei> @Chilla Chris@Chris3606@chrisw@Churros@citycide@cji@ClawS@Clops@Cloudperry@codescapade@codestorm@Condescending Giraffe@congusbongus@CookiShoos@cp@creatable@crispin@dabmlfz@dan@Daniel@Daniele@DanielVF@daredevelops@darkazer@Dat Boi@Dav1s@Davin@deech@DeltaPHC@deme@demotomohiro@Deorder (aka Komerdoor)@Dinho@djanatyn@djazz@dmoody256@Dobermann@Doctor Darkmantle@dom96@dorei@Dragon@drewp@DRS@Yardanico@ElegantBeef@aust9n@dr
21:46:25FromDiscord<raid sponsored by kadybat + dei> @Chilla Chris@Chris3606@chrisw@Churros@citycide@cji@ClawS@Clops@Cloudperry@codescapade@codestorm@Condescending Giraffe@congusbongus@CookiShoos@cp@creatable@crispin@dabmlfz@dan@Daniel@Daniele@DanielVF@daredevelops@darkazer@Dat Boi@Dav1s@Davin@deech@DeltaPHC@deme@demotomohiro@Deorder (aka Komerdoor)@Dinho@djanatyn@djazz@dmoody256@Dobermann@Doctor Darkmantle@dom96@dorei@Dragon@drewp@DRS@Yardanico@ElegantBeef@aust9n@dr
21:46:25FromDiscord<raid sponsored by kadybat + dei> sent a long message, see http://ix.io/3sUH
21:46:27FromDiscord<raid sponsored by kadybat + dei> @Chilla Chris@Chris3606@chrisw@Churros@citycide@cji@ClawS@Clops@Cloudperry@codescapade@codestorm@Condescending Giraffe@congusbongus@CookiShoos@cp@creatable@crispin@dabmlfz@dan@Daniel@Daniele@DanielVF@daredevelops@darkazer@Dat Boi@Dav1s@Davin@deech@DeltaPHC@deme@demotomohiro@Deorder (aka Komerdoor)@Dinho@djanatyn@djazz@dmoody256@Dobermann@Doctor Darkmantle@dom96@dorei@Dragon@drewp@DRS@Yardanico@ElegantBeef@aust9n@dr
21:46:27FromDiscord<raid sponsored by kadybat + dei> sent a long message, see https://paste.rs/AUP
21:46:28FromDiscord<raid sponsored by kadybat + dei> @Chilla Chris@Chris3606@chrisw@Churros@citycide@cji@ClawS@Clops@Cloudperry@codescapade@codestorm@Condescending Giraffe@congusbongus@CookiShoos@cp@creatable@crispin@dabmlfz@dan@Daniel@Daniele@DanielVF@daredevelops@darkazer@Dat Boi@Dav1s@Davin@deech@DeltaPHC@deme@demotomohiro@Deorder (aka Komerdoor)@Dinho@djanatyn@djazz@dmoody256@Dobermann@Doctor Darkmantle@dom96@dorei@Dragon@drewp@DRS@Yardanico@ElegantBeef@aust9n@dr
21:46:29FromDiscord<brainproxy> on noes, a spamtard
21:46:29FromDiscord<raid sponsored by kadybat + dei> @Chilla Chris@Chris3606<@!263737557685239808>@Churros@citycide@cji@ClawS@Clops@Cloudperry@codescapade@codestorm@Condescending Giraffe@congusbongus@CookiShoos@cp@creatable@crispin@dabmlfz@dan@Daniel@Daniele@DanielVF@daredevelops@darkazer@Dat Boi@Dav1s@Davin@deech@DeltaPHC@deme@demotomohiro@Deorder (aka Komerdoor)@Dinho@djanatyn@djazz@dmoody256@Dobermann@Doctor Darkmantle@dom96@dorei@Dragon@drewp@DRS@Yardanico@Elegan
21:46:33FromDiscord<Ahri Fox> NIM is based, dont spam here
21:46:38FromDiscord<creatable> kinda a bad raid ngl
21:46:39FromDiscord<raid sponsored by kadybat + dei> no nim sucks lol
21:46:42FromDiscord<bloatoo> lmao
21:46:43FromDiscord<barton222> lmao
21:46:48FromDiscord<! ! Reiter> lol
21:46:49FromDiscord<bloatoo> what a hustler
21:46:51FromDiscord<alehander42> /ban me
21:46:57FromDiscord<alehander42> hm howdo people
21:47:01FromDiscord<Canelhas> is this friendly or another crypto scam of some sorts?
21:47:02FromDiscord<alehander42> find the username so fast
21:47:07FromDiscord<aryn> tfw nim server has better raid prot than a 50k youtuber server lmfao
21:47:21FromDiscord<bloatoo> Didn't nim already get cancelled by vlang?
21:47:21FromDiscord<ElegantBeef> Well hey that raid might increase activity
21:47:29FromDiscord<ElegantBeef> In what way
21:48:34FromDiscord<theangryepicbanana> raid?
21:48:35FromDiscord<theangryepicbanana> pog
21:48:53FromDiscord<ache of head> Damn 6 pings
21:48:57FromDiscord<ache of head> Someone finally loved me
21:49:21FromDiscord<aryn> nope
21:49:22FromDiscord<aryn> raid
21:49:24FromDiscord<aryn> :KEKW:
21:49:28FromDiscord<ache of head> 😔
21:49:46FromDiscord<tandy> lmao↵(<@864610352858660926>)
21:51:13FromDiscord<Ahri Fox> i mean, id at least want a more detailed critique of it rather than JUST some app notifications on discord... doesn't convince me yknow
21:51:50FromDiscord<ElegantBeef> Was that a raid for vlang? 😛
21:52:18FromDiscord<theangryepicbanana> lmao
21:52:40FromDiscord<ElegantBeef> If so much like the language it was a piss poor attempt at it's goal
21:55:03FromDiscord<konsumlamm> rekt xd
22:13:39*systemds1cks is now known as systemdsucks
22:34:10*neceve quit (Ping timeout: 246 seconds)
22:35:20*Vladar quit (Quit: Leaving)
22:36:40FromDiscord<TurtleP> sent a code paste, see https://play.nim-lang.org/#ix=3sUV
23:23:34FromDiscord<ElegantBeef> Looks like an echo of a ref object
23:23:58FromDiscord<ElegantBeef> Well echo of a object that contains two ref objects
23:28:31FromDiscord<TurtleP> but none of my echo calls even do that
23:28:43FromDiscord<ElegantBeef> Are you using a library that emits a vTable?
23:28:56FromDiscord<TurtleP> maybe iface?
23:29:02FromDiscord<TurtleP> but I'm not echoing an object anywhere
23:30:26FromDiscord<ElegantBeef> then iface might be the reason it's happening
23:44:01*Guest32 joined #nim
23:44:43Guest32How do you echo an OOP object? Like the kind that's a ref object of RootObj?
23:45:07Guest32When I try, I get an error saying that there's no `$`
23:45:13Guest32proc
23:48:37FromDiscord<ElegantBeef> you can do `echo refObject[]` which will echo the internal structure
23:48:51FromDiscord<ElegantBeef> But it's more suggested to define your own `$` operator
23:49:59Guest32@ElegantBeef That worked, thank you! Yeah, I figured it would be better when the code is more solid, but for now I'm messing around trying to understand OOP objects in nim.
23:50:37Guest32Thanks again
23:50:41*Guest32 quit (Quit: Client closed)
23:50:53FromDiscord<ElegantBeef> Yea all that does is dereference the ref object so you get the object, if you made the string operator using that in an object that is cyclical bad things would happen 😛