<< 04-03-2022 >>

00:01:44FromDiscord<pmunch> Then simply put the JSON in there and it should work..
00:02:38FromDiscord<System64 ~ Flandre Scarlet> Play I have the JSON
00:02:50*jmdaemon joined #nim
00:02:51FromDiscord<Evrensel Kişilik> oh damn
00:02:58FromDiscord<Evrensel Kişilik> still couldn't solve 😭
00:03:08FromDiscord<Evrensel Kişilik> where are deeeevss???
00:03:32FromDiscord<Evrensel Kişilik> im just your debugger hero im not familiar with Nim 😱
00:03:52FromDiscord<Elegantbeef> What?
00:04:05FromDiscord<Evrensel Kişilik> In reply to @Elegantbeef "What?": beeeeef help this person
00:04:06FromDiscord<Evrensel Kişilik> pls
00:04:19FromDiscord<Evrensel Kişilik> be a delicious beef
00:04:22FromDiscord<Elegantbeef> The author of the tool they're using is helping
00:04:29FromDiscord<Elegantbeef> Why would i attempt to help
00:05:11FromDiscord<Evrensel Kişilik> i knew you are not a kobe beef
00:05:32FromDiscord<pmunch> Because this author is going to sleep now \:P
00:05:46FromDiscord<Evrensel Kişilik> who is that
00:05:47FromDiscord<System64 ~ Flandre Scarlet> Progress https://media.discordapp.net/attachments/371759389889003532/949095275203543080/unknown.png
00:05:58FromDiscord<Elegantbeef> Damn it pmunch, tagging me in now
00:07:00FromDiscord<pmunch> Hooray! Now you should just have to figure out how to link the DLL. That is the missing symbol error
00:07:12FromDiscord<pmunch> Good night
00:07:25FromDiscord<System64 ~ Flandre Scarlet> In reply to @pmunch "Hooray! Now you should": Undefined reference to something : My WORST ENNEMY in programming
00:07:43FromDiscord<Evrensel Kişilik> In reply to @System64 "Progress": isn't there a Nim thing like a header after creating binding?
00:07:49FromDiscord<Evrensel Kişilik> you are using C header
00:08:03FromDiscord<System64 ~ Flandre Scarlet> and I did it!
00:08:19FromDiscord<System64 ~ Flandre Scarlet> let's create a window now
00:08:24FromDiscord<demotomohiro> Did you link all libraries your C library depends?
00:08:30FromDiscord<Evrensel Kişilik> In reply to @System64 "and I did it!": congratulations
00:08:32FromDiscord<System64 ~ Flandre Scarlet> yeah
00:08:35FromDiscord<System64 ~ Flandre Scarlet> thanks!
00:11:30FromDiscord<demotomohiro> In reply to @Evrensel Kişilik "you are using C": I think nim files that contains type, const definitions and procedure declaresions with `importc` pragma is similar to C's header file.
00:12:00FromDiscord<System64 ~ Flandre Scarlet> OMFG! https://media.discordapp.net/attachments/371759389889003532/949096841822216192/unknown.png
00:12:03FromDiscord<System64 ~ Flandre Scarlet> IT WORKS!
00:12:12FromDiscord<Evrensel Kişilik> 😱
00:12:14FromDiscord<Evrensel Kişilik> all i can say
00:12:16FromDiscord<demotomohiro> Congrats!
00:12:17FromDiscord<Evrensel Kişilik> MEOW
00:12:27FromDiscord<System64 ~ Flandre Scarlet> Thanks!
00:13:46FromDiscord<Evrensel Kişilik> i want to write a driver for my mouse
00:13:57FromDiscord<Evrensel Kişilik> because Logitech's software is actually a garbage
00:14:31FromDiscord<System64 ~ Flandre Scarlet> But OOF it says errors https://media.discordapp.net/attachments/371759389889003532/949097471546634320/unknown.png
00:14:43FromDiscord<Evrensel Kişilik> In reply to @System64 "But OOF it says": 😭
00:14:49FromDiscord<Elegantbeef> Make sure you have your editor setup properly
00:14:58FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Make sure you have": yeah
00:15:01FromDiscord<System64 ~ Flandre Scarlet> It is
00:15:04FromDiscord<Evrensel Kişilik> you could finish the game in Godot in this time
00:15:10FromDiscord<Elegantbeef> You set a project file?
00:15:26FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You set a project": wdym?
00:15:47FromDiscord<Evrensel Kişilik> what is the error?
00:16:02FromDiscord<Elegantbeef> inside your workspace settins you should have `nim.project: ["testTileEngine.nim"]`
00:16:06FromDiscord<System64 ~ Flandre Scarlet> false positive
00:16:14FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "inside your workspace settins": Ah, I don't :/
00:16:58FromDiscord<Elegantbeef> That should fix it, assuming you're using saem's extension
00:17:00FromDiscord<Evrensel Kişilik> OMG
00:17:01FromDiscord<Evrensel Kişilik> https://store.azeron.eu/
00:17:04FromDiscord<Evrensel Kişilik> what is this?
00:17:47FromDiscord<Elegantbeef> 3D printed concept hardware
00:18:04FromDiscord<Evrensel Kişilik> In reply to @Elegantbeef "3D printed concept hardware": it says it is a keyboard
00:18:06FromDiscord<Evrensel Kişilik> 😱
00:18:16FromDiscord<Elegantbeef> keypad\
00:18:19FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "That should fix it,": How can I do this?
00:19:05FromDiscord<Elegantbeef> `ctrl + shift + p` workspace settings, add it
00:20:18FromDiscord<Evrensel Kişilik> umm i think he means adding `"nim.project": ["testTileEngine.nim"]` to `.code-workspace` file in your project directory
00:20:50FromDiscord<Elegantbeef> Yes, like i explained how to do it
00:35:40FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Rik
00:36:27FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3Rik" => "https://play.nim-lang.org/#ix=3Ril"
00:37:00FromDiscord<Patitotective> Or should I have two `foo` procs, one for `varargs[string]` and the other for `openArray[string]`? 😕
00:37:28FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Yes, like i explained": Well I don't really understand
00:39:03FromDiscord<demotomohiro> What happens when you pass `seq[string]` to `varargs[string]`?
00:39:57*ltriant quit (Ping timeout: 256 seconds)
00:40:20FromDiscord<Patitotective> In reply to @demotomohiro "What happens when you": :o
00:40:51FromDiscord<Evrensel Kişilik> In reply to @System64 "Well I don't really": did you do Ctrl + Shift + P and Save Workspace As?
00:40:53FromDiscord<huantian> In reply to @Evrensel Kişilik "umm i think he": I always liked `.vscode/settings.json`
00:41:19FromDiscord<Evrensel Kişilik> In reply to @huantian "I always liked `.vscode/settings.json`": oh it affects only that directory
00:41:21FromDiscord<System64 ~ Flandre Scarlet> In reply to @Evrensel Kişilik "did you do Ctrl": done
00:41:31FromDiscord<Evrensel Kişilik> but workspaces can include more than one directory
00:41:37FromDiscord<demotomohiro> In reply to @Patitotective "How do I convert": Nim manual says:↵A varargs parameter is an openarray parameter that additionally allows to pass a variable number of arguments to a procedure. The compiler converts the list of arguments to an array implicitly:↵https://nim-lang.org/docs/manual.html#types-varargs
00:42:13FromDiscord<Evrensel Kişilik> In reply to @System64 "done": ok then open `[workspace_name].code-workspace` file
00:42:19FromDiscord<Patitotective> In reply to @demotomohiro "Nim manual says: A": hehe i was doing something wrong thanks 🙃
00:42:34FromDiscord<System64 ~ Flandre Scarlet> In reply to @Evrensel Kişilik "ok then open `[workspace_name].code-workspace`": done
00:42:39FromDiscord<cvv.tracy> How to start a procedure in a new thread?
00:43:05FromDiscord<Evrensel Kişilik> In reply to @System64 "done": ok now add `"nim.project": ["testTileEngine.nim"]` to `"settings"` key
00:43:18FromDiscord<Evrensel Kişilik> https://media.discordapp.net/attachments/371759389889003532/949104714333696051/unknown.png
00:43:19FromDiscord<Evrensel Kişilik> like this
00:43:35FromDiscord<System64 ~ Flandre Scarlet> done
00:43:45FromDiscord<Evrensel Kişilik> In reply to @System64 "done": sooo ok better restart it
00:43:45FromDiscord<Evrensel Kişilik> lol
00:45:07FromDiscord<System64 ~ Flandre Scarlet> well no error it seems, but no suggestions
00:46:09FromDiscord<Evrensel Kişilik> what should be done?
00:47:12FromDiscord<System64 ~ Flandre Scarlet> Loading :/ https://media.discordapp.net/attachments/371759389889003532/949105697105256508/unknown.png
00:50:10FromDiscord<Evrensel Kişilik> In reply to @System64 "Loading :/": oh what theme is that?
00:50:33FromDiscord<System64 ~ Flandre Scarlet> In reply to @Evrensel Kişilik "oh what theme is": Dracula + Remilia Scarlet as background
00:50:48FromDiscord<System64 ~ Flandre Scarlet> This is the background I use https://media.discordapp.net/attachments/371759389889003532/949106603305611325/48212642_p0.png
00:51:18FromDiscord<System64 ~ Flandre Scarlet> yeah I know it is badass
00:51:28FromDiscord<cvv.tracy> how do i multithread broaaaa
00:51:39FromDiscord<huantian> broaaaaaa?
00:51:45FromDiscord<cvv.tracy> didnt mean to put a
00:51:48FromDiscord<cvv.tracy> just meant bro
00:52:14FromDiscord<Elegantbeef> Depends what you're doing, there are taskpools, weave, then the stdlib threads
00:52:29FromDiscord<demotomohiro> In reply to @cvv.tracy "how do i multithread": https://nim-lang.org/docs/threads.html
00:52:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Rim
00:52:53FromDiscord<cvv.tracy> oh alr
00:52:55FromDiscord<cvv.tracy> thanks
00:53:25FromDiscord<Evrensel Kişilik> In reply to @System64 "Dracula + Remilia Scarlet": this is my VSCode https://media.discordapp.net/attachments/371759389889003532/949107260372697099/unknown.png
00:53:32FromDiscord<Evrensel Kişilik> what are you using for changing background?
00:53:36FromDiscord<cvv.tracy> sent a code paste, see https://play.nim-lang.org/#ix=3Rin
00:53:42FromDiscord<System64 ~ Flandre Scarlet> In reply to @Evrensel Kişilik "what are you using": Backgrounds, and you?
00:53:59FromDiscord<Evrensel Kişilik> In reply to @System64 "Backgrounds, and you?": backgrounds? 😱 im just using Doki Theme for VSCode
00:54:02FromDiscord<demotomohiro> In reply to @cvv.tracy "oh alr": As @Elegantbeef said, higher level multithreading library might better.
00:54:11FromDiscord<huantian> why do yall change your vscode background lmao↵is it not distracting
00:54:24FromDiscord<Elegantbeef> use a tuple for parameters and then you do `Thread[(Arg1, Arg2, aRg3)]` and do `createThread(thread, (10, 20, 30))` for instance
00:54:34FromDiscord<System64 ~ Flandre Scarlet> In reply to @Evrensel Kişilik "backgrounds? 😱 im just": https://marketplace.visualstudio.com/items?itemName=shalldie.background
00:54:52FromDiscord<Evrensel Kişilik> In reply to @System64 "https://marketplace.visualstudio.com/items?itemName": oh damn
00:54:54FromDiscord<Evrensel Kişilik> looooks good
00:55:52FromDiscord<System64 ~ Flandre Scarlet> yeah!
00:57:08FromDiscord<Evrensel Kişilik> did you upgrade to new version of VSCode?
00:57:30FromDiscord<Evrensel Kişilik> https://media.discordapp.net/attachments/371759389889003532/949108286534332506/unknown.png
01:01:53FromDiscord<System64 ~ Flandre Scarlet> I think it's updated automatically
01:19:09FromDiscord<mattrb> Is there a way to define a proc that accepts and calls operators like `+`, `/`, etc, or is that something I need a template for?
01:19:41FromDiscord<mattrb> I'm currently just using `template binaryOp(operator: untyped): untyped`, but I'm wondering if there's a way to do it without templates
01:19:59FromDiscord<mattrb> I can't seem to get the compiler to be happy about calling `+` a proc :p
01:20:27FromDiscord<mattrb> I found a post on the forum that seems vaguely related that implies it's not possible, but I figure it doesn't hurt to confirm here
01:22:11FromDiscord<Elegantbeef> think it's still right, though i'd do `template binaryOp(operator: proc)`
01:22:27*vicfred quit (Quit: Leaving)
01:22:55FromDiscord<System64 ~ Flandre Scarlet> How can I link to a dll already?
01:23:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Riq
01:23:29FromDiscord<Elegantbeef> Though it's not the most eloquent
01:23:46FromDiscord<Elegantbeef> `in` in this case is the module name
01:25:01NimEventerNew question by itil memek cantik: Must have Nim function default argument as a mutable variable, see https://stackoverflow.com/questions/71345632/must-have-nim-function-default-argument-as-a-mutable-variable
01:25:19FromDiscord<mattrb> Thank you!
01:25:20FromDiscord<demotomohiro> In reply to @System64 "How can I link": Do you mean you want to link a libray to exising dll? I don't think it is possible without rebuilding the dll.
01:25:42FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Do you mean you": It is but I forgot the command
01:26:47FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#dynliboverride ?
01:27:08FromDiscord<System64 ~ Flandre Scarlet> I think it was with --passL
01:27:09FromDiscord<Elegantbeef> Oh do you mean the version numbering?
01:27:36FromDiscord<System64 ~ Flandre Scarlet> No, linking to DLL
01:31:32FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Oh do you mean": I have undefined references to...
01:32:36*jmdaemon quit (Ping timeout: 240 seconds)
01:33:14FromDiscord<demotomohiro> Just adding libraries to `--passL` to fix undefined reference error doesn't work?
01:33:47FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Just adding libraries to": https://media.discordapp.net/attachments/371759389889003532/949117420675674232/unknown.png
01:35:55FromDiscord<demotomohiro> In reply to @System64 "": https://docs.microsoft.com/en-us/troubleshoot/windows-client/deployment/dynamic-link-library#load-time-dynamic-linking
01:36:36FromDiscord<demotomohiro> You need to pass `tileengine.lib` or `-ltiteengine`.
01:37:33FromDiscord<demotomohiro> On windows, .dll is not a file to pass linker. You pass .lib to linker.
01:40:46FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "On windows, *.dll is": it's static link then
01:41:31*jmdaemon joined #nim
01:42:41FromDiscord<System64 ~ Flandre Scarlet> okay so I don't understand
01:43:35FromDiscord<demotomohiro> There are 2 types of .lib file.↵.lib files for static linking and for Load-time dynamic linking.
01:43:58FromDiscord<System64 ~ Flandre Scarlet> okay now it's fixed
01:44:22FromDiscord<demotomohiro> There are 2 types of .lib file.↵.lib files for static linking and for Load-time dynamic linking.↵How static/dynamic lib works on linux and windows is different.
01:44:53FromDiscord<System64 ~ Flandre Scarlet> Windows is weir
01:44:53FromDiscord<System64 ~ Flandre Scarlet> (edit) "weir" => "weird"
01:46:05FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Riv
01:47:13FromDiscord<Elegantbeef> In what way?
01:49:20FromDiscord<System64 ~ Flandre Scarlet> like encapsulation or that kind of stuff
01:50:01FromDiscord<Elegantbeef> You make modules that hold the logic you want
01:50:15FromDiscord<Elegantbeef> Nothing here makes sense to wrap with an object
01:50:59FromDiscord<System64 ~ Flandre Scarlet> ah alright↵'cause I was thinking to that :↵https://github.com/megamarc/PyTilengine/blob/master/src/tilengine.py
01:51:41FromDiscord<demotomohiro> `createWindow`, don't take `TLN_ENGINE` and `processWindow` doesn't take window object. That looks hard to make OOP.
01:51:54FromDiscord<Elegantbeef> Well Nim isnt python, you can make the flags enums in Nim
01:52:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Rix
01:52:55FromDiscord<Elegantbeef> then you can take in `set[WindowFlags]` and do `cast[cint](flags)`
01:53:08FromDiscord<Elegantbeef> It's more idiomatic
01:53:39FromDiscord<System64 ~ Flandre Scarlet> oof seems more complex
01:54:08FromDiscord<Elegantbeef> Sets are better than `int`
01:54:44FromDiscord<Elegantbeef> No one wants to do `FullScreen or Vsync or S1` we want `{Fullscreen, Vsync, S1}` or even `{FullScreen .. S1}`
01:55:40FromDiscord<System64 ~ Flandre Scarlet> ah yeah, sounds cool!
01:59:13FromDiscord<huantian> In reply to @System64 "ah alright 'cause I": smh they aren't even using IntEnum!
02:02:02FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "No one wants to": https://media.discordapp.net/attachments/371759389889003532/949124528519393330/unknown.png
02:07:05FromDiscord<Patitotective> How can I make `varargs` to require at least one element?
02:07:38FromDiscord<Elegantbeef> `assert myArgs.len > 0`
02:07:57FromDiscord<System64 ~ Flandre Scarlet> The sets method doesn't really work
02:08:03FromDiscord<Elegantbeef> It does
02:08:09FromDiscord<System64 ~ Flandre Scarlet> I have an error
02:08:16FromDiscord<Elegantbeef> Well fix it 😛
02:08:20FromDiscord<Rika> what is it
02:08:26FromDiscord<Rika> beef wtf smh rude
02:10:29FromDiscord<System64 ~ Flandre Scarlet> ah maybe I didn't tell what type was the set
02:11:47FromDiscord<System64 ~ Flandre Scarlet> and yeah it was that
02:11:50FromDiscord<System64 ~ Flandre Scarlet> I'm dumb lol
02:13:31FromDiscord<System64 ~ Flandre Scarlet> but is ``cast[cint](flags)`` doing a bitwise OR operation?
02:13:51FromDiscord<Rika> no
02:14:00FromDiscord<Rika> its doing a cast of the bitset to an integer
02:14:07FromDiscord<Rika> the or operation is putting elements into the set
02:14:26FromDiscord<System64 ~ Flandre Scarlet> I need to do an or operation through all elements
02:14:41FromDiscord<Rika> just put all elements into the set then
02:14:55FromDiscord<System64 ~ Flandre Scarlet> this is what I did
02:15:06FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#set-type-bit-fields
02:15:29FromDiscord<Rika> what is the problem then
02:15:40FromDiscord<Rika> what does your enum look like
02:15:59FromDiscord<Rika> your enum values should correspond to the exponent of 2 you would `or` an integer with
02:16:01FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Riz
02:16:18FromDiscord<Rika> so enum val 1 would be `0b1` or'ed
02:16:36FromDiscord<Rika> 1 will be `0b10` or'ed
02:16:43FromDiscord<Rika> 0 would be 0b1 i think
02:16:52FromDiscord<Rika> then 2 will be 100 etc
02:17:19FromDiscord<Rika> sent a code paste, see https://paste.rs/em6
02:17:45FromDiscord<Rika> ~~i think its dumb to mix integers with a bitset... oh well that's their fault~~
02:19:18FromDiscord<Rika> you can probably still use a set here, but it wont be as simple to do `cast` to convert between int and set anymore
02:19:30FromDiscord<Rika> i still recommend the set but eh
02:19:45FromDiscord<System64 ~ Flandre Scarlet> Okay fixed
02:19:57*jmdaemon quit (Ping timeout: 240 seconds)
02:20:10FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RiA
02:20:17FromDiscord<Rika> that works i guess
02:20:20FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3RiB
02:20:43FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RiC
02:21:00FromDiscord<Rika> sent a code paste, see https://paste.rs/NQw
02:21:10FromDiscord<Rika> well, i think THAT specific case would
02:21:18FromDiscord<Rika> but when you add S3 it would break
02:22:57FromDiscord<System64 ~ Flandre Scarlet> the For loops are beautiful
02:25:18FromDiscord<Elegantbeef> `sizeof(cint)` might be wrong
02:27:04FromDiscord<demotomohiro> Nim's `set[EnumType]` works like bit flags in C.
02:27:05FromDiscord<demotomohiro> https://play.nim-lang.org/#ix=3RiF
02:27:37FromDiscord<Traveler> sent a long message, see https://paste.rs/EBC
02:27:56FromDiscord<Traveler> both conversions for b an d c don't run
02:28:19FromDiscord<Traveler> (edit) "long message," => "code paste," | "http://ix.io/3RiH" => "https://play.nim-lang.org/#ix=3RiG"
02:28:36*ltriant joined #nim
02:29:04FromDiscord<Elegantbeef> `sizeof(TestSet)` is 1 so it really doesnt matter to use cint
02:29:17FromDiscord<Rika> In reply to @demotomohiro "Nim's `set[EnumType]` works like": yes and a portion of the api they are trying to recreate has an integer in the middle of the bitset
02:30:48FromDiscord<Traveler> Fixed it. PyObjects have a to method 😄
02:32:40FromDiscord<System64 ~ Flandre Scarlet> so I can't have "none" twice? https://media.discordapp.net/attachments/371759389889003532/949132239449509908/unknown.png
02:33:29FromDiscord<Elegantbeef> `BlendFlags {.pure.}` or use overloadable enums
02:35:09FromDiscord<System64 ~ Flandre Scarlet> WTF is that https://media.discordapp.net/attachments/371759389889003532/949132863553560686/unknown.png
02:35:26FromDiscord<Rika> a union
02:35:34FromDiscord<System64 ~ Flandre Scarlet> I don't know what it is
02:35:51FromDiscord<Elegantbeef> A type that can be two types but has no type information
02:36:12FromDiscord<System64 ~ Flandre Scarlet> and is it possible to translate that to nim?
02:36:13FromDiscord<demotomohiro> I think you can use this: https://nim-lang.org/docs/manual.html#foreign-function-interface-union-pragma
02:40:05FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RiK
02:40:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RiL
02:41:07FromDiscord<Elegantbeef> Nim doesnt have anonymous object syntax
02:41:09*arkurious quit (Quit: Leaving)
02:41:33FromDiscord<Elegantbeef> you could also do `a: tuple[index: uint16, flags: uint16]`
02:41:46FromDiscord<System64 ~ Flandre Scarlet> tuples can work too yeah
02:46:42FromDiscord<System64 ~ Flandre Scarlet> and is it possible to limit the size of a string?
02:47:01FromDiscord<Rika> no
02:47:28FromDiscord<Rika> i mean i guess if you want to treat `array[N, char]` as a string (even then, its cursed since its essentially a cstring
02:47:35FromDiscord<Rika> unless you also manually manage capacity
02:47:38FromDiscord<Rika> at length
02:47:40FromDiscord<Rika> (edit) removed "at"
02:47:50FromDiscord<System64 ~ Flandre Scarlet> I can do that during treatments yeah
02:47:55FromDiscord<Rika> at that point you've adhoc'ed a string
02:48:09FromDiscord<Rika> maybe just check the length
02:48:17FromDiscord<Rika> and limit it if its over
02:48:25FromDiscord<retkid> is there a partial read function in the stdlib?↵↵I only need to read the header
02:48:44FromDiscord<retkid> (edit) "is there a partial read function in the stdlib?↵↵I only need to read the header ... " added "of a file"
02:48:48FromDiscord<Rika> https://nim-lang.org/docs/io.html#readBytes%2CFile%2CopenArray%5B%5D%2CNatural%2CNatural
02:49:20FromDiscord<retkid> this returns a byte sequence like (00, AA, FF)?
02:49:26FromDiscord<retkid> or the characters
02:49:45FromDiscord<Rika> bytes for readbytes chars for readchars
02:49:48FromDiscord<Rika> lol
02:50:06FromDiscord<retkid> AH
02:50:08FromDiscord<retkid> thank you <3
02:50:10FromDiscord<Rika> lol
02:55:26FromDiscord<Patitotective> In reply to @Elegantbeef "`assert myArgs.len > 0`": but will it fix ambiguity errors?
02:56:19FromDiscord<retkid> SO i give it a file and an empty sequence of int8
02:56:31FromDiscord<retkid> start and a total number of bytes
02:57:35FromDiscord<Elegantbeef> It will not
03:00:45FromDiscord<retkid> NGL
03:01:02FromDiscord<retkid> its kinda strange that you provide the function with a list of the same size as you want to read
03:01:15FromDiscord<retkid> it doesn't make much sense to me, why cant it just do that in the procs
03:01:22FromDiscord<Elegantbeef> What?
03:01:23FromDiscord<retkid> but im sure theres a good reason
03:01:28FromDiscord<retkid> lemme show youuu
03:01:33FromDiscord<Elegantbeef> Those are the low level read operations
03:01:47FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3RiO
03:01:50FromDiscord<retkid> it works fine
03:02:04FromDiscord<retkid> but its just a bit strange i gotta put a mutable array in to get an output
03:02:33FromDiscord<Elegantbeef> you dont have to
03:02:50FromDiscord<Elegantbeef> God damn it
03:02:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RiP
03:02:58FromDiscord<retkid> it needs to be mutable
03:03:36FromDiscord<Elegantbeef> There no mutable array
03:03:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RiQ
03:04:37FromDiscord<retkid> where is read from?
03:04:46FromDiscord<Elegantbeef> Whatever the function for reading is
03:04:58FromDiscord<retkid> ah
03:06:05FromDiscord<retkid> There should be some kinda data type right, where you have an int linked with an arbitrary type, and you can like, assign it to anything
03:06:09FromDiscord<retkid> like [3] = "X"
03:06:14FromDiscord<retkid> like i dunno we can call it a table
03:06:39FromDiscord<Elegantbeef> That doesnt make much sense generally since you dont have the type information to make a type, but yes you can use a union
03:07:33FromDiscord<Rika> what?
03:07:37FromDiscord<Rika> im not sure what you're thinking
03:08:28FromDiscord<Elegantbeef> From why i understood it seemed they wanted a type that you can link an int to and just assign it to anything
03:09:12FromDiscord<Rika> ? a global table/array
03:09:41FromDiscord<Elegantbeef> Perhaps i dont know wasnt clear what they were saying
03:09:44FromDiscord<Elegantbeef> Atleast not clear to me
03:16:06*jmdaemon joined #nim
04:06:02*supakeen quit (Quit: WeeChat 3.4)
04:06:32*supakeen joined #nim
04:20:46*Gustavo6046 quit (Ping timeout: 245 seconds)
04:24:59*Gustavo6046 joined #nim
04:31:09*rockcavera quit (Remote host closed the connection)
04:59:09*slowButPresent quit (Quit: leaving)
05:09:16FromDiscord<surajvb> IMG-20220304-WA0006.jpg https://media.discordapp.net/attachments/371759389889003532/949171648878239744/IMG-20220304-WA0006.jpg
05:09:19FromDiscord<surajvb> It would be nice if we can resolve this issue while accessing nim-lang.org
05:10:22FromDiscord<Elegantbeef> https://github.com/nim-lang/website/issues
05:13:05FromDiscord<Rika> i am not getting the cert issue
05:13:10FromDiscord<Rika> it may be a geo thing
05:53:37FromDiscord<demotomohiro> I also dont get that error.
06:01:55FromDiscord<Rika> ~~we're both in japan so it still doesnt tell if its a location thing or not lol~~
06:02:06FromDiscord<Elegantbeef> Fine in Canada here
06:02:19FromDiscord<Elegantbeef> That's like the entire globe
06:02:24FromDiscord<Elegantbeef> eh
06:03:55FromDiscord<Rika> strange then
06:04:00FromDiscord<Rika> might be their browser then
06:04:26FromDiscord<Elegantbeef> Could also possibly locally expired certs on their PC, no?
06:05:47*ltriant quit (Ping timeout: 256 seconds)
06:27:45FromDiscord<pmunch> @System64 ~ Flandre Scarlet\: Futhark should've wrapped your union as well. It knows how to handle them
06:34:17*ltriant joined #nim
07:11:51*jjido joined #nim
07:25:07*ltriant quit (Ping timeout: 256 seconds)
07:29:20*PMunch joined #nim
07:58:26PMunchDamn, Futhark to the rescue once again. The librdkafka bindings where missing some of the newer procedures, replaced the import rdkafka with four lines of Futhark imports and voila!
08:02:38FromDiscord<dilawar (Dilawar Singh)> Is there a libray that can help in locating various executable in Win32 platform e.g. if I say `locateExe("msbuild.exe")`, it can return the path of `MSBuild.exe`. Optionally I can pass list of directories to search into recursively?
08:03:03FromDiscord<Elegantbeef> https://nim-lang.org/docs/os.html#findExe%2Cstring%2Cbool%2CopenArray%5Bstring%5D
08:07:23FromDiscord<dilawar (Dilawar Singh)> It searches in `PATH`. Unfortunately, `choco install foo` may not add foo to `PATH`on Win32. I need to pass some locations to search into. Something like `cmake`'s `find_executable` https://cmake.org/cmake/help/v3.8/command/find_program.html?highlight=i
08:09:02*ltriant joined #nim
08:10:24FromDiscord<Rika> Well where should it search if not the PATH ?
08:12:05*Gustavo6046 quit (Quit: Leaving)
08:15:40*ltriant quit (Ping timeout: 272 seconds)
08:15:53FromDiscord<Elegantbeef> Recursively search the entire drive 😛
08:16:52*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:20:30FromDiscord<dilawar (Dilawar Singh)> I may have to before declaring failure in CI pipeline 🤔. `walkDirRec` looks promising.
08:21:58FromDiscord<dilawar (Dilawar Singh)> I hope people at chocolatey and Microsoft pay attention to `PATH`. But thats what it is. They sometimes put the executable into versioned folder that changes after every update!↵(@Rika)
08:24:26FromDiscord<Elegantbeef> MS be like "what's a path"
08:24:33FromDiscord<Elegantbeef> There's a few stones outside, use that
08:31:36*acidsys quit (Excess Flood)
08:32:08*acidsys joined #nim
08:37:08PMunchHaha :P
08:37:46PMunchI guess they would put it in the path, but then again since you don't often use the terminal in Windows they might just add an icon to the start menu and call it the day
08:45:05*ltriant joined #nim
08:49:49*ltriant quit (Ping timeout: 256 seconds)
09:47:49*om3ga quit (Ping timeout: 240 seconds)
10:20:15FromDiscord<fbpyr> [dilawar (Dilawar Singh)](https://matrix.to/#/@dilawar-599aa234d73408ce4f7246bd:gitter.im)\: did chocolatey no add it's bin path to `PATH`? it looks like it did over here.
10:21:55FromDiscord<System64 ~ Flandre Scarlet> In reply to @pmunch "<@380360389377916939>\: Futhark should've wrapped": Ah alright↵But is it possible to share my library with others?
10:22:55PMunchYou can share the futhark_<hash>.nim file
10:23:34PMunchI've seen people add that to their repo and then use `when defined(useFuthark): <futhark stuff> else: import futhark_<hash>.nim`
10:24:10PMunchThat way people can build against the actual C library, or trust that your bindings are for the same version and use those
10:25:30FromDiscord<System64 ~ Flandre Scarlet> ah alright
10:25:36FromDiscord<System64 ~ Flandre Scarlet> and can I rename the file?
10:26:11PMunchSure, as long as you manually `import` it you can name it whatever you want
10:26:25FromDiscord<System64 ~ Flandre Scarlet> Oh alright, it's nice
10:26:29PMunchThe hash is just there so that I can check whether the cache exists or not
10:27:12PMunchI basically just hash all the arguments you pass in and use that, this way if you change anything in the `importc` block it will detect if it needs to build a new file or just use the old one
10:27:32FromDiscord<System64 ~ Flandre Scarlet> ah I understand now↵But now I try to make the interaction with the library higher level
10:30:03FromDiscord<System64 ~ Flandre Scarlet> Btw does Nim supports something like Class method?
10:30:16PMunchClass method?
10:30:17FromDiscord<Elegantbeef> Oh pmunch you might be interested, started toying with macros that use distinct Nimnodes to expand functionality. Quite nice so far https://github.com/beef331/micros/blob/master/tests/test1.nim
10:30:36FromDiscord<Elegantbeef> No Nim doesnt have Classes, if you want a type bound procedure you do `proc myProcName(_: typedesc[MyType])`
10:31:22FromDiscord<Elegantbeef> `proc doThing(_: typedesc[int]) = echo "hello"` is invokable `int.doThing()`
10:31:50FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "No Nim doesnt have": Ah alright so I can do myObject.doSomething()?
10:32:17FromDiscord<Elegantbeef> Nim allows you to do `doSomething(myObject)` or `doSomething(myObject)` with all procedures
10:32:38FromDiscord<Elegantbeef> It's called "Method Call Syntax" in the manual and "Uniform Function Calling Syntax" everywhere else
10:32:45FromDiscord<Elegantbeef> Damn it i'm tired
10:32:46FromDiscord<enthus1ast> myObject.doSomething() beef means ;)
10:32:54FromDiscord<Elegantbeef> Thanks
10:33:06FromDiscord<System64 ~ Flandre Scarlet> aah alright, thanks
10:33:17FromDiscord<Elegantbeef> I say tired but i was just typing and not proofreading, but tired is easier
10:34:14FromDiscord<Elegantbeef> Also that's not a Class method in other languages, that'd be a member function
10:34:23FromDiscord<Elegantbeef> Or instance function
10:34:36FromDiscord<Elegantbeef> Atleast in C#/Java i guess
10:34:44FromDiscord<Elegantbeef> Anyway i go sleep now
10:35:29FromDiscord<System64 ~ Flandre Scarlet> and does it have the Self keywordN
10:35:31FromDiscord<System64 ~ Flandre Scarlet> (edit) "keywordN" => "keyword?"
10:39:34FromDiscord<Rika> there is no concept of "self" or "this" in nim, you can just call the first param. that
10:40:34FromDiscord<Rika> so idk `proc takeString(self: StringyThing): string = return self.thingyString`
10:41:06FromDiscord<Rika> called `aStringyThing.takeString()` or the other variants as eluded to above
10:41:13FromDiscord<Rika> its just a parameter name
10:44:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @Rika "so idk `proc takeString(self:": Ah alright so I have to pass the first parameter anyway then?
10:44:54*Guest2 joined #nim
10:45:13FromDiscord<Rika> yeah there is no concept of classes and procs bound to types here
10:45:26FromDiscord<Rika> its a strange language if you consider that
10:45:46FromDiscord<System64 ~ Flandre Scarlet> Ah I see↵so doing myObject.doSomething() is useless, right?
10:45:47*Guest2 quit (Client Quit)
10:45:54FromDiscord<Rika> why would it be?
10:46:05FromDiscord<Rika> i mean sure it could be useless if you make the proc useless but huh?
10:46:35FromDiscord<System64 ~ Flandre Scarlet> it would be↵↵myObject.doSomething(myObject, a, b, c)
10:49:12FromDiscord<Rika> ? no, when you do `myObject.doSomething()` it is equivalent to `doSomething(myObject)` so myObject is the first param
10:50:15FromDiscord<System64 ~ Flandre Scarlet> ah alright
10:53:28FromDiscord<Rika> 👌
10:55:33FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/Jz2
10:56:14FromDiscord<Rika> in this case, it is `discard TLN_ENGINE.deleteEngine()`, and `self` is a type not an object
10:56:25FromDiscord<Rika> i think what you want is `self: TLN_ENGINE`
10:57:47FromDiscord<System64 ~ Flandre Scarlet> TLN_Engine is a struct in C, so it's an object on nim↵But I want this proc to be called only on a TLN_Engine object
10:58:45FromDiscord<Rika> so do you want `self` to be the struct, or the type of the struct
10:59:00FromDiscord<Rika> In reply to @Rika "i think what you": do you want to access the fields of the struct? if so, you want this
10:59:16FromDiscord<demotomohiro> sent a code paste, see https://paste.rs/Rnr
10:59:22FromDiscord<System64 ~ Flandre Scarlet> ah wait
10:59:28FromDiscord<System64 ~ Flandre Scarlet> TLN_Engine is a pointer
10:59:32FromDiscord<System64 ~ Flandre Scarlet> (edit) "TLN_Engine is a pointer ... " added "to a struct"
10:59:40FromDiscord<Rika> yes okay
10:59:46FromDiscord<Rika> my question still applies
11:00:01FromDiscord<System64 ~ Flandre Scarlet> I don't want to access the fields
11:00:15FromDiscord<Rika> ok wait let me read up on the context
11:00:36FromDiscord<demotomohiro> How `TLN_ENGINE` is defined in your Nim code?
11:00:41FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3RjV
11:01:15FromDiscord<Rika> In reply to @System64 "I don't want to": do you need the pointer of the struct as a value in the proc
11:01:28FromDiscord<Rika> if you need to pass the value, use `self: TLN_Engine`
11:02:10*ltriant joined #nim
11:03:45FromDiscord<System64 ~ Flandre Scarlet> ah thanks, it works
11:08:23*ltriant quit (Ping timeout: 256 seconds)
11:33:51FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/QpU
11:43:40*ltriant joined #nim
11:43:50FromDiscord<System64 ~ Flandre Scarlet> I should be able to access the fields https://media.discordapp.net/attachments/371759389889003532/949270944743047229/unknown.png
11:48:28NimEventerNew thread by Mardiyah: To prepend binary operation like binary append, see https://forum.nim-lang.org/t/8974
11:58:02FromDiscord<demotomohiro> In reply to @System64 "I should be able": How type of `color` is defined?
11:58:29NimEventerNew thread by Drkameleon: ReadLineFromStdin & Windows, see https://forum.nim-lang.org/t/8975
11:58:38FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rk0
11:59:31FromDiscord<vindaar> @System64 ~ Flandre Scarlet\: you write `color.r` instead of `self.r` etc.
11:59:42FromDiscord<System64 ~ Flandre Scarlet> ah yeah I'm dumb lol
12:00:05FromDiscord<System64 ~ Flandre Scarlet> but thanks
12:02:10PMunch@Elegantbeef, that sounds like it would require a lot of casting back and forth though
12:02:14PMunchI considered it for macroutils
12:05:43PMunch@System64_~_Flandre_Scarlet, why have you marked your object as pure?
12:06:02*supakeen quit (Quit: WeeChat 3.4)
12:06:32*supakeen joined #nim
12:10:03FromDiscord<demotomohiro> It seems using pure pragma to object type without inheritable pragma do nothing.↵Non-inheritable object types dont have runtime type info.↵https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-how-pure-pragma-dotpuredot-work-to-object-typeqmark
12:12:26FromDiscord<demotomohiro> But Nim in future version can add runtime type info to Non-inheritable object types?
12:12:39FromDiscord<Rika> can but i doubt they will
12:18:52FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, why have you": To avoid variable name conflict
12:19:24FromDiscord<System64 ~ Flandre Scarlet> In reply to @System64 "so I can't have": To avoid this problem
12:19:27PMunch@demotomohiro, exactly `pure` is only used for `inheritable` to remove the runtime type information from the object
12:19:51PMunch@System64_~_Flandre_Scarlet, that pragma doesn't do anything at all
12:20:06PMunch(when not combined with `{.inheritable.}`
12:20:08PMunch)
12:20:09FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, that pragma doesn't": Ah! And why does it work with enums?
12:20:39PMunchBecause enums are something else than objects, and the `pure` pragma for enums is different from the one for objects
12:20:45PMunchThey really shouldn't be called the same..
12:21:30FromDiscord<System64 ~ Flandre Scarlet> Woops, that's confusing!
12:21:58FromDiscord<demotomohiro> Yes. they should be different name.
12:22:47PMunchHaha, yeah you're the second person in just a week or so which have tried to use pure in this way
12:27:33FromDiscord<fbpyr> hmm.. 🤔↵trying to port a tiny (14sloc) C++ hello world plugin to nim\: https://play.nim-lang.org/#ix=3Rk7↵how would I import ControllerFactory from the header file?↵nim compiler complains about `undeclared identifier: 'ControllerFactory'`
12:29:28PMunch@fbpyr, you seem to have a misunderstanding in how wrapping works
12:30:57FromDiscord<demotomohiro> You need to define `ControllerFactory` type in Nim code somehow.
12:31:00PMunchNowhere in your code do you define ControllerFactory, which is what the error message is about. That `importc` tells Nim that the procedure `plugin_x64_init` is called `ControllerFactory` in the C++ code.
12:32:08PMunchIf you define `type ControllerFactory = distinct object` and then just do `{.importc, header: "CwAPI3D.h".}` on the procedure (assuming it is called `plugin_x64_init` in the C code) it should work.
12:32:20FromDiscord<demotomohiro> This section in Nim manual would help you: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma
12:32:25FromDiscord<fbpyr> yes the error is very clear. I was under the impression maybe that .importc. would somehow introduce it, but it already felt like I was an import..
12:32:41FromDiscord<fbpyr> ah thanks for the pointer!! 😌
12:33:17PMunchAh wait, since you actually try to use aFactory you need to have the type definition for it in Nim.
12:33:26PMunchSo you can't just call it a distinct object
12:34:45PMunchNah importc only tells Nim how to import the current symbol. So e.g. you could do `proc init(aFactory: ptr ControllerFactory): bool {.importc: "plugin_x64_init".}` to have it be called `init` in Nim code, but still resolve to `plugin_x64_init` in C code.
12:35:54FromDiscord<fbpyr> I see - I will try that and read up in the importcpp pragma..
12:36:43FromDiscord<fbpyr> my understanding was, that the function in cpp was called `plugin_x64_init` as the expected name for the entrypoint of the plugin.
12:38:23FromDiscord<fbpyr> bummer, that c2nim had troubles with the snippet, when I tried it..
12:41:01*jmdaemon quit (Ping timeout: 256 seconds)
12:42:10FromDiscord<fbpyr> thx for the explanation - now I understand the .importc pragma a little better. ↵yes then what I had in the snippet just makes no sense..
13:12:31PMunchIf the function in C++ is called plugin_x64_init then you can simply do `proc plugin_x64_init(args): returntype {.importc.}`
13:13:11PMunchBut you can't do e.g. `proc pluginx64Init(args): returntype {.importc.}`, it has to be verbatim otherwise you need to give a string value to `importc`
13:17:36FromDiscord<fbpyr> in their example the plugin\_x64\_init seems to be the entry point. the `ControllerFactory` is leading to a class called `ICwAPI3DControllerFactory` so I assume I have to somehow introduce it to nim.. it seems like there is also a way way nimterop, but ideally I would love to understand the basics first..
13:19:48FromDiscord<fbpyr> aha so the returntype of bool would need the `{.importc.}`
13:20:04PMunchIf you figure out how C++ <=> Nim interop should work you could make a PR to Futhark so you never have to think about it again :P
13:20:34PMunch@fbpyr, no the pragma is attached to the proc, not the returntype
13:20:52PMunchI just typed returntype because I couldn't remember what the actual return type was :P
13:20:57FromDiscord<fbpyr> oh ok.
13:21:18FromDiscord<fbpyr> ok, was simple bool..
13:26:01*slowButPresent joined #nim
13:31:48*PMunch quit (Quit: Leaving)
13:52:37FromDiscord<fbpyr> ..so after reading the `ImportCpp pragma` I am using the ControllerFactory via `importcpp`\:↵https://play.nim-lang.org/#ix=3Rkt↵now compiler errors at line 15 with `Error: attempting to call undeclared routine: 'getUtilityController'`↵does that mean I would need to introduce each class method individually, additionally to the class itself? 🤔
13:55:34FromDiscord<demotomohiro> If you want to use it, Nim need to know about class method.
13:58:09FromDiscord<fbpyr> I see, so it does not come with the class.. 🙁
13:58:41FromDiscord<fbpyr> I hoped it would get the class with its methods.. 😉
14:00:37FromDiscord<demotomohiro> Nim compiler doesn't try to read C/C++ files and understand C/C++ code. You need to tell Nim about types/constants/functions in C/C++ library so that Nim can generate C or C++ code that correctly use the library.
14:02:57FromDiscord<demotomohiro> It seems nimterop or futhark read and understand C code and generates Nim type definitions and procedure declarations with proper pragma.
14:03:27FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "It seems nimterop or": And it works well!
14:03:54FromDiscord<System64 ~ Flandre Scarlet> Btw, is it a good start? https://media.discordapp.net/attachments/371759389889003532/949306195590660126/tilengine.nim
14:09:21FromDiscord<fbpyr> thank you @demotomohiro . I guess I should check out nimterop then.. 🙂
14:14:47FromDiscord<demotomohiro> @System64 ~ Flandre Scarlet you should use `cint` instead of `int` if it is passed to C function.↵https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-what-is-the-difference-between-cintslashcfloat-and-intslashfloatqmark
14:16:09FromDiscord<demotomohiro> !eval echo sizeof(int), ", ", sizeof(cint)
14:16:12NimBot8, 4
14:16:51*arkurious joined #nim
14:17:35FromDiscord<demotomohiro> That means sizeof(int) in Nim and sizeof(int) in C is different in NimBot's machine.
14:17:47FromDiscord<System64 ~ Flandre Scarlet> Ah I see! good to know
14:17:53FromDiscord<System64 ~ Flandre Scarlet> and is there C variants for uint8?
14:18:31FromDiscord<demotomohiro> `uint8_t`?
14:18:56FromDiscord<System64 ~ Flandre Scarlet> it's the C version of uint8_t?
14:19:10FromDiscord<System64 ~ Flandre Scarlet> !eval echo sizeof(uint8), ", ", sizeof(uint8_t)
14:19:12NimBotCompile failed: /usercode/in.nim(1, 34) Error: undeclared identifier: 'uint8_t'
14:20:34FromDiscord<demotomohiro> `uint8_t` is a type in C, not Nim. Nim has uint8.
14:21:23FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "`uint8_t` is a type": and the size is the same?
14:21:34Amun-Rayes
14:21:39FromDiscord<System64 ~ Flandre Scarlet> ah alright
14:21:53FromDiscord<System64 ~ Flandre Scarlet> only ints are differents it seems
14:22:10Amun-Raonly those without fixed width
14:22:11FromDiscord<System64 ~ Flandre Scarlet> !eval echo sizeof(short), ", ", sizeof(cshort)
14:22:13NimBotCompile failed: /usercode/in.nim(1, 13) Error: undeclared identifier: 'short'
14:22:23FromDiscord<System64 ~ Flandre Scarlet> ah wait
14:22:32FromDiscord<System64 ~ Flandre Scarlet> !eval echo sizeof(int16), ", ", sizeof(cshort)
14:22:35NimBot2, 2
14:23:19FromDiscord<System64 ~ Flandre Scarlet> ah alright, shorts have the same size
14:23:22Amun-Rait's not that those have different size, it's just they are not interchangeable when doing interop
14:24:30FromDiscord<System64 ~ Flandre Scarlet> Ah alright
14:24:51FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RkF
14:25:17Amun-Rait's be done automagically
14:25:27FromDiscord<System64 ~ Flandre Scarlet> ah alright
14:25:46Amun-Rayou have to use `$` when returning cstring to nim string
14:25:58FromDiscord<System64 ~ Flandre Scarlet> good to know
14:26:42FromDiscord<System64 ~ Flandre Scarlet> Fixed I think https://media.discordapp.net/attachments/371759389889003532/949311928671547442/tilengine.nim
14:33:18FromDiscord<demotomohiro> I hope it works. I'm sleepy. Good night.
14:36:35FromDiscord<System64 ~ Flandre Scarlet> Good night and it runs at least
14:36:58FromDiscord<System64 ~ Flandre Scarlet> is it possible to divide the module in submodules but keeping one file?
14:49:19FromDiscord<retkid> whats the ultimate for iterable object
14:49:30FromDiscord<retkid> (edit) "whats the ultimate ... for" added "generic"
14:49:47FromDiscord<retkid> just any object with a type i can iterate over
14:49:52FromDiscord<retkid> seq or array, closed or open
14:50:01FromDiscord<retkid> (edit)
14:50:48FromDiscord<retkid> Iterable[T]
14:51:04NimEventerNew thread by Drkameleon: Error: unhandled exception: index 2 not in 0 .. 1 [IndexDefect], see https://forum.nim-lang.org/t/8976
14:51:54*oisota6 joined #nim
14:52:50*flynn4 joined #nim
14:53:01*greyrat_ joined #nim
14:54:10*[RMS] joined #nim
14:55:36*lumidify_ joined #nim
14:59:52*greyrat quit (*.net *.split)
14:59:52*lumidify quit (*.net *.split)
14:59:52*flynn quit (*.net *.split)
14:59:52*xet7 quit (*.net *.split)
14:59:52*oisota quit (*.net *.split)
14:59:52*arkanoid quit (*.net *.split)
14:59:52*[R] quit (*.net *.split)
14:59:53*oisota6 is now known as oisota
14:59:57*flynn4 is now known as flynn
15:00:39*arkanoid joined #nim
15:06:53*xet7 joined #nim
15:18:55FromDiscord<System64 ~ Flandre Scarlet> Should I turn my objects into reference type?
15:24:35*neurocyte0917090 joined #nim
15:30:10FromDiscord<auxym> problably not, unless you need reference semantics: multiple references to a single object
15:45:22FromDiscord<System64 ~ Flandre Scarlet> In reply to @auxym "problably not, unless you": But if I have to pass an object to a function?
15:45:41FromDiscord<System64 ~ Flandre Scarlet> it would be slower to pass it as value than as ref
15:46:26*kayabaNerve_ joined #nim
15:46:46FromDiscord<auxym> nim optimizes this automatically: is the object is "large enough", nim passes it as a reference. If it's small, the cost of a copy is smaller than a dereference so it is passed by value (copy)
15:47:06FromDiscord<auxym> (var arguments are always passed by ref, somewhat obviously)
15:47:47FromDiscord<System64 ~ Flandre Scarlet> Aaah alright, so I'll let Nim doing this for me
15:47:59FromDiscord<System64 ~ Flandre Scarlet> still pretty clever
15:48:33FromDiscord<System64 ~ Flandre Scarlet> since if I had to write C code, I'd pass every struct by pointer
15:49:39NimEventerNew question by itil memek cantik: Nim&amp;#39;s way to clear empty character variable, see https://stackoverflow.com/questions/71353852/nim39s-way-to-clear-empty-character-variable
16:19:28*TechAspirer joined #nim
16:21:45*kayabaNerve_ quit (Ping timeout: 252 seconds)
16:35:19NimEventerNew thread by Mardiyah: Nim's way to clear empty character variable, see https://forum.nim-lang.org/t/8977
16:36:16*vicfred joined #nim
16:37:52NimEventerNew post on r/nim by Familiar_Ad_8919: what exactly does this error mean?, see https://reddit.com/r/nim/comments/t6mzwv/what_exactly_does_this_error_mean/
16:40:22*icebattle quit (Ping timeout: 250 seconds)
16:41:02*TechAspirer quit (Ping timeout: 260 seconds)
16:42:48*Gustavo6046 joined #nim
16:52:12*icebattle joined #nim
17:40:21*jjido joined #nim
17:57:46*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
17:58:40FromDiscord<haoliang> why IndexDefect was designed to be `defect`? i used to use `try: dict[key] except IndexError:` pattern, i was thought that pattern is common.
18:02:31FromDiscord<michaelb> In reply to @haoliang "why IndexDefect was designed": `IndexError` is documented as deprecated, not sure how recent that is
18:02:42FromDiscord<michaelb> https://nim-lang.org/1.6.4/system.html#IndexError
18:04:24FromDiscord<michaelb> seems in 1.4 `IndexError` was a simple alias for `IndexError`, which was not great since "defect" in Nim is supposed to means an uncatchable error
18:04:32FromDiscord<michaelb> (edit) "means" => "mean"
18:04:58FromDiscord<michaelb> and therefore referring to it as `IndexError` could give a wrong impression those reading the code
18:05:17FromDiscord<michaelb> (edit) "and therefore referring to it as `IndexError` could give a wrong impression ... thosesome" added "to" | "the" => "some" | "those readingsomecode ... " added "using that alias"
18:06:18FromDiscord<michaelb> (edit) "`IndexError`," => "`IndexDefect`,"
18:06:54FromDiscord<auxym> In reply to @haoliang "why IndexDefect was designed": what is `dict`? If it's a `Table`, then an unknown key should raise `KeyError`, not `IndexError`. `KeyError` is catchable.
18:07:17FromDiscord<auxym> https://nim-lang.org/docs/tables.html#%5B%5D%2CTable%5BA%2CB%5D%2CA
18:09:49*rockcavera joined #nim
18:09:49*rockcavera quit (Changing host)
18:09:49*rockcavera joined #nim
18:12:39FromDiscord<haoliang> In reply to @auxym "what is `dict`? If": good point, i am trying to find that use case back
18:19:28FromDiscord<haoliang> sent a code paste, see https://play.nim-lang.org/#ix=3RlC
18:19:35FromDiscord<haoliang> (edit)
18:23:52FromDiscord<dom96> why don't you do a length check?
18:24:32FromDiscord<System64 ~ Flandre Scarlet> Why??? https://media.discordapp.net/attachments/371759389889003532/949371784371793970/unknown.png
18:24:56FromDiscord<haoliang> i sure can, but i prefer this way
18:26:00*vicfred quit (Quit: Leaving)
18:29:26FromDiscord<konsumlamm> In reply to @System64 "Why???": i think you meant to write `spriteData.y`? i.e. lowercase s
18:30:31FromDiscord<System64 ~ Flandre Scarlet> oooh god I'm dumb lol
18:31:10FromDiscord<System64 ~ Flandre Scarlet> okay pointer problem now https://media.discordapp.net/attachments/371759389889003532/949373453092413510/unknown.png
18:33:12FromDiscord<haoliang> sent a code paste, see https://play.nim-lang.org/#ix=3RlE
18:33:16*jjido joined #nim
18:45:34FromDiscord<Waldecir Santos> Is the result of a proc always `var/immutable` or do I need to add var ?
18:50:23FromDiscord<konsumlamm> what?
18:50:39FromDiscord<konsumlamm> the result of a proc isn't a variable in the first place
18:51:42FromDiscord<System64 ~ Flandre Scarlet> @konsumlamm is my error normal? I converted to pointer
18:52:20FromDiscord<Waldecir Santos> In reply to @konsumlamm "the result of a": I mean if a proc returns a object, this object is immutable ?
18:52:41FromDiscord<konsumlamm> immutability is not a property of a value but of a variable
18:52:47FromDiscord<konsumlamm> in Nim
18:53:00FromDiscord<konsumlamm> In reply to @System64 "<@!312654963694108674> is my error": idk, i've never worked with `pointer`
18:53:10*jmdaemon joined #nim
18:56:12*vicfred joined #nim
18:59:34FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3RlL
19:00:09FromDiscord<Waldecir Santos> You can probably overload `` for it, but no we don't have it right now
19:00:13FromDiscord<Elegantbeef> `import std/strutils; let x = repeat("A", 10)`
19:00:21FromDiscord<Waldecir Santos> (edit) "``" => "``` `"
19:00:27FromDiscord<hmmm> ty wakd and ty beefzor
19:02:15FromDiscord<Waldecir Santos> I'm trying to "chain" calls but the second call keep saying that the value is immutable, but works if I create a var first, not sure what to do to make proc return an "var/muttable" object
19:03:02FromDiscord<Elegantbeef> You can either use `sugar.dup` or if the proc takes a `var T` return a `var T`
19:03:58FromDiscord<Elegantbeef> For the dup method
19:04:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RlO
19:04:11FromDiscord<Waldecir Santos> you mean `proc myproc(obj; var Obj[T[) var Obj[t]` adding var to the return ?
19:04:24*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
19:04:29FromDiscord<Waldecir Santos> (edit) "Obj[T[)" => "Obj[T]):" | "Obj[t]`" => "Obj[t] =`"
19:05:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RlP
19:06:15FromDiscord<Elegantbeef> In Nim `var T` is a mutable reference that is ensured does not outlive the place of borrow
19:06:19FromDiscord<Waldecir Santos> Oh nice so `var` is valid in the return portion, not sure why this is failing for me, let me play with your example thank you !
19:06:36FromDiscord<Elegantbeef> The borrow site has to come from a parameter
19:06:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RlQ
19:09:24FromDiscord<Waldecir Santos> So it cannot be an object, it needs to be a property of an object, right ?
19:09:35FromDiscord<Elegantbeef> It can be an object
19:10:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RlS
19:10:58FromDiscord<Waldecir Santos> Got it, let me play around with your example , thank you !
19:14:09FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RlT
19:14:16FromDiscord<Elegantbeef> `s.addr`
19:23:36FromDiscord<System64 ~ Flandre Scarlet> ah thanks
19:24:34FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RlX
19:26:39FromDiscord<Elegantbeef> Not in that case since you're taking a pointer to the stack
19:27:09FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Not in that case": ah alright so I'm still safe I guess?
19:27:15*xet7 quit (Quit: Leaving)
19:27:46FromDiscord<Waldecir Santos> I think I've found the issue @ElegantBeef https://nim-lang.github.io/Nim/var_t_return.html this is exactly what I'm trying to do, the first call creates the chain-able object and it creates this error `Error: 'qs``gensym1' escapes its stack frame; context:` there is anyway around this ?
19:28:45*xet7 joined #nim
19:30:12FromDiscord<Waldecir Santos> seems like I'll need to use ptr instead of var and that is scary https://forum.nim-lang.org/t/7561
19:34:19FromDiscord<System64 ~ Flandre Scarlet> and is the GC watch the stack too?
19:37:43FromDiscord<auxym> no. the stack is popped when the proc returns, no need to GC it
19:38:16FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RlY
19:38:31FromDiscord<System64 ~ Flandre Scarlet> I create an object in the stack and pass a pointer to it
19:38:39FromDiscord<System64 ~ Flandre Scarlet> (edit) "it" => "another function"
19:39:01FromDiscord<auxym> yes, there is a problem. Unless TLN_SpriteData is `ref`, but then you need to `new` it
19:39:10FromDiscord<auxym> so it gets allocated on the heap
19:39:31FromDiscord<System64 ~ Flandre Scarlet> But Elegant said there is no problem
19:40:52FromDiscord<auxym> depends, what does TLN_CreateSpriteset do? Do it keep the pointer around or just does something with it and is done when it returns?
19:41:09FromDiscord<auxym> and we don't know if TLN_SpriteData is ref or value
19:41:34FromDiscord<auxym> if it's ref it's OK
19:41:51*pro joined #nim
19:43:46FromDiscord<auxym> (but you need to call new on it, otherwise it's nil)
19:45:02FromDiscord<auxym> I think what @ElegantBeef was saying: as long as you're in that proc, the pointer will not be null. But when the proc returns, it definitely will be null.
19:48:59*vicfred quit (Quit: Leaving)
19:54:10FromDiscord<System64 ~ Flandre Scarlet> In reply to @auxym "and we don't know": It's a réf but I convert a nim Sprite Data to Tilengine Sprite Data, so it's not thé same spriteData
20:01:38*pro quit (Quit: pro)
20:29:29*Gustavo6046 quit (Read error: Connection reset by peer)
20:34:01*Gustavo6046 joined #nim
20:38:46FromDiscord<exelotl> anyone know what might cause this? https://media.discordapp.net/attachments/371759389889003532/949405566130880552/unknown.png
20:40:14FromDiscord<exelotl> I can't pass a proc to `toScene` because there's some ambiguity over the lock level...
20:41:51FromDiscord<exelotl> oh nvm, figured it out
20:42:14FromDiscord<exelotl> I was exporting the same proc from another file too so there was actual ambiguity
20:56:42*Gustavo6046 quit (Read error: Connection reset by peer)
20:58:36*Gustavo6046 joined #nim
21:18:57*ltriant quit (Ping timeout: 256 seconds)
21:19:13FromDiscord<michaelb> what's the favored/best way to allocate simd aligned memory, that you can read from and write to, and/or hand-off to a wrapped C/C++ lib for it to manipulate
21:20:46FromDiscord<michaelb> (edit) "what's the favored/best way to allocate simd aligned memory, that you can read ... frombytes" added "bytes" | "bytesfrom and write ... to," added "bytes"
21:33:03FromDiscord<Elegantbeef> @exelotl\: do you have a min repro?
21:33:40FromDiscord<Elegantbeef> @Waldecir Santos\: like i said the var has to derive from the parameters
21:34:29FromDiscord<Elegantbeef> No a pointer to the stack will never be nil, the issue is that the pointer after the proc is returned is unsafe↵(@auxym)
21:34:40FromDiscord<Elegantbeef> So depending on the logic of the code it's a very bad thing
21:42:15*wyrd quit (Ping timeout: 240 seconds)
21:49:24*wyrd joined #nim
21:49:38FromDiscord<Mysterysib> Hi, how can I go about defining a dynamic type? (although I know the data types of what I store in it, I don't know the number - that is determined by the program's returns from other functions)
21:50:17FromDiscord<Mysterysib> I thought of something like this: `type↵ Log = object↵ version : string↵ DataSequence = seq(string)` but that gives me the error `initialization not allowed here`
21:50:31FromDiscord<Mysterysib> because of the sequence
21:50:38FromDiscord<Elegantbeef> `seq[string]`
21:51:17FromDiscord<Mysterysib> I get the same error
21:51:40FromDiscord<Elegantbeef> `: seq[string]`
21:52:18FromDiscord<Mysterysib> Ohhhh, that was inattentive of me haha. Thanks sm
21:57:48*ltriant joined #nim
22:00:30FromDiscord<System64 ~ Flandre Scarlet> I never had this before, what's that? https://media.discordapp.net/attachments/371759389889003532/949426131549974568/unknown.png
22:02:15FromDiscord<Elegantbeef> `rgb: uint, uint8`
22:03:04FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "`rgb: uint, uint8`": yeah, I transtype
22:03:07FromDiscord<System64 ~ Flandre Scarlet> (edit) "transtype" => "cast"
22:03:23FromDiscord<System64 ~ Flandre Scarlet> here it works fine https://media.discordapp.net/attachments/371759389889003532/949426855801405540/unknown.png
22:05:28FromDiscord<Generic> does it not work in a generic function or template?
22:06:14FromDiscord<System64 ~ Flandre Scarlet> I dunno, but it's the only place where it doesn't work
22:07:03FromDiscord<Generic> does casting with uint8(x) work?
22:07:33FromDiscord<Elegantbeef> no that's not casting
22:07:36FromDiscord<Elegantbeef> look at your proc def
22:07:49FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/949427974829121596/image.png
22:07:57FromDiscord<System64 ~ Flandre Scarlet> ah yeah woops
22:08:00FromDiscord<Elegantbeef> you're declaring `uint8` as a variable
22:09:58FromDiscord<System64 ~ Flandre Scarlet> yeah fixed now, thanks
22:32:26*jmdaemon quit (Ping timeout: 260 seconds)
22:33:12*ltriant quit (Ping timeout: 272 seconds)
22:50:45FromDiscord<exelotl> In reply to @Elegantbeef "<@90614688374624256>\: do you have": I defined a proc in one module {.exportc.}'d it, {.importc.}'d it in another module, and then imported both modules
22:51:12FromDiscord<exelotl> so as far as Nim's concerned it was 2 different procs
22:52:11FromDiscord<exelotl> attaching the export marker to the importc'd proc was my mistake, it compiled fine after I removed that
23:00:00*xaltsc quit (Remote host closed the connection)
23:00:58*jmdaemon joined #nim
23:17:39FromDiscord<System64 ~ Flandre Scarlet> !eval echo sizeof(bool), ", ", sizeof(cbool)
23:17:40NimBotCompile failed: /usercode/in.nim(1, 33) Error: undeclared identifier: 'cbool'
23:17:46FromDiscord<System64 ~ Flandre Scarlet> ah alright
23:21:41*TechAspirer joined #nim
23:50:33*ltriant joined #nim
23:54:41NimEventerNew thread by Haoliang: Any particular reason on deprecating IndexError?, see https://forum.nim-lang.org/t/8978
23:54:57*ltriant quit (Ping timeout: 240 seconds)