<< 04-04-2022 >>

00:03:37FromDiscord<huantian> It'll only compile if a is a value between 0 and 1
00:06:07*tk quit (Quit: Well, this is unexpected.)
00:06:24FromDiscord<Alea> interesting
00:06:31*tk joined #nim
00:08:39FromDiscord<Elegantbeef> It also has runtime checks to ensure it's only 0..1
00:08:39FromDiscord<Elegantbeef> You can use subrange types everywhere so dont think it's just a procedure thing!
00:09:41FromDiscord<auxym> yeah was about to say it can also crash at run time: https://play.nim-lang.org/#ix=3Uee
00:10:02FromDiscord<auxym> unless you compile with `-d:danger`
00:10:17FromDiscord<Elegantbeef> Nice complex `1.5`
00:10:51FromDiscord<auxym> gotta trick the compile into thinking that the value isn't known at compile time 😄
00:11:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Uef
00:11:20FromDiscord<Elegantbeef> Nim doesnt do value narrowing
00:11:33FromDiscord<Elegantbeef> Subrange types only statically error if a literal or const is passed
00:11:53FromDiscord<auxym> `doThing(0.5 + 1)` was caught at compile time though
00:15:36FromDiscord<Elegantbeef> That's a constant
00:16:27FromDiscord<Elegantbeef> Just cause you write your constant `Tau / 2` doesnt mean it's not constant 😛
00:18:15*yiggityswaps joined #nim
00:24:33FromDiscord<auxym> yeah. but that's the story of how `var b = 0.5 +1` happened
00:41:50FromDiscord<dither> Sorry dumb question, I think Nim is great and I'm not sure if I'm thinking of things correctly but it seems great for maintaining C/C++ projects since it supports the backend. There's an old large C++ codebase and I want to slowly rewrite it in Nim while still being integrated with the rest of the codebase as I go, similar to how you would go about modernizing a javascript project with typescript (or Nimlang even). Am I correct to think Ni
00:42:22FromDiscord<Elegantbeef> It does have C++ interop and is one of the few languages that does so it seems fine
00:42:54FromDiscord<Elegantbeef> Making the bindings is the biggest thing you'll need to do
00:43:16FromDiscord<dither> that doesn't sound too bad, would I write the bindings in Nim?
00:43:29FromDiscord<dither> overall that's great to hear, I thought so too because of how it had C++ backend support but wanted to make sure I wasn't coming to the wrong conclusion
00:44:16FromDiscord<Elegantbeef> https://youtu.be/d2VRuZo2pdA?t=1968
00:44:20FromDiscord<Elegantbeef> Little talk about it if you want
00:45:06FromDiscord<dither> Thank you Elegantbeef, I appreciate it. Will watch it as soon as I can 🙏
00:46:27FromDiscord<dither> Another small dumb question, I was reading a lot into Crystal and Zig, they seem to be going for similar use cases as well tho what I appreciated about Nimlang is that it seems to not overpromise, Zig is trying to tackle an entire toolchain and Crystal still lacks windows support outside of WSL2. Hope Nim keeps growing in popularity
00:46:38FromDiscord<dither> (edit) "dumb question," => "aside,"
00:46:58FromDiscord<dither> (edit) "popularity" => "popularity, it seems mature enough for big projects"
00:53:19FromDiscord<Elegantbeef> Join the club 😛
00:53:45FromDiscord<demotomohiro> Nim can wrap template class/functions in C++
00:53:51FromDiscord<demotomohiro> https://forum.nim-lang.org/t/9007
00:54:13FromDiscord<Elegantbeef> The talk i linked goes overthat
01:10:00*vicfred joined #nim
01:17:31*neurocyte86144 joined #nim
01:19:37*neurocyte8614 quit (Ping timeout: 256 seconds)
01:19:37*neurocyte86144 is now known as neurocyte8614
02:06:07*Gustavo6046 quit (Quit: Gustavo6046)
02:06:18*Gustavo6046 joined #nim
02:09:34*Gustavo6046 quit (Client Quit)
02:09:46*Gustavo6046 joined #nim
02:10:38*rockcavera joined #nim
02:10:38*rockcavera quit (Changing host)
02:10:38*rockcavera joined #nim
02:43:07yiggityswapsAre the BigO notations of the the procs in the standard library anywhere? I usually check nim-lang.org/docs for the documentation but it doesn't seem like it has it anywhere...
02:44:28FromDiscord<ynfle> Which procs? Some have in the docs, some are quite obvious and some you can get by reading the source code
02:52:45*arkurious quit (Quit: Leaving)
03:07:19FromDiscord<Elegantbeef> Who whatns to make a bigopximator? 😛
03:07:21FromDiscord<Elegantbeef> wants to
03:07:39yiggityswapsRight now I'm not curious about one, just wanted to know haha
03:08:10FromDiscord<Elegantbeef> I dont think any mentions big O
03:08:24FromDiscord<Elegantbeef> I guess some do
03:12:11*yiggityswaps quit (Quit: Leaving)
03:13:17*Gustavo6046 quit (Quit: Gustavo6046)
03:13:21*yoyojambo joined #nim
03:49:29FromDiscord<aph> can i read with encoding with `FileStream.readStr`? it got me stuck for a while, not sure what i did wrong but the text i got is just weird
03:50:03FromDiscord<Elegantbeef> Strings in nim are binary streams
03:50:37FromDiscord<aph> hmm
03:50:51FromDiscord<Elegantbeef> What's the code?
03:50:57FromDiscord<Elegantbeef> And the file
03:51:17FromDiscord<aph> hang on
03:51:18FromDiscord<aph> :)
03:51:43FromDiscord<aph> da file https://media.discordapp.net/attachments/371759389889003532/960386155826782278/lumine.pmx
03:51:55FromDiscord<aph> sent a code paste, see https://play.nim-lang.org/#ix=3Uf1
03:52:08FromDiscord<aph> (edit) "https://play.nim-lang.org/#ix=3Uf1" => "https://play.nim-lang.org/#ix=3Uf2"
03:52:36FromDiscord<demotomohiro> That file contains a text not in unicode encoding?
03:52:41FromDiscord<Elegantbeef> I assume this file has non ascii text?
03:52:47FromDiscord<aph> yes
03:53:10FromDiscord<aph> it's in binary, but it also contains some text data in UTF8 or UTF16LE encoding
03:53:47FromDiscord<Elegantbeef> Well strings and streams are not unicode aware so you need to figure out if the string is unicode and if so figure out how much you need to read
03:54:03FromDiscord<demotomohiro> Nim's echo expects utf8 encoding.
03:54:17FromDiscord<Elegantbeef> I mean echo doesnt matter
03:54:20FromDiscord<aph> oh, i guess i need to convert it?
03:54:31FromDiscord<Elegantbeef> Nim's echo expects a string, it's whatever your terminal expects that's the issue
03:54:40FromDiscord<aph> In reply to @Elegantbeef "Nim's echo expects a": hmm
03:54:44FromDiscord<aph> time to switch os
03:54:47FromDiscord<aph> 😎
03:56:35FromDiscord<demotomohiro> On windows, Nim change console code page to 65001 and fail to print utf8 encoded Japanese text if I didnt set the font of console correclty.
03:57:29FromDiscord<Elegantbeef> Well you could also make your own `unicodestream` 😛
03:57:55FromDiscord<aph> oh i know why now. chinese characters contains 2 bytes
03:57:56FromDiscord<aph> hm
03:58:05FromDiscord<aph> In reply to @demotomohiro "On windows, Nim change": time to switch to linux ig
03:58:07FromDiscord<huantian> Well Inmean
03:58:13FromDiscord<huantian> What did you expect from utf16
03:58:26FromDiscord<aph> i was supposed to get `女主角` instead of `sY;N҉`. heh
03:58:29FromDiscord<huantian> 16 bits = 2 bytes 😛
03:58:37FromDiscord<aph> In reply to @huantian "16 bits = 2": :(
03:58:42FromDiscord<Elegantbeef> There is `widestr`
03:59:41FromDiscord<aph> sure will try
03:59:42FromDiscord<aph> ty
03:59:57FromDiscord<Elegantbeef> Though dont know if it'll help
04:00:12FromDiscord<aph> gotta try everything ¯\_(ツ)_/¯
04:00:23FromDiscord<aph> ~~or just ignore it, who cares about comments or model name~~
04:03:00FromDiscord<demotomohiro> On windows, if you want to echo non-utf8 charactors, compiling your code with `-d:nimDontSetUtf8CodePage` might work.
04:03:09FromDiscord<demotomohiro> https://github.com/nim-lang/Nim/blob/c3f03cfa5dfa2ca47f8e4cf99bbcdbf5a7d16eda/lib/std/syncio.nim#L856
04:03:43FromDiscord<huantian> Why is windows so weird with utf8 honestly
04:03:55FromDiscord<huantian> Probably backwards compatibly baggage ig
04:03:58FromDiscord<aph> In reply to @demotomohiro "On windows, if you": heh, didn't work :(
04:04:15FromDiscord<aph> trying to use wsl if it makes a difference, installing nim
04:04:19FromDiscord<huantian> I feel bad for people who have to use cmd all the time
04:04:28FromDiscord<huantian> At least Windows Terminal exists
04:05:13FromDiscord<aph> In reply to @aph "trying to use wsl": nope it didn't! time to fix the code!
04:05:21FromDiscord<huantian> Maybe there’s something in std/unicode for this
04:05:25FromDiscord<aph> In reply to @huantian "I feel bad for": ~~use powershell smh~~
04:05:40FromDiscord<huantian> Also shouldn’t UTF-8 account for variable width chars
04:05:44FromDiscord<huantian> Like isn’t that the point
04:06:08FromDiscord<aph> ¯\_(ツ)_/¯
04:07:54FromDiscord<aph> hurray `encodings` worked
04:07:56FromDiscord<aph> thanks
04:16:03FromDiscord<Elegantbeef> you mean windows 😛↵(@huantian)
04:17:49FromDiscord<spoon> up + enter > interacting with ui
04:18:13FromDiscord<Elegantbeef> How'd you know my build process
04:18:31FromDiscord<Elegantbeef> How goes the nimscripter stuff anyway?
04:19:12FromDiscord<spoon> well i got it to run and then i had to leave
04:19:41FromDiscord<spoon> but now i have to figure out how to get it to fit into my object instead of a proc so i can flatty + supersnappy my world object
04:20:08FromDiscord<Elegantbeef> What do you mean?
04:20:32FromDiscord<spoon> remember how i was using an onHit proc in my game and it took an enemy as a parameter?
04:20:47FromDiscord<Elegantbeef> Sure
04:21:36FromDiscord<spoon> i'm trying to switch it to nimscript so i can serialize special objects
04:21:57FromDiscord<Elegantbeef> Well the bridge presently does everything by copies
04:23:28FromDiscord<spoon> so would `onHit: NimScriptFile"proc(e: enemy)"` work out do you think?
04:24:08FromDiscord<Elegantbeef> I dont see why it wouldnt, but you then need to make an intepreter for each
04:24:28FromDiscord<spoon> hmmm
04:25:20FromDiscord<spoon> could just be stored as a string, too
04:25:32FromDiscord<spoon> can i use options to make the enemy parameter optional?
04:25:48FromDiscord<Elegantbeef> If you ship the options module with your stdlib
04:27:17FromDiscord<spoon> sure, ship it with everything
04:28:07FromDiscord<Elegantbeef> Do you intend on dynamically scripting the actions?
04:31:01FromDiscord<Elegantbeef> Cause if not what you're doing is pretty silly
04:34:00FromDiscord<spoon> i'm not very familiar with embedding, so i'm probably reorganizing most of it later
04:34:13FromDiscord<spoon> or embedded scripting languages rather
04:34:21FromDiscord<Elegantbeef> Is this purely for seralizing?
04:35:24FromDiscord<spoon> no, the object originally had a `proc` field for modding/extension purposes, but you can't serialize a proc, at least not with flatty
04:35:42FromDiscord<Elegantbeef> I mean you can serialise it relatively easily
04:35:52FromDiscord<Elegantbeef> Assuming it's compiled in the binary
04:37:19FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/wX9
04:37:53FromDiscord<spoon> well having programmable objects is one of my goals
04:38:02FromDiscord<Elegantbeef> Well then i guess carry on
04:38:28FromDiscord<Elegantbeef> Sounded like this was only a serialisation issue prior
04:42:23FromDiscord<spoon> yeah, just meant procs don't serialize
04:44:30FromDiscord<spoon> guess it'll be easier now to just have all the potential functions in one nimscriptfile object
04:47:24FromDiscord<spoon> `isNil` doesn't work for it though
04:47:26FromDiscord<spoon> hmm
04:47:41FromDiscord<Elegantbeef> Fow what?
04:48:13FromDiscord<spoon> for `not isNil specialWeapon(ply.handEquip).onHit`
04:48:46FromDiscord<Elegantbeef> You'd have to load the interpreter up, and depending on how you set up nimscripter that check is moot
04:49:22FromDiscord<Elegantbeef> I'd suggest to just go with the table approach until later
04:50:17FromDiscord<spoon> so would i have to boot up a new interpreter each time the attack proc runs then?
04:50:24FromDiscord<Elegantbeef> no
04:50:34FromDiscord<Elegantbeef> You boot up the interpreter on changes
04:50:39FromDiscord<Elegantbeef> And then just call t he procedure
04:50:51FromDiscord<Elegantbeef> you can ensure the procedure exists statically
04:51:29FromDiscord<spoon> that's gonna be rough if the enemy can hold scripted weapons too
04:51:31FromDiscord<spoon> oh well
04:51:41FromDiscord<Elegantbeef> Well perhaps this isnt the library to use for you
04:52:49*yoyojambo quit (Quit: Leaving)
04:53:20FromDiscord<spoon> dunno, maybe can figure something out unless there's already a better fit
04:53:28FromDiscord<Elegantbeef> No clue
04:53:38FromDiscord<Elegantbeef> I'd personally use dynamic libraries or WASM
04:53:59FromDiscord<spoon> wasm?
04:54:06FromDiscord<spoon> how'd that work?
04:54:30FromDiscord<spoon> i guess if i were rendering with webkit
04:54:36FromDiscord<Elegantbeef> No
04:54:57FromDiscord<Elegantbeef> You can use the WASM runtime as a plugin system for slightly safer native code libraries
04:55:13FromDiscord<spoon> hm.
04:56:33FromDiscord<spoon> i'll have to look into how enu does its stuff
04:57:16FromDiscord<spoon> but haven't heard of using wasm
04:57:23FromDiscord<Elegantbeef> WASM/dynamic libraries give a language agnostic API for scripting
04:57:36FromDiscord<Elegantbeef> WASM would mostly be for sandboxxing
04:57:49FromDiscord<Elegantbeef> Dont want people to distribute malware and that would give you that
04:59:47FromDiscord<spoon> yea, being able to edit on the fly is important too so wasm doesn't sound ideal for that
05:00:07FromDiscord<spoon> if nimscript just doesn't work right now there's also lua, i like their hook system
05:00:17FromDiscord<huantian> Why do you need to edit your modded files on the fly?
05:01:18FromDiscord<spoon> In reply to @huantian "Why do you need": current game is also a testing ground for a future ss13-like where i'm hoping gms will be able to quickly prototype and make custom scripted weapons and such
05:01:36FromDiscord<spoon> but maybe i'll add drones in the current thing i'm making
05:01:59FromDiscord<Elegantbeef> Why cant you edit on the fly with WASM?
05:02:10FromDiscord<spoon> doesn't wasm need to be compiled for some lang?
05:02:20FromDiscord<spoon> from
05:02:23FromDiscord<Elegantbeef> Sure nad it'd be relatively small packages
05:02:23*rockcavera quit (Remote host closed the connection)
05:03:00FromDiscord<Elegantbeef> Like yes you need a compiler tool chain, but they'd be small packages so the code would be generated very quickly
05:03:28FromDiscord<spoon> i've actually done on the fly editing with luapad and gmod from within the actual game before before so i know it works
05:03:43FromDiscord<spoon> if i were to implement something else it'd likely be that
05:04:34FromDiscord<Elegantbeef> We have different views so dont let me dissuade you 😛
05:05:15FromDiscord<spoon> meh, relying on a compiler toolchain and quick prototyping just don't sound like they go together for me
05:05:26FromDiscord<Solitude> i like your views more, beef
05:06:01FromDiscord<Elegantbeef> Well we're talking about small files, yes there is a bit of preamble for setup, but in the end it's more extensible
05:06:30FromDiscord<Elegantbeef> Lol why solitude
05:06:32FromDiscord<spoon> if i were making something where mods were loaded on startup and could maybe be refreshed, wasm would probably be a good choice
05:06:38FromDiscord<spoon> just not for my use case
05:07:03FromDiscord<spoon> 'cause giving tons of options for languages sounds cool
05:08:13FromDiscord<Elegantbeef> Also solitude i see you're using owlkettle aswell, am i missing how to force focus on a widget or is it just non existent presently?
05:18:14FromDiscord<Solitude> i see that shitload of stuff is missing and owlkettle's approach is a mistake
05:18:25FromDiscord<Solitude> he really shoud've built it on top of gintro
05:19:04FromDiscord<Elegantbeef> yea i know nothing about gtk, so i just see the purdy declarative API
05:19:11FromDiscord<huantian> In reply to @spoon "that's gonna be rough": Wait why does reloading on file changes not work with enemy weapons? Just curious
05:19:38FromDiscord<Elegantbeef> Each weapon would need it's own interpreter i think is the issue
05:19:54*slowButPresent quit (Quit: leaving)
05:43:28FromDiscord<morgan> so i added an input called shared to a proc, and it got highlighted different and inspect tokens or whatever says invalid keyword, but it runs with no errors/warnings and has no error/warning squiggles
05:43:47FromDiscord<morgan> but it's not in the list of reserved keywords
05:44:00FromDiscord<Elegantbeef> Extension sounds wrong
05:44:05FromDiscord<morgan> ok
05:45:06FromDiscord<morgan> https://media.discordapp.net/attachments/371759389889003532/960414690532532254/unknown.png
05:45:27FromDiscord<Elegantbeef> oh wait `shared`
05:46:23FromDiscord<morgan> the manual only has one instance of `shared` and it's not related
05:47:11FromDiscord<Elegantbeef> Ah i was thinking of isolated
05:49:14FromDiscord<morgan> only interface and out are in the list of reserved keywords so i assume that's to warn people when they type one of those that it's not a keyword that's going to work, which seems like not highlighting it as a keyword would be better for
05:59:36*rockcavera joined #nim
05:59:37*rockcavera quit (Changing host)
05:59:37*rockcavera joined #nim
06:03:07*rockcavera quit (Remote host closed the connection)
06:39:27*acidsys quit (*.net *.split)
06:39:27*systemdsucks quit (*.net *.split)
06:39:27*adium quit (*.net *.split)
06:39:27*nisstyre quit (*.net *.split)
06:39:27*madprops quit (*.net *.split)
06:39:28*lain quit (*.net *.split)
06:39:28*dv^_^ quit (*.net *.split)
06:39:39*madprops joined #nim
06:40:00*nisstyre joined #nim
06:40:05*madprops quit (Changing host)
06:40:05*madprops joined #nim
06:40:23*lain joined #nim
06:41:23*adium joined #nim
06:41:33FromDiscord<creikey> Anybody care to review a small amount of nim networking code? I'm meaning for it to be an example in using std/net https://github.com/creikey/nim-net-chat-example
06:41:59*acidsys joined #nim
06:43:11*cornfeedhobo quit (*.net *.split)
06:43:11*ecs quit (*.net *.split)
06:43:19*ecs joined #nim
06:44:42*systemdsucks joined #nim
06:46:08*nisstyre quit (Quit: WeeChat 3.4)
06:46:17*nisstyre joined #nim
06:49:51*cornfeedhobo joined #nim
06:50:04FromDiscord<Attachment Aditya> hey!
06:50:14FromDiscord<Attachment Aditya> where can i like ask questions?
06:50:27FromDiscord<Elegantbeef> You just asked one so hopefully here
06:50:35FromDiscord<Attachment Aditya> hmm
06:50:48FromDiscord<Attachment Aditya> i mean i want to convert my python project to nim
06:50:59FromDiscord<Elegantbeef> Ask questions her
06:51:01FromDiscord<Elegantbeef> here\
06:53:24FromDiscord<Attachment Aditya> i want to convert my big python project to a big nim project... how do i convert it? is there a cheatsheet that can help me easily? are there converters out there? what do i do to convert 1895 lines of code of python to nim? why is it so hard? https://media.discordapp.net/attachments/371759389889003532/960431876340854784/unknown.png
06:53:48FromDiscord<Elegantbeef> It's hard cause python doesnt have type annotations
06:53:56FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers
06:54:20FromDiscord<Elegantbeef> There arent any converters that work on unannotated python
06:54:41*ltriant quit (Ping timeout: 246 seconds)
06:55:01*dv^_^ joined #nim
06:55:17FromDiscord<Attachment Aditya> In reply to @Elegantbeef "It's hard cause python": it has actually
06:55:25FromDiscord<Attachment Aditya> but that isn't compulsory to use
06:55:36FromDiscord<Elegantbeef> @creikey\: https://github.com/creikey/nim-net-chat-example/blob/main/src/server.nim#L47-L54 is a bit odd why not just iterate backwards
06:55:36FromDiscord<Elegantbeef> Yes i know it's optional
06:55:37FromDiscord<Attachment Aditya> the annotations are just like nim too...
06:55:40FromDiscord<Attachment Aditya> almost...
06:55:49FromDiscord<Elegantbeef> I know typings exist
06:56:12FromDiscord<xflywind> there are some old transpiler https://github.com/adsharma/py2many
06:56:23FromDiscord<Attachment Aditya> so is that cheatsheet you sent in the first link?
06:56:32FromDiscord<Attachment Aditya> In reply to @flywind "there are some old": oh, thanks.
06:56:39FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/zf5
06:56:59FromDiscord<Elegantbeef> If you have type annotations a transpiler may work
06:57:10FromDiscord<Elegantbeef> You will still have to touch it up and make it idiomatic though
06:57:23FromDiscord<Elegantbeef> Just cause nim has significant whitespace doesnt mean it's like python
06:58:12FromDiscord<Attachment Aditya> ik, but its still ok for me to use nim, the c experience was horrible to me...
06:58:22*PMunch joined #nim
07:01:13FromDiscord<Elegantbeef> Also @creikey https://github.com/creikey/nim-net-chat-example/blob/main/src/common.nim#L6-L13↵you there is https://nim-lang.org/docs/net.html#recv%2CSocket%2Cpointer%2Cint
07:02:20FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/k3z
07:02:32FromDiscord<Elegantbeef> And perhaps ensure it's LE but dont recall if that's needed
07:03:09FromDiscord<Elegantbeef> Same with your `sendData`
07:04:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UfP
07:04:16FromDiscord<Elegantbeef> guess you want `data.len.uint32`
07:07:14FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3UfQ
07:09:08FromDiscord<Elegantbeef> Well that looks like it aside from "import system modules with `std/` prefix and group them in an array like `std/[net, common]`
07:13:52*gsalazar joined #nim
07:23:17*ltriant joined #nim
07:57:11FromDiscord<aph> `enum` vs `object`, which one should i use
07:57:26PMunchIt totally depends on what you're doing
07:57:31FromDiscord<Elegantbeef> Do you need values or a data object
07:57:34PMunchThey're not comparable in any way
07:57:55FromDiscord<Elegantbeef> They are if you squint
07:58:07FromDiscord<Elegantbeef> `type A = object` can look a lot like `type A = enum`
07:58:29PMunchEh, fair enough
07:58:30FromDiscord<aph> In reply to @Elegantbeef "Do you need values": ehhh im not sure what i want
07:58:33FromDiscord<aph> lol
07:58:43FromDiscord<Elegantbeef> Well what are you doing
07:58:48FromDiscord<Elegantbeef> There has to be a reason to ask this
07:58:54FromDiscord<Elegantbeef> It's like asking bool or float
07:58:55FromDiscord<aph> In reply to @Elegantbeef "Well what are you": storing info of file header
07:59:05FromDiscord<aph> the type is the same everytime
07:59:07FromDiscord<Elegantbeef> So then a object
07:59:10FromDiscord<aph> okk
07:59:12FromDiscord<aph> tyy
07:59:32FromDiscord<Elegantbeef> Oh have you used Java/Rust enums?
07:59:50FromDiscord<aph> i have never used enums
08:00:06FromDiscord<Elegantbeef> In Nim enums are just named integers, with optional string names
08:00:20FromDiscord<aph> ohh
08:00:22PMunchYou want to use enums instead of a lot of constant variables
08:00:23FromDiscord<Elegantbeef> You use them for flags, states and anything that's a fixed set of named values
08:00:52FromDiscord<aph> ohh
08:00:58FromDiscord<aph> i've been using `const` so long
08:00:59FromDiscord<aph> lol
08:01:21FromDiscord<Elegantbeef> Eh it's fine, depends what you're holding onto
08:01:47FromDiscord<Elegantbeef> In a 4 direction game you might use an enum for `North, East, South, West`
08:02:14FromDiscord<aph> heh i'm not fixing my dirty codebase
08:02:17FromDiscord<Elegantbeef> Also if you're passing a group of bools you can use enums instead
08:02:34FromDiscord<aph> will keep in note!
08:02:57FromDiscord<Elegantbeef> `proc doThing(doItFast, doItWeird, doItFunny, doitDumb: bool)`
08:03:45FromDiscord<aph> i didn't know that such thing exists
08:04:08FromDiscord<aph> i'm doing `doItFast: bool, doItWeird: bool, doItFunny: bool, doItDumb: bool`
08:04:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ug0
08:04:25FromDiscord<aph> ohh, that's cool
08:04:31FromDiscord<Elegantbeef> then you can do `doThing({diFast, d iDumb}`
08:07:51FromDiscord<aph> wait, what happens to `diFunny` or `diWeird`
08:09:10FromDiscord<Rika> Not set
08:10:03FromDiscord<aph> hmm, like `void`?
08:10:19FromDiscord<aph> (edit) "`void`?" => "`nil`?"
08:14:01FromDiscord<Rika> no
08:14:03FromDiscord<Rika> like `false`
08:14:27FromDiscord<Rika> `doThing(true, false, false, true)`
08:35:27FromDiscord<aph> ohh, ty
08:37:51FromDiscord<Elegantbeef> Its a more clear and more friendly way to write passing of flags
08:56:42*jmdaemon quit (Ping timeout: 260 seconds)
09:03:40*adium quit (Ping timeout: 272 seconds)
09:15:02*ltriant quit (Ping timeout: 246 seconds)
09:25:34*ltriant joined #nim
10:02:13FromDiscord<exelotl> yooo nice to see Generic's GC emulator in the monthly post
10:08:49FromDiscord<ajusa> Yeah the macro writeup was super interesting
10:12:54*adium joined #nim
10:15:29PMunchI was actually thinking of maybe doing a podcast for these monthly posts
10:19:28FromDiscord<Rika> what kind of podcast, a live one?
10:19:39FromDiscord<Rika> or those which are recorded and then edited?
10:21:30PMunchThe thought was an edited one
10:22:22PMunchFind a "guest" possibly one of the ones who have a library in the list, and then talk about the different entries, and possibly other stuff that's been going on with Nim for the past month
10:31:17FromDiscord<ajusa> Personally I prefer writeups, but hey if there's demand a podcast sounds cool
11:49:40*Gustavo6046 joined #nim
11:56:20*jjido joined #nim
12:06:02FromDiscord<mratsim> podcast for programming? Do they stay high-level, I can't fathom how you can discuss concrete code without showing it.
12:10:56PMunchOh yeah, it would be a totally high-level thing
12:11:12FromDiscord<Tanguy> You can spell it
12:11:34PMunchMore talking about the new projects people write, the new libraries, etc.
12:12:06FromDiscord<Tanguy> (edit) "spell" => "read" | "readit ... " added "aloud"
12:12:29PMunchI'm not going to be sat there going "indentation level 4, for i in x, dot, keys, colon, newline, indentation level 5"
12:14:42FromDiscord<Tanguy> Just do it ASMR style
12:17:08FromDiscord<Phil> Brain storm a concept to elegantly and beautifully make something that is as flexible and as extensible as Djangos object oriented views, I would love to steal whatever is drawn up, thank
12:17:33FromDiscord<Phil> (edit) "views," => "views in one of the podcast episodes,"
12:25:49FromDiscord<mratsim> > object oriented↵↵You lost me there.
12:31:09*vicecea quit (Remote host closed the connection)
12:31:38*vicecea joined #nim
12:39:48FromDiscord<riplooke> Does Nim have a Wayland api
12:42:27FromDiscord<Solitude> https://github.com/yglukhov/wayland here is something, you figure out how it works
12:43:08FromDiscord<riplooke> Ok
12:43:53FromDiscord<riplooke> I like the ||lack of||documentation for it 😂
12:43:59FromDiscord<riplooke> (edit) "of||documentation" => "of|| documentation"
12:50:53PMunch@Phil, I have an idea for a type oriented web-api
12:51:17FromDiscord<Phil> In reply to @mratsim "> object oriented ": Doesn't have to be oo, preferably isn't, just want that level of extensibility
12:51:22PMunchEssentially treating routes as procedures, with a strict typed set of arguments and return type
12:52:55FromDiscord<Phil> Yeh but does it provide a default implementation in which I can change around individual aspects?
13:02:40FromDiscord<Phil> Though I think... Hmmm you could solve this with a proc that accepts a ton of procs as parameters that contains default arguments
13:12:51*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:12:54PMunchA default implementation?
13:12:58PMunchNot sure what you mean
13:18:03FromDiscord<riplooke> Can I use gnu make (and a makefile) to compile nim
13:18:27FromDiscord<Rika> Sure, why not
13:18:53FromDiscord<Rika> A makefile is almost basically a shell script anyway
13:19:14PMunchYeah, I've used Makefiles a lot for building Nim
13:20:24*slowButPresent joined #nim
13:28:30arkanoidI need an idea to implement a disk based concurrent queue. A producer fills the queue, a consumer empty it and pushes to the network. If push fails, data must persist to the queue until success (or out of space)
13:28:57arkanoidIs there an existing solution to reliably implement this?
13:29:39*arkurious joined #nim
13:30:17arkanoidI was thinking about using sqlite but we have multiple writers here so its not the best thing
13:32:31FromDiscord<Rika> Is there a priority to performance?
13:34:30arkanoidRika, no, the most important thing is never lose data
13:35:04PMuncharkanoid, I've recently done something similar
13:35:14PMunchBasically what I ended up with was a simple journaling system
13:35:18FromDiscord<Rika> I was going to suggest using directories (per writer) and files (per message) and monotonic counters and stuff
13:35:45FromDiscord<Rika> Yeah that works too, append only log
13:36:37PMunchMy program is essentially a relay, it receives messages on HTTP, and sends them on with a proprietary protocol
13:36:41arkanoidRika the problem with files is the amount of them. I have very small buffers to queue, if I produce a file per buffer I'd ed up with a very difficult situation to list files
13:37:36arkanoidPMunch: why you think Journaling is required?
13:37:51FromDiscord<Rika> That’s for performance I believe
13:38:03*rockcavera joined #nim
13:38:03*rockcavera quit (Changing host)
13:38:03*rockcavera joined #nim
13:38:04arkanoidI mean, I just need to assure that the network push is successful, then I can delete the entry
13:38:12PMunchTo ensure that if my program crashes every message that has been received and returned 200 OK will eventually be ent
13:38:17FromDiscord<Rika> The quicker you can write something the less likely that if you crash you’ll lose something haha
13:38:35PMunchThey are written into the journal but only read from the journal on start-up
13:39:10FromDiscord<Rika> You could probably also make a “clean up” stage that does deletes from the log, if you’re sure it’s sent already
13:39:44PMunchSo when I receive a message I write a "new message" flag and the message to a journal file, if I've written more than 100 entries to that journal file I create a new one. Then I put it into some internal data-structures (and keeping track of which journal it lives in). Then when I manage to pass it on I write a "message sent flag" and the GUID of the task. If this was the 100th message completed in this journal file I delete the journal file.
13:40:47PMunchThis means that if I have accepted a message and then crash (or the computer is shut of or whatever) my program will read the journal during startup, figure out which tasks where accepted but never completed, and start working through them.
13:41:11PMunchI actually considered writing a small Nim library for this
13:41:42FromDiscord<Rika> I mean it’s just technically a structured log file
13:41:54PMunchWell yes, that's what a journal is
13:49:24FromDiscord<Zoom> My knee-jerk reaction would be to try to utilize a loop device with some journaling fs to store the messages and unload all the hard work on the os↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:52:19arkanoidPMunch: what's the advantage of your solution over sqlite?
13:52:50arkanoidSqlite has journaling, but also write ahead log that's even more resilient
13:53:10arkanoidAnd it supports multiple writers thanks to locking. And is also very battle tested
13:53:38FromDiscord<Rika> I thought you didn’t want to use that?
13:54:49arkanoidI said that multiple writers to same sqlite is not the best thing, not that I don't want to use it
13:54:57PMuncharkanoid, I used sqlite at first, but it was too slow
13:55:02PMunchAnd it kept locking up
13:55:37arkanoidPMunch: ok
13:55:43PMunchTo be fair I used it fully as a database, with all my logic going through sqlite
13:56:20PMunchMy new system basically just uses journaling, and then it does all the sqlite/database stuff with other structures in memory
13:57:16PMunchBut since I didn't need any of the relational stuff or other fancy features sqlite offers it was a bit overkill and as I said didn't meet my performance criteria
14:46:28*v9fk joined #nim
15:09:52*v9fk quit (Quit: Goodbye!)
15:23:32PMunchHmm, is there a way I can check if a value will be possible to put in a const block?
15:24:30PMunchSomething like `when isCompileTime`
15:32:44FromDiscord<Yardanico> I guess one way you can do it is by using `compiles` :P
15:33:03PMunchI tried, but it doesn't like `when compiles(const x = something)`
15:33:17PMunchError: expression expected, but found 'keyword const'
15:34:46FromDiscord<Yardanico> ah right, you need to make it an expression
15:35:15FromDiscord<Yardanico> you can just add () around it to make it an statement list expression
15:35:22FromDiscord<Yardanico> `when compiles((const x = stuff)):`
15:38:08PMunchHmm, that seems to work
15:38:18PMunchBut now I get a -1 not in 0..0 error
15:38:24PMunchBut it doesn't say where it comes from..
15:38:29PMunchI guess it might be the compiler
15:43:40FromDiscord<huantian> In reply to @Yardanico "you can just add": Wait you can do that? I just used a template lmao
15:44:53FromDiscord<gerwy> quick question↵i know its possible with tuples i think, that i can access its stuff with index like `[0]`↵but can i do the same for objects? How would i access the field if i don't know which name its gonna have?
15:45:11FromDiscord<gerwy> other way than using iterators of course
15:45:41FromDiscord<Rika> no
15:45:59FromDiscord<gerwy> :C
15:46:32FromDiscord<Vindaar> for what unholy purpose would you not know the field names of the object?
15:46:54FromDiscord<Vindaar> you _could_ write a macro for that. but... I'm not sure that's the best idea
15:47:14FromDiscord<Rika> well you could
15:47:15FromDiscord<gerwy> tagged union
15:47:20FromDiscord<Rika> i dont think its too bad with a ma
15:47:29FromDiscord<Rika> macro
15:47:49FromDiscord<Rika> In reply to @Life Sucks "tagged union": what?
15:49:51FromDiscord<gerwy> fieldPairs work
15:50:05FromDiscord<gerwy> and its in two lines of code so ://
15:50:26FromDiscord<gerwy> In reply to @Rika "what?": i have `Value` object that uses tagged union for expression evaluation
15:50:33FromDiscord<Yardanico> any reason you're not using object variants instead?
15:50:40FromDiscord<gerwy> In reply to @Yardanico "any reason you're not": thats exactly what i do
15:50:44FromDiscord<Yardanico> ??
15:50:46FromDiscord<gerwy> i forgor how its called in nim 💀
15:50:59FromDiscord<gerwy> you mean `case .. of` ?
15:51:01FromDiscord<Yardanico> yes
15:51:05FromDiscord<gerwy> (edit) "?" => " in object declaration?"
15:51:08FromDiscord<gerwy> (edit) "declaration?" => "definition?"
15:51:12FromDiscord<gerwy> yeah thats what i do
15:51:17FromDiscord<Rika> field pairs works with object variants?
15:51:48FromDiscord<Yardanico> i don't think so?
15:51:49FromDiscord<Yardanico> https://github.com/nim-lang/RFCs/issues/367
15:51:51FromDiscord<Yardanico> is open
15:53:14PMunchHuh, apparently you can do `when is static`, that's handy
15:54:04FromDiscord<Yardanico> huh, but won't that only apply to variables that are `const` and won't work for expressions that can be computed at compile-time?
15:54:09FromDiscord<Yardanico> ah nvm, apparently it works for stuff like 1 + 5 too
15:54:13FromDiscord<Yardanico> interesting
15:58:42FromDiscord<gerwy> In reply to @Rika "field pairs works with": works for me idk
15:58:50FromDiscord<gerwy> In reply to @PMunch "Huh, apparently you can": oh yeah, i use when :3
15:58:57FromDiscord<gerwy> (edit) "when" => "`when`" | "`when`:3 ... " added "maybe thats why"
15:59:10PMunchHuh?
15:59:23PMunchI was talking about an issue I had
16:00:33FromDiscord<gerwy> oh sorry
16:00:44PMunchArgh, this unhandled exception is really annoying..
16:00:47FromDiscord<gerwy> i was talking about fields with object variants
16:01:05FromDiscord<Yardanico> @PMunch if you installed the compiler with build_all you also should have nim_temp
16:01:13PMunchnim_temp?
16:01:14FromDiscord<Yardanico> or was it nim_debug
16:01:24FromDiscord<Yardanico> nim-dbg
16:01:26FromDiscord<Yardanico> arghh
16:01:28FromDiscord<Yardanico> nim_dbg
16:01:31FromDiscord<Yardanico> debug build of the compiler
16:01:35FromDiscord<Yardanico> with stacktrace and all that stuff on
16:01:40FromDiscord<Yardanico> so at least you'll know where it crashes
16:02:05FromDiscord<Yardanico> actually it's built by `koch tools`
16:07:27PMunchAh right, that helped
16:07:45PMunchSo apparently this crashes the compiler: https://play.nim-lang.org/#ix=3Uil
16:11:18FromDiscord<Phil> In reply to @PMunch "A default implementation?": I was mentally again at fully generic handler-procs (as prologue calls them) aka controller procs.↵If the framework is very opinionated, you could provide an entire handler that is associated with the route and that can be adjusted by passing custom procs as parameter for fetching a given entry from the database, for checking permissions a user may have on that entry etc.
16:12:37FromDiscord<Phil> E.g. if the request is "put", then demand that there must be an ID-param or a custom-provided "fetch entry from database" proc and the default handler provided will automatically be for carrying out an update of sorts, so it'll check for update permissions and execute the correct SQL for that for you and and and
16:31:58*nixpica_ joined #nim
16:31:58*nixpica joined #nim
16:32:11*nixpica quit (Client Quit)
16:34:54*noxnivi joined #nim
16:34:58*nixpica_ quit (Client Quit)
17:04:56*noxnivi quit (Quit: Leaving)
17:06:44*jjido joined #nim
17:12:00FromDiscord<salt> i've seen this hack of mimicking oo with closures in python, maybe you can do something like that in nim, i'd have to look for it
17:15:20FromDiscord<salt> this is pretty old stuff: https://code.activestate.com/recipes/578091/ -- am not sure how one can use it with nim
17:17:00FromDiscord<Rika> streams in the nim stdlib uses this "kind of oop"
17:19:07FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UiF
17:21:43FromDiscord<salt> that's interesting
17:22:59FromDiscord<Phil> The end result doesn't look.... great but, well, functional I guess
17:23:33FromDiscord<Phil> `createReadHandler[ReadDiaryEntryParams, DiaryEntryRead, DiaryEntrySerializable](getDiaryEntry, checkReadPermission, serializeDiaryEntryRead)`
17:27:36FromDiscord<Phil> Fun fact, trying to provide default values for the generic parameters of generic procs is a terrible idea
17:27:43FromDiscord<Phil> (edit) removed "the"
17:28:27FromDiscord<Phil> I did not realize it at the time, but that essentially locks your typing down again, because now everything you provide instead of the default must match the type-signature of your default value again
17:29:05FromDiscord<gerwy> so umm, i kinda have no idea how to make macros in nim heh
17:29:22FromDiscord<Phil> That makes two of us, what are you trying to do? Maybe you can solve it with generics or templates
17:29:45FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3UiG
17:30:14FromDiscord<Phil> Is there a specific reason why you want to express this as a macro when you can express it in normal syntax?
17:30:19FromDiscord<gerwy> basically, its what i talked about earlier when getting second field in object variant
17:30:37FromDiscord<gerwy> In reply to @Isofruit "Is there a specific": the point is that i can't lol
17:31:12FromDiscord<Phil> I mean, the only thing that changes is what type "arg" is, right?
17:31:19FromDiscord<gerwy> yeah but
17:31:37FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3UiH
17:32:05FromDiscord<Phil> I might be missing this if you tried it already. Would a generic work instead?
17:32:06FromDiscord<gerwy> (edit) "https://play.nim-lang.org/#ix=3UiH" => "https://play.nim-lang.org/#ix=3UiI"
17:32:46FromDiscord<gerwy> idk, wait actually i should try to compile it because it just assume won't work from lsp showing error but it might be wrong
17:33:06FromDiscord<Phil> Ohhh wait, you don't know what type it'll spit out at the end do you
17:33:20FromDiscord<gerwy> nope it tells me `type mismatch: got <NimNode>`
17:34:17FromDiscord<Phil> More as in, you don't know the data-type of the first field in `arg` that is not called "typ", correct?↵Could be string, int, whatever
17:36:02FromDiscord<gerwy> i know the first field, its gonna be enum of what type the value is↵i just can't get second field since they have different names
17:36:28FromDiscord<gerwy> In reply to @Isofruit "More as in, you": object arg, has field `typ` which is enum and some field of value that has whatever the type
17:39:44FromDiscord<Phil> Could you give me your "Value" type definition?
17:40:01FromDiscord<Phil> Playing around a bit, I'm fairly sure you don't need a macro, a generic should do with this
17:41:09*vicfred quit (Quit: Leaving)
17:41:56FromDiscord<Rika> yikes, im wondering if this is way too long of an import path for a module https://media.discordapp.net/attachments/371759389889003532/960595084804517888/unknown.png
17:42:08FromDiscord<ShalokShalom> https://nim-lang.github.io/Nim/manual_experimental.html#void-type↵↵What is the difference between void and auto?
17:42:28FromDiscord<Rika> void means no return type, at all
17:42:42FromDiscord<Rika> auto means "please infer what the type should be for me, compiler"
17:42:48FromDiscord<Rika> at least to my understanding, that is
17:43:00FromDiscord<Phil> In reply to @Life Sucks "object arg, has field": Nevermind, worked it out
17:43:05FromDiscord<ShalokShalom> Thanks
17:43:17FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UiL
17:43:18FromDiscord<ShalokShalom> Somebody told me, that auto means also 'any type'
17:43:46FromDiscord<Rika> technically, yeah
17:44:09FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3UiN
17:44:18FromDiscord<Rika> you can pass any type to the proc, and expect it to not error out because of a type mismatch at the proc signature
17:44:27FromDiscord<Rika> it can still type mismatch in the body, though
17:44:30FromDiscord<Phil> In reply to @Life Sucks "hmm looks cool i": "R" is a generic type, it's a placeholder for "Whatever the programmer defines is R"
17:44:41FromDiscord<ShalokShalom> That sounds confusing
17:44:48FromDiscord<Phil> That's why there's the `[]` in front of the proc
17:45:13FromDiscord<ShalokShalom> So it is essentially NOT any type
17:45:16FromDiscord<ShalokShalom> Just in theory
17:45:17FromDiscord<Phil> So you define what types `T` and `R` in this particular usage of `get_val` represent
17:45:19FromDiscord<Rika> im not sure what you mean
17:45:23FromDiscord<ShalokShalom> And that theory doesnt matter
17:45:27FromDiscord<gerwy> oh hmm, well that makes sense, but what if i don't know its type?
17:45:30FromDiscord<Phil> I think shalok is not talking about my generic stuff
17:45:30FromDiscord<ShalokShalom> Well, I try to understand the difference
17:45:31FromDiscord<Rika> ah yeah it would still error on compile time if types dont match
17:45:34FromDiscord<Rika> somewhere in the body
17:45:44FromDiscord<ShalokShalom> yeah, thats what I mean
17:45:47FromDiscord<gerwy> do i really need to have few if's just to get that thing?
17:46:04FromDiscord<gerwy> i can't do like `typeof` since i can't reach second field without knowing its name
17:46:07FromDiscord<ShalokShalom> So the fact that it doesnt error in the type declaration is completely irrelevant
17:46:15FromDiscord<Rika> it's equivalent to using an explicit generic with no restriction, i believe
17:46:20FromDiscord<Phil> In reply to @Life Sucks "oh hmm, well that": If you don't know the type, that means you have several options for T again, at which point the proc that uses this proc likely should also be a generic
17:46:37FromDiscord<gerwy> hmm okay i will give it a try maybe
17:46:45FromDiscord<Rika> so `proc p[T](a: T)` and `proc p(a: auto)` i believe are similar or the same
17:47:37FromDiscord<gerwy> but im also thinking↵macro in nim can get properties of what im giving to it right?↵can't it just like ↵`echo get_value(p)` and its gonna return `p.int_value` if its int or `p.float_value` if its float?
17:47:40*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
17:47:49FromDiscord<gerwy> just return the parameter name with dot and the second field?
17:47:57FromDiscord<gerwy> that should be doable maybe?
17:48:02FromDiscord<gerwy> but i will try the Phil way first
17:48:10FromDiscord<ShalokShalom> So auto returns a type, void does not
17:48:31FromDiscord<Rika> i guess thats one way to put it
17:48:35FromDiscord<ShalokShalom> I would it welcome, if the documentation mentions similar techniques
17:48:48FromDiscord<ShalokShalom> Like, mention auto at the place of void and vice versa
17:48:55FromDiscord<Rika> it might have just been written in a different way that you didnt understand
17:49:14FromDiscord<Phil> In reply to @Life Sucks "that should be doable": I generally recommend to look for solutions in the following order:↵generics > templates > macros↵generics are imo always easier to grasp in what they do than templates, which in turn are a fair bit easier to grasp and maintain than macros
17:49:19FromDiscord<Rika> to me, auto and void are extremely clear and didnt need explanation even as a beginner, but eh
17:49:57FromDiscord<ShalokShalom> Also like cmd and all the 3748 similar concepts
17:50:17FromDiscord<gerwy> In reply to @Isofruit "I generally recommend to": `Error: cannot instantiate: 'R'` heh
17:50:27FromDiscord<Generic> In reply to @Isofruit "I generally recommend to": don't forget generic macros and generic templates 😛
17:50:28FromDiscord<Phil> I'd need to see your code there
17:50:40FromDiscord<Phil> In reply to @Generic "don't forget generic macros": Do not speak in cursed tongue to me!
17:50:45FromDiscord<gerwy> In reply to @Life Sucks "`Error: cannot instantiate: 'R'`": either that or ↵`Error: type mismatch: got 'int64' for 'arg.int_value' but expected 'string'`
17:50:57FromDiscord<fs> is there any reason to explicitly state void as a type instead of just leaving the return type empty?
17:51:01FromDiscord<Rika> In reply to @Isofruit "Do not speak in": generic concepts
17:51:07FromDiscord<fs> (edit) "is there any reason to explicitly state void as a ... type" added "return"
17:51:12FromDiscord<Rika> In reply to @fs "is there any reason": not really, pretty much if you'd like
17:51:17FromDiscord<gerwy> also your example works on inherited field↵im using object variant
17:51:19FromDiscord<Rika> theyre useful for generics
17:51:38FromDiscord<ShalokShalom> In reply to @Rika "to me, auto and": Well, you are not a beginner
17:51:40FromDiscord<Rika> `proc p[T](): T` that you pass a `void` as `T`
17:51:45FromDiscord<Rika> In reply to @ShalokShalom "Well, you are not": i was one
17:51:50FromDiscord<Rika> i never thought of it
17:51:51FromDiscord<Phil> In reply to @Rika "generic concepts": Somebody get me some holy water, I've got demons to exorcise
17:51:53FromDiscord<ShalokShalom> Its pretty easy to see, whats nice to a beginner, by being a beginner
17:51:55FromDiscord<ShalokShalom> Vice versa
17:52:05FromDiscord<Rika> i will not have this conversation again
17:52:32FromDiscord<Rika> In reply to @Isofruit "Somebody get me some": lol
17:52:44FromDiscord<ShalokShalom> In reply to @Rika "i never thought of": Void is experimental
17:52:55FromDiscord<Rika> i. am. not. having. this. again.
17:53:02FromDiscord<ShalokShalom> How were you a beginner
17:53:04FromDiscord<Rika> end of conversation with me, discuss it with someone else
17:53:08FromDiscord<Rika> good bye
17:53:09FromDiscord<Phil> Shalok, stop it.
17:53:24FromDiscord<ShalokShalom> 🙄
17:53:28FromDiscord<Rika> call me ignorant all you want or whatever, i'm done with you
17:53:41FromDiscord<ShalokShalom> I call you dismissive
17:53:42FromDiscord<Phil> I was there the last time we debated for an hour or so whether things should be capable of being inferred 100%
17:53:53FromDiscord<Rika> see you elsewhere 🙂
17:53:53FromDiscord<ShalokShalom> That's not the point
17:54:04FromDiscord<gerwy> In reply to @Isofruit "I'd need to see": literally no code, i just copied your example and used it like you
17:54:30FromDiscord<ShalokShalom> I just say 'this is helpful' and instead of accepting it, my opinion is put down with the pseudo argument 'I dont need it'
17:54:34FromDiscord<gerwy> thats how Value object looks like https://media.discordapp.net/attachments/371759389889003532/960598267312365568/unknown.png
17:54:39FromDiscord<ShalokShalom> And 'you are dumb for doing so'
17:54:48FromDiscord<Rika> you're putting words in my mouth
17:54:49FromDiscord<ShalokShalom> That's extremely abusive.
17:54:54FromDiscord<Phil> Okay, could you guys move this to offtopic
17:54:54FromDiscord<Rika> i said i never thought of it
17:54:59FromDiscord<ShalokShalom> That's exactly what you convey.
17:54:59FromDiscord<Rika> i will not continue
17:55:18FromDiscord<Rika> In reply to @ShalokShalom "That's exactly what you": it is your assumption
17:55:19FromDiscord<Phil> I'd like to check out gerwy's point where I mistook his original issue to be about inheritance instead of object variants
17:55:57FromDiscord<gerwy> no, its object variant
17:56:03FromDiscord<Rika> thats what phil did say
17:56:19FromDiscord<Phil> It was my mistake that I thought it were about inheritance
17:56:26FromDiscord<gerwy> and i need to get the second field↵i know that its already possible with fieldPairs but i don't want to type it every time i need to access it...
17:56:32FromDiscord<Phil> Maybe badly expressed on my end, I'm playing about with object variant atm
17:56:37FromDiscord<gerwy> In reply to @Isofruit "It was my mistake": It's okay! i still appreciate help<3
17:56:55FromDiscord<Rika> what are you trying to do again
17:57:31FromDiscord<Phil> Essentially a getter on an object variant that gives you the filled in field without complaining
17:57:45FromDiscord<Rika> oh good luck you're not getting that
17:58:01FromDiscord<Phil> You coooouuuuuuld just write a normal proc for that
17:58:08FromDiscord<Rika> its the "return type can differ depending on a runtime value" thing
17:58:10FromDiscord<Phil> With a switch case in it
17:58:19FromDiscord<Rika> which is just, no
17:58:37FromDiscord<Phil> Wait, no, I'm an idiot, then you still don't have the type
17:58:38FromDiscord<Phil> gnaaaa
17:58:40FromDiscord<Rika> the fix is to.... use an object variant, which is just the same thing
17:58:46FromDiscord<Rika> back to square one so
17:58:50FromDiscord<Rika> nope, you just dont here
17:58:52FromDiscord<Phil> It's object variants all the way down
17:58:56FromDiscord<Rika> template if you want
17:59:05FromDiscord<Rika> prolly?
17:59:16FromDiscord<Rika> im not sure, ive never used this but i think its prolly possible
17:59:46FromDiscord<Phil> I mean, you run into trouble every time
17:59:53FromDiscord<Rika> nop
17:59:54FromDiscord<Phil> Because the variable you put your stuff in has to know what type it is
17:59:56FromDiscord<Rika> nope
17:59:58FromDiscord<Rika> you cant do this at all
18:00:04FromDiscord<Rika> manually only
18:00:12FromDiscord<Rika> i forget easily
18:00:12FromDiscord<Phil> And with an object variant you don't necessarily know what value your type is
18:00:25FromDiscord<Phil> (edit) "And with an object variant you don't necessarily know what value your ... type" added "output"
18:00:38FromDiscord<gerwy> In reply to @Rika "oh good luck you're": im very sure that it can be done easily in macros but macros in Nim are a bit weird and wacky
18:00:42FromDiscord<Rika> no
18:00:45FromDiscord<Rika> you cant
18:01:00FromDiscord<gerwy> but i just need to add it to code
18:01:01FromDiscord<Rika> return type based on runtime value is impossible without type elision i believe?
18:01:08FromDiscord<Rika> no matter what
18:01:16FromDiscord<Rika> macro, template, no not possible
18:01:27FromDiscord<Rika> i'm pretty confident its not
18:01:35FromDiscord<gerwy> i know what type its gonna be, i have an enum that says it, it shows me what type the value is that its holding↵i just can't access it manually typing the field
18:01:38FromDiscord<fs> macros only act in compile time
18:01:46FromDiscord<Rika> you dont know what it is on compile time
18:01:54FromDiscord<Rika> it must be known on compile time
18:01:56FromDiscord<Rika> therefore
18:02:00FromDiscord<Phil> Could you show me the context in which you're trying to have this proc?
18:02:07FromDiscord<fs> (edit) "macros" => "macro magic" | "act" => "acts"
18:02:18FromDiscord<Phil> I want to be doubly sure I'm not misunderstanding you there
18:02:33FromDiscord<Rika> okay wait
18:02:34FromDiscord<gerwy> sent a code paste, see https://paste.rs/8lm
18:02:44FromDiscord<Rika> wait wait i think i can think of a thing that MIGHT work
18:03:16FromDiscord<gerwy> think fast
18:03:33FromDiscord<Rika> i cant make code as quick as a certain type of meat here can
18:04:13FromDiscord<Phil> Question,if you do `let x = get_value(myValue)` do you always know at compile time what type x is going to be?
18:05:00FromDiscord<Phil> (that was directed at gerwy)
18:05:26FromDiscord<Rika> this might work
18:05:27FromDiscord<Rika> im not sure
18:05:29FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3UiT
18:05:48FromDiscord<Rika> yes the exception is required
18:06:19FromDiscord<Rika> also no its just a proof of concept, you might need to promote this into a macro for parts
18:06:26FromDiscord<Rika> (edit) "also no its just a proof of concept, you might need to promote this into a macro for ... partsto" added "the enum and field" | "the enum and fieldparts ... " added "to work"
18:06:50FromDiscord<Rika> usage would be like `v.value(int)` or something like that
18:06:57FromDiscord<Phil> In reply to @fs "is there any reason": I... err... can't think of anything tbh
18:06:59FromDiscord<Rika> which is still pretty bad, but you can use generics here
18:07:07FromDiscord<Rika> `v.value(T)` if you have a T generic type
18:07:18FromDiscord<gerwy> In reply to @Isofruit "Question,if you do `let": compile time, not sure, but runtime yeah you will know
18:07:23FromDiscord<Rika> if this is still pretty bad then idk what you want lol
18:07:28FromDiscord<Rika> its just an idea
18:07:31FromDiscord<Rika> its three am
18:07:35FromDiscord<Rika> give me a break xdddddd
18:07:36FromDiscord<Phil> In reply to @Life Sucks "compile time, not sure,": Runtime isn't good enough sadly... I think
18:08:12FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3UiV
18:08:17FromDiscord<Rika> no
18:08:21FromDiscord<gerwy> D:
18:08:21FromDiscord<Rika> procs cannot be untyped
18:08:24FromDiscord<gerwy> bruh
18:08:34FromDiscord<Phil> Because the compiler has to figure out "Do I reserve some memory space the size of an int? A string? an array?"
18:08:37FromDiscord<gerwy> what if i change untyped to T?
18:08:44FromDiscord<Rika> no
18:08:51FromDiscord<Rika> return types conflict in each runtime branch
18:09:06FromDiscord<ajusa> there's no way to determine stuff at compile time when it is decided at runtime
18:09:12FromDiscord<ajusa> if v is static maybe you could do it
18:09:34FromDiscord<gerwy> no
18:10:35FromDiscord<Phil> This is one of those points where it shows that nim doesn't really do dynamic typing. You can escape the static typing a little bit in general, but a type that isn't known at compiletime is going to be hard to deal with
18:10:49FromDiscord<fs> why don't you guys just appreciate the fact that you're working in a static language :)
18:10:57FromDiscord<Vindaar> given that you already provide a generic argument `T` you can make it work if in each branch you call some conversion proc from type `U` (the type of the field) to the output `T`. That may error at CT for certain combinations
18:11:21FromDiscord<Phil> In reply to @fs "why don't you guys": I mean, I do, I just also like generics a lot 😛
18:12:14FromDiscord<Rika> In reply to @fs "why don't you guys": sometimes its needed really, like if you want to represent arbitrary JSON
18:12:24FromDiscord<Rika> but yeah idk it hasnt been a problem for me
18:12:34FromDiscord<ShalokShalom> Could concepts do it?
18:12:46FromDiscord<Rika> concepts are compile time as well
18:13:04FromDiscord<gerwy> damn its so simple concept and im still struggling to find a solution bruh
18:13:18FromDiscord<Rika> shalok i'll have to apologise for last time, my intention was not to tell you what you thought i mean
18:13:18FromDiscord<Rika> (edit) "mean" => "meant"
18:13:33FromDiscord<fs> In reply to @Rika "sometimes its needed really,": mh, then stdlib json already solves it with the getStr, getInt, ...
18:13:42FromDiscord<Rika> but i meant something more like "i didnt think it was common to mistake auto and void, so that's why its not there"
18:13:47FromDiscord<Rika> im not sure if people do that
18:13:49FromDiscord<Phil> In reply to @Life Sucks "damn its so simple": It's a simple concept, but in a static language this particular thing is very hard to achieve in order to allow other nice things in nim
18:14:10FromDiscord<Rika> In reply to @fs "mh, then stdlib json": its still ugly lol
18:14:17FromDiscord<Phil> There can be no types that you don't know what they are at compile time
18:14:51FromDiscord<Rika> i really prefer it if the type were not embedded in the name xdddd
18:14:57FromDiscord<Rika> get(T)
18:15:07FromDiscord<fs> i like the way treeform's jsony maps json to static types
18:15:15FromDiscord<Rika> yes that works most of the time and its good
18:15:20FromDiscord<gerwy> just tell me how do to this in macro ↵that i give it an enum and that Value variable↵and it just returns like `variable.field_according_to_enum`
18:15:24FromDiscord<Phil> jsony is my go to for transforming object --> json
18:15:26FromDiscord<Rika> but sometimes json's arbitrary-er than that
18:15:47FromDiscord<Rika> In reply to @Life Sucks "just tell me how": no can do if the enum is not static 🙂
18:15:57FromDiscord<Rika> back to square one, are we
18:16:22FromDiscord<Phil> I mean, maybe let him experience for himself? I'd give you a macro to knock yourself out but I tend to avoid macros for a reason
18:16:40FromDiscord<Phil> (edit) "himself?" => "himself (?)↵Could be educational ^^↵"
18:16:44FromDiscord<ShalokShalom> In reply to @Rika "shalok i'll have to": All fine
18:18:30FromDiscord<ShalokShalom> sent a long message, see http://ix.io/3UiY
18:18:40FromDiscord<Rika> hm
18:18:41FromDiscord<ShalokShalom> Since you might look for a, but stumble across b
18:18:50FromDiscord<Rika> just a different way of thinking
18:19:03FromDiscord<Rika> really hard to account for stuff like that really
18:19:06FromDiscord<Rika> (edit) "that" => "that,"
18:19:55FromDiscord<ShalokShalom> In reply to @Isofruit "There can be no": So, I assume void simply counts as its own type?↵↵And auto as well?
18:19:56FromDiscord<Phil> In reply to @Life Sucks "just tell me how": Try to tackle beef if he shows up?
18:20:05FromDiscord<ShalokShalom> Like, at compile time.
18:20:10FromDiscord<gerwy> Beef gets really easily annoyed by me heh
18:20:12FromDiscord<Phil> In reply to @ShalokShalom "So, I assume void": Void is an absence of type. It is not a type, it is nothing
18:20:28FromDiscord<Phil> It is beyond type for it's just nothingness
18:21:14FromDiscord<ShalokShalom> So, it avoids type checking?
18:21:16FromDiscord<Phil> and auto as stated is just a place-holder that the compiler fills in for you
18:21:24FromDiscord<Rika> teeeeeeeeeeechnically its a type but only in a sense, its less type-y than int lool
18:21:25FromDiscord<Rika> (edit) "lool" => "lol"
18:21:28FromDiscord<Phil> It is a type, just one that you don't specify
18:21:31FromDiscord<ShalokShalom> So, that would mean its even more loose than dynamic types?
18:21:35FromDiscord<ShalokShalom> Aha.
18:21:37FromDiscord<Phil> (edit) "It ... is" added "(auto)"
18:21:40FromDiscord<Rika> no its literally the lack of a type
18:21:47FromDiscord<Rika> you cannot pass anything to it
18:21:50FromDiscord<Rika> it is no type
18:22:00FromDiscord<Rika> oh auto?
18:22:03FromDiscord<Rika> im lost xd
18:22:06FromDiscord<ShalokShalom> Well both
18:22:21FromDiscord<ShalokShalom> See, that would make sense to be documented
18:22:26FromDiscord<Rika> void is lack of type in the sense there is none↵auto is lack of type in the sense that you leave the compiler to choose
18:22:28FromDiscord<Phil> We're talking about both at once.↵Auto is a type, just one that the compiler determines.↵Void isn't a type, it's just nothing.
18:22:29FromDiscord<Rika> oh
18:22:32FromDiscord<Rika> i see your confusion now]
18:22:43FromDiscord<gerwy> okay so Rika, having your thingy i think might be the closest to what i want
18:22:49FromDiscord<gerwy> what should toEnum(T) return
18:23:13FromDiscord<Rika> nimnode of an enum value
18:23:14FromDiscord<ShalokShalom> In reply to @Isofruit "We're talking about both": That sounds very appropriate
18:23:31FromDiscord<Rika> it was just a concept i htought of and i dont know if it works at all'
18:23:41FromDiscord<Rika> you still kinda have to pass a type
18:23:41FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3Uj1
18:23:47FromDiscord<Rika> In reply to @Life Sucks "and whats the deal": yeah pm
18:23:48FromDiscord<gerwy> i mean it seems like it will work
18:24:02FromDiscord<Phil> IIRC it works identical in java and...err... does C++ have a similar concept? I know it has auto which does the same as in nim, just not sure about void
18:24:05FromDiscord<gerwy> In reply to @Rika "yeah pm": okay so i guess now i need to figure out how to declare it
18:24:08FromDiscord<Rika> yeah, but idk why you're against `.int_value` if youre fine with `.value(int)`
18:24:21FromDiscord<Rika> i have my reasons, idk yours
18:25:13FromDiscord<fs> ~~just use python~~
18:25:14FromDiscord<gerwy> hmm wait i have an idea
18:25:20FromDiscord<gerwy> In reply to @fs "~~just use python~~": ew nah, i prefer to suffer
18:25:23FromDiscord<Phil> In reply to @fs "~~just use python~~": But the speeeeeeed
18:25:34FromDiscord<Rika> In reply to @Life Sucks "ew nah, i prefer": so you prefer using python?
18:25:41FromDiscord<Rika> 😛
18:25:43FromDiscord<ShalokShalom> In reply to @Isofruit "IIRC it works identical": Yeah, I also thought about [auto] coming from C++
18:26:21FromDiscord<Phil> let me google if c++ has void
18:26:45FromDiscord<ShalokShalom> Well, C has a void type to begin with
18:26:50FromDiscord<Phil> I'm reading about void pointers
18:26:51FromDiscord<ShalokShalom> But idk if that's the same
18:26:52FromDiscord<Phil> This is dark magic
18:26:53FromDiscord<Phil> burn it
18:27:00FromDiscord<Rika> nim has `pointer` though :)))
18:27:02FromDiscord<ShalokShalom> 🔥
18:27:09FromDiscord<Rika> bet phil cant sleep today because of that
18:27:19FromDiscord<Phil> I need holy water and holy fire
18:27:24FromDiscord<Rika> is there holy fire?
18:27:29FromDiscord<Phil> One to exorcise generic concepts, the other to burn void pointers
18:27:31FromDiscord<Rika> shit man sorry you're shit outta luck
18:27:35FromDiscord<Phil> If there isn't I will make some
18:27:54FromDiscord<Rika> what about void pointers that store void pointers
18:28:06FromDiscord<Rika> `ptr ptr pointer`
18:28:09FromDiscord<Phil> I'll staple so many layers of generic on top of one another until my machine bursts in holy fury
18:28:18FromDiscord<Phil> And a holy flame shall erupt from it
18:28:18FromDiscord<fs> i should get more into pointers and c to understand the jokes
18:28:32FromDiscord<Phil> void pointers can just be converted into any type
18:28:36FromDiscord<gerwy> okay never mind it doesn't work D:
18:28:39FromDiscord<fs> (edit) "i should get more into pointers and c ... to" added "just"
18:29:05FromDiscord<Phil> It's basically "What if I basically allow this to be anything now and open myself up to a whole host of potential memory issues"
18:29:35FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3Uj3
18:29:53FromDiscord<Rika> yeah i told you
18:29:55FromDiscord<Rika> why
18:29:58FromDiscord<Rika> i told you why
18:29:58FromDiscord<gerwy> :<<
18:30:08FromDiscord<gerwy> i don't like it
18:30:13FromDiscord<gerwy> it should work >:c
18:30:23FromDiscord<Phil> I banged my head against the object variant wall as well for a while
18:30:25FromDiscord<Phil> I relented
18:30:52FromDiscord<Phil> I found my pice in solving the problem in a different way... one that surpsrisingly enough lead to a macro
18:30:57FromDiscord<gerwy> yeah i have enough i think, but i still don't want to have millions of if's just to get that stupid value
18:31:00FromDiscord<Phil> (edit) "surpsrisingly" => "surprisingly"
18:31:25FromDiscord<Phil> (edit) "pice" => "peace"
18:31:52FromDiscord<Rika> i'll finish the demo i made if you can give me the type def of your Value thing
18:32:17FromDiscord<Phil> Not a screenshot, copy paste of code please, so Rika can copy paste as well
18:32:29FromDiscord<Rika> haha
18:32:32FromDiscord<Rika> thats what i meant
18:32:46FromDiscord<gerwy> oh oka wait
18:32:53FromDiscord<ShalokShalom> @gerwy what are you trying to do in the first place?
18:33:01FromDiscord<Phil> A getter on an object variant
18:33:09FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3Uj4
18:33:15FromDiscord<ShalokShalom> Seems like you map types to .. equivalent versions of it
18:33:27FromDiscord<Phil> Want's to get the value out of an object variant for which he doesn't know the type. So a getter that could return any type whatsoever
18:33:46FromDiscord<gerwy> In reply to @ShalokShalom "<@347345994217816066> what are you": having an AST, trying to evaluate expressions with this, since i don't know what their types are, i just know an enum and string value
18:33:54*PMunch quit (Quit: leaving)
18:35:36*jmdaemon joined #nim
18:35:46FromDiscord<ShalokShalom> And there is no concept in Nim, that does allow that?
18:35:59FromDiscord<ShalokShalom> This sounds like a relatively common use case
18:36:20FromDiscord<ShalokShalom> Would it make sense to raise an issue, and ask for a new implementation, that allows that?
18:36:26FromDiscord<Phil> you're trying to do `let x = get_value(objectVariant)` without knowing if x will be an int, string, object, array, seq, set or whatnot
18:36:36FromDiscord<Phil> And in this case, the compiler won't know either
18:36:51FromDiscord<Phil> And if the compiler doesn't know at compile time, it can't deal with it
18:37:35FromDiscord<gerwy> In reply to @ShalokShalom "And there is no": there is and its called object variant, exact thing im using
18:37:39FromDiscord<ShalokShalom> C# has lots of dynamic features, despite being a mostly statically typed language
18:37:45FromDiscord<gerwy> people call it tagged union too
18:37:48FromDiscord<ShalokShalom> 😬
18:37:50FromDiscord<Phil> Because you don't know if objectVariant is of variant "hasString", "hasObj", "hasArr", "hasSeq" etc.
18:38:13FromDiscord<ShalokShalom> In reply to @Life Sucks "people call it tagged": Yeah, but why isnt it working then for you?
18:38:19FromDiscord<enthus1ast> you must check with "of" then cast to concrete type
18:38:22FromDiscord<gerwy> In reply to @Isofruit "you're trying to do": you know if its an int or string or whatever thats the point
18:38:26FromDiscord<enthus1ast> or convert not cast
18:38:33FromDiscord<gerwy> In reply to @ShalokShalom "Yeah, but why isnt": because nim is wacky and doesn't understand simple stuff
18:38:37FromDiscord<ShalokShalom> Seems like have only part of the solution
18:38:41FromDiscord<Phil> In reply to @ShalokShalom "Yeah, but why isnt": Because you can deal with it: By dealing with what to do for every single variant
18:38:45FromDiscord<Rika> im still not sure why you'd rather my solution than just `int_value` etc etc
18:38:46FromDiscord<Phil> Which is a lot of typing
18:38:46FromDiscord<ShalokShalom> Yeah, thats what I mean.
18:39:00FromDiscord<gerwy> In reply to @Rika "im still not sure": how would i know if its INT?
18:39:03FromDiscord<gerwy> (edit) "INT?" => "int?"
18:39:09FromDiscord<ShalokShalom> In reply to @Isofruit "Which is a lot": So that sounds like a macro?
18:39:42FromDiscord<Phil> Not necessarily. I don't know what you want to do when you encounter an int variant vs a string variant
18:39:45FromDiscord<gerwy> In reply to @enthus1ast "or convert not cast": so you say i should do `toInt(v.int_value)` or something like this?
18:39:56FromDiscord<Phil> So I can't write a macro that does a specific thing for you
18:40:19FromDiscord<enthus1ast> first check what kind the object is, then use type conversion
18:40:25FromDiscord<ShalokShalom> That sounds like dynamic typing then :p
18:40:30FromDiscord<Phil> If I presume that you always want whatever value is stored as a string I could write a compile-time-proc instead of a macro that contains the entire if-stuff
18:40:41FromDiscord<Phil> (edit) "If I presume that you always want whatever value is stored as a string I could write a compile-time-proc instead of a macro that contains the entire if-stuff ... " added "and converts from the various types into string"
18:41:10FromDiscord<gerwy> In reply to @enthus1ast "first check what kind": yeah i check it with `case typ` which is an enum and it tells me which type this object is
18:41:13FromDiscord<Phil> In reply to @ShalokShalom "That sounds like dynamic": Yeh, just type-intensive to ensure correctness
18:41:34FromDiscord<Phil> (edit) "Yeh," => "Its"
18:41:43FromDiscord<Phil> (edit) "type-intensive" => "typing-intensive"
18:42:22FromDiscord<ShalokShalom> Yeah, I see.
18:42:41FromDiscord<enthus1ast> ah no ignore me, not test with `of`
18:42:50FromDiscord<enthus1ast> this is for oop
18:43:05FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3Uj6
18:43:09FromDiscord<enthus1ast> yes
18:43:19FromDiscord<Phil> In reply to @enthus1ast "ah no ignore me,": I don't think I've ever used of anywhere so I can't really comment on it.... that was sarcasm right?
18:43:31FromDiscord<Phil> (edit) "In reply to @enthus1ast "ah no ignore me,": I don't think I've ever used of anywhere so I can't really comment on it.... that was sarcasm ... right?" added "about how we didn't respond to "of","
18:43:35FromDiscord<gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3Uj7
18:43:49FromDiscord<enthus1ast> no with `of` you can test if an object is of the given type
18:43:59FromDiscord<ShalokShalom> @gerwy is this 'case typ' meaning case type?
18:44:03FromDiscord<Phil> Wait... isn't that just "is"?
18:44:30FromDiscord<gerwy> In reply to @ShalokShalom "<@347345994217816066> is this 'case": yeah, typ is enum storing what type that object is
18:44:35FromDiscord<Phil> (My stuff was directed at enthus1ast)
18:44:38FromDiscord<gerwy> In reply to @Isofruit "Wait... isn't that just": no
18:44:50FromDiscord<Phil> Hah! Saw it coming from a mile away!
18:45:02FromDiscord<ShalokShalom> So just to avoid name duplication
18:45:50FromDiscord<Phil> Shalok, have you read about object variants in nim already?
18:45:57FromDiscord<ShalokShalom> Would you need proc in this case?
18:46:05FromDiscord<ShalokShalom> Seems like func would work as well
18:46:14FromDiscord<ShalokShalom> And provides you with more guarantees.
18:46:34FromDiscord<ShalokShalom> In reply to @Isofruit "Shalok, have you read": Yes, what am I missing?
18:46:46FromDiscord<gerwy> In reply to @ShalokShalom "Seems like func would": if it only could return any type
18:47:09FromDiscord<Phil> In reply to @ShalokShalom "Yes, what am I": Nothing, If not I'd have just thrown the url to their docs at you since I thought you might've found that interesting
18:47:23FromDiscord<enthus1ast> this is what i meant @Phil https://play.nim-lang.org/#ix=3Uj9
18:47:35FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Ujb
18:47:37FromDiscord<Rika> this is dumb btw
18:47:40FromDiscord<ShalokShalom> Yeah, actually the only Nim code I every wrote and commited, is nothing both that
18:47:54FromDiscord<ShalokShalom> But I am not used yet to call it object variants
18:48:06FromDiscord<ShalokShalom> Grew up calling them choice types
18:48:20FromDiscord<ShalokShalom> Or discriminated unions.
18:48:21FromDiscord<Rika> yeah some others call them tagged unions as well
18:48:27FromDiscord<Phil> Ah, fair.
18:48:29FromDiscord<ShalokShalom> Yeah
18:48:39FromDiscord<Rika> lotsa names for it
18:48:40FromDiscord<enthus1ast> since attribs in case objects cannot be named nicely, i try to avoid them
18:48:47FromDiscord<ShalokShalom> I was confused initially that they are realized with objects here
18:49:34FromDiscord<Phil> In reply to @enthus1ast "this is what i": Huh... yeah that works entirely different than "is"
18:49:44FromDiscord<ShalokShalom> sent a long message, see http://ix.io/3Ujc
18:50:13FromDiscord<enthus1ast> my example is misleading since the attrib name can be just val (withouth the str/int prefix)
18:50:16FromDiscord<gerwy> sent a code paste, see https://paste.rs/DTi
18:50:17FromDiscord<Rika> In reply to @Life Sucks "throws an exception for": used how?
18:50:49FromDiscord<gerwy> In reply to @Rika "used how?": pasted your example lol
18:50:50FromDiscord<ShalokShalom> Could pure C do what gerwy wants?
18:50:56FromDiscord<Rika> thats the point i mean
18:50:58FromDiscord<ShalokShalom> Since then we could just inline.
18:51:01FromDiscord<Rika> the first part works, the second doesnt
18:51:02FromDiscord<Rika> just to show
18:51:02FromDiscord<enthus1ast> and this is the reason i usually use them instead of case objects
18:51:03FromDiscord<Phil> In reply to @ShalokShalom "Objects always represented to": How languages shape what concepts you like. In java everything insane I've seen is objects. The only good bits I've seen in there resemble functional programming bits (lambdas, just so many lambdas)
18:51:07FromDiscord<gerwy> In reply to @ShalokShalom "Could pure C do": in macros, maybe, i have no idea if there are tagged unions in C
18:51:20FromDiscord<ShalokShalom> In reply to @Isofruit "How languages shape what": Yeah, totally
18:51:37FromDiscord<ShalokShalom> You have ever seen the Java part of the Clojure source code?
18:51:40FromDiscord<Rika> i should prolly go to sleep lest i risk having under 6 hours of sleep
18:51:47FromDiscord<ShalokShalom> Its said to be pretty much like that.
18:51:50FromDiscord<gerwy> In reply to @enthus1ast "and this is the": i can't use just val for object variant, since it shows an error for redefinition of val
18:51:50FromDiscord<Rika> ask beef to fix whatever dumb idea i had today
18:51:56FromDiscord<ShalokShalom> In reply to @Rika "i should prolly go": Sleep well.
18:52:08FromDiscord<Phil> Sleeping? So weak!
18:52:11FromDiscord<gerwy> In reply to @Rika "i should prolly go": go to sleep Rika, i appreciate all your help, i will figure it out thank youu<3
18:52:16FromDiscord<Phil> Just stay awake! Sleep is wasted time!
18:52:24FromDiscord<ShalokShalom> In reply to @Life Sucks "in macros, maybe, i": Well, I am generally asking, because C is much more loose about its types
18:52:29FromDiscord<Rika> last time i did that was yesterday, for 30 hours
18:52:33FromDiscord<Phil> You could be coding more an give progressively better coding advice as you forego sleep for more coding!
18:52:37FromDiscord<gerwy> oh wait it makes sense that it doesn't work since you made it doesn't work lol
18:52:40FromDiscord<Rika> no thanks, i have things to do in the morning
18:52:51FromDiscord<gerwy> but i still want it to use enum instead of type <_>
18:53:06FromDiscord<creikey> In reply to @Elegantbeef "Same with your `sendData`": this is an interesting way of doing it, I was mainly just used to binny but didn't want to add a whole other dependency so just copy pasted the functions I needed
18:53:14FromDiscord<enthus1ast> yes i know, thats the reason i try to avoid case objects, but use inheritance↵(@gerwy)
18:53:29FromDiscord<Rika> In reply to @Life Sucks "but i still want": cannot do, the value must be compile time resolvable
18:53:41FromDiscord<ShalokShalom> In reply to @Isofruit "You could be coding": That doesn't scale well 😂
18:53:44FromDiscord<Rika> that is a must, there is no going around that
18:53:46FromDiscord<creikey> the counting down so I don't have a seq for indices is useful though I forgot you could do that
18:53:54FromDiscord<Rika> In reply to @ShalokShalom "That doesn't scale well": it's a fine line
18:53:56FromDiscord<gerwy> In reply to @Rika "cannot do, the value": i can do like↵`ident tolower($T) & "value"` maybe hmm?
18:54:01FromDiscord<Phil> In reply to @ShalokShalom "That doesn't scale well": Just buy more scales if your scale isn't well!
18:54:09FromDiscord<Rika> a fine line of alcohol, caffeine, and sleep deprivation
18:54:12FromDiscord<enthus1ast> @gerwy\: https://play.nim-lang.org/#ix=3Uje
18:54:50FromDiscord<gerwy> In reply to @enthus1ast "<@347345994217816066>\: https://play.nim-lang.org/#": cool, now you need to use specifically StrObj only if you know exactly thats its gonna be string
18:56:13FromDiscord<gerwy> made it work for enums
18:56:18FromDiscord<gerwy> thanks to toLowerAscii
18:56:37FromDiscord<gerwy> oh wait i need to..
18:56:38FromDiscord<gerwy> uugh
18:56:46FromDiscord<gerwy> Rikaaa
18:57:35FromDiscord<ShalokShalom> Considering the malware issue, that led to blocking Nim, and all Nim programs in general seen by Windows as potential thread:↵↵How does Windows know, that a certain software is written in Nim?
18:57:41FromDiscord<ShalokShalom> Considering its compiled.
18:57:50FromDiscord<gerwy> you know, this `echo val.value(INT)` is cool and all
18:58:05FromDiscord<gerwy> but i kinda wanted something like `echo val.value(val.typ)` to work too...
18:58:39FromDiscord<ShalokShalom> (edit) removed "Nim, and all" | removed "in general seen"
18:58:43FromDiscord<gerwy> In reply to @ShalokShalom "Considering the malware issue,": not only Nim suffers from that, its just that software is not signed↵same happens on Mac
18:58:53FromDiscord<ShalokShalom> Yeah, true
18:58:58FromDiscord<Rika> In reply to @ShalokShalom "Considering the malware issue,": Signature or patterns in the code generated
18:59:02FromDiscord<creikey> In reply to @Life Sucks "not only Nim suffers": I tried googling it but couldn't get a straight answer, how hard is it to get your executables signed?
18:59:08FromDiscord<Rika> In reply to @creikey "I tried googling it": Expensive
18:59:09FromDiscord<Phil> In reply to @ShalokShalom "Considering the malware issue,": Antivirus is just all ML learning
18:59:14FromDiscord<ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/960614540607885382/Screenshot_2022-04-04-20-59-06-37.jpg
18:59:23FromDiscord<ShalokShalom> But I am talking about that
18:59:27FromDiscord<Rika> In reply to @Life Sucks "Rikaaa": Again the enum should be compile time determinable as I’ve said
18:59:31FromDiscord<Rika> Nowhere around that
18:59:43FromDiscord<ShalokShalom> In reply to @Isofruit "Antivirus is just all": Ah, I see. So it decompiled and knows its based on Nim
18:59:44FromDiscord<Phil> So it'll have some patterns the way the nim compiler translates nim code to C
18:59:53FromDiscord<gerwy> In reply to @Isofruit "Antivirus is just all": no, its checking hash of software and also its behaviour in small VM↵ML i think is not that effective
19:00:05FromDiscord<gerwy> In reply to @Rika "Nowhere around that": thats such a boomer
19:00:07FromDiscord<ShalokShalom> In reply to @creikey "I tried googling it": There are Reddit groups, who help ypu
19:00:15FromDiscord<ShalokShalom> Since x amount of users can say its fine
19:00:19FromDiscord<ShalokShalom> And then its fine
19:00:30FromDiscord<Rika> Sometimes AV vendors are stubborn though
19:00:34FromDiscord<Phil> In reply to @Life Sucks "no, its checking hash": It checks software hashes against a known whitelist?
19:00:36FromDiscord<creikey> In reply to @ShalokShalom "Since x amount of": interestintg
19:00:37FromDiscord<ShalokShalom> In reply to @Isofruit "So it'll have some": I see.
19:00:44FromDiscord<creikey> In reply to @ShalokShalom "There are Reddit groups,": https://stackoverflow.com/questions/252226/signing-a-windows-exe-file there's this but how do I get the actual certificate
19:00:47FromDiscord<creikey> do I need to be LLC
19:00:55FromDiscord<Rika> No you just have to pay
19:01:03FromDiscord<gerwy> i guess i will use that cringe ass fieldPairs for this moment↵we will see what i can do in future↵i planned on rewriting this language in Zig but thats only if i will decide to make it better and stuff
19:01:04FromDiscord<Phil> Or is there more to it? Because that'd be very surprising to me if you can see from a hash whether it's malware or not
19:01:17FromDiscord<Phil> Unless you've got blacklists/whitelists
19:01:39FromDiscord<gerwy> In reply to @Isofruit "It checks software hashes": ye, if the software does something malicious to your PC, its hash is saved in database and then reused in AV scanning files
19:01:44FromDiscord<creikey> In reply to @Rika "No you just have": who do I pay though? like where is the information
19:02:25FromDiscord<Phil> In reply to @Life Sucks "ye, if the software": That wouldn't explain why nim lands in the bin though, would it? That is under the assumption the various AV providers out there haven't just thrown the entire nim language on a blacklist
19:02:46FromDiscord<Phil> I assume that because I want to have some faith in humanity that AV providers don't just blacklist an entire language because of like 3 programs written in it
19:02:58FromDiscord<gerwy> In reply to @Isofruit "That wouldn't explain why": not signed software that does suspicious things↵again, you can sign your binary on windows
19:03:33FromDiscord<Phil> But the suspicious things would be determined through ML I'd assume
19:03:56FromDiscord<creikey> https://www.digicert.com/tls-ssl/compare-certificates do I buy this?
19:04:37FromDiscord<ShalokShalom> In reply to @creikey "who do I pay": You can also get your binary on the whitelist, when a certain amount of users accepts it as trustworthy
19:04:46FromDiscord<enthus1ast> when its easy for AV to trigger on eg gc then yes \:)↵(@Phil)
19:04:49FromDiscord<ShalokShalom> You can avoid paying that way
19:04:57FromDiscord<creikey> In reply to @ShalokShalom "You can also get": every time I update the executable though the same process has to happen right
19:05:06FromDiscord<creikey> but if I get the signature I can just sign every update
19:05:06FromDiscord<ShalokShalom> In reply to @Isofruit "I assume that because": Cute
19:05:32FromDiscord<enthus1ast> i must say lately my windows antivirus and sophos did not flag nim applications
19:06:52FromDiscord<ShalokShalom> In reply to @Isofruit "That wouldn't explain why": "This language is so rarely used, just block every single program. Basically, the malware is the first program, that I have encountered in it, so it is probably not really used for anything else."
19:07:48FromDiscord<ShalokShalom> In reply to @enthus1ast "when its easy for": You can still create hash rates from all Nim programs that are out in the wild.
19:07:58FromDiscord<gerwy> ugh god okay i guess fieldPairs doesn't work...
19:08:02FromDiscord<gerwy> i need to find some workaround
19:08:13FromDiscord<ShalokShalom> In reply to @creikey "every time I update": I think so, yes. Or you as the vendor become trustworthy.
19:08:36FromDiscord<ShalokShalom> But I think I can remember that people complained about having to do it for every version
19:08:41FromDiscord<ShalokShalom> Windows 🤷🏻‍♂️
19:09:14FromDiscord<ShalokShalom> (edit) "become" => "becomes"
19:09:24FromDiscord<Phil> I mean, AV's have already started with the base assumption that nim as a language isn't trustworthy, otherwise the issue wouldn't exist
19:09:36FromDiscord<ShalokShalom> Yeah, totally.
19:10:00FromDiscord<Phil> So the only really viable paths are convincing them otherwise which needs community growth by like tenfold and then some and flooding them with complaints, or paying
19:10:03FromDiscord<gerwy> i have, veryyyy stupid idea that i hate to even have
19:10:22FromDiscord<gerwy> what if i just stored all the values as strings↵and convert them to the needed type
19:10:22FromDiscord<ShalokShalom> I guess they treat it as an obfuscation tool
19:10:29FromDiscord<ShalokShalom> What's understandable
19:10:43FromDiscord<ShalokShalom> Since honestly, thats it, pretty much
19:11:00FromDiscord<ShalokShalom> From a AV/ML point of view.
19:11:05FromDiscord<Phil> In reply to @Life Sucks "what if i just": That's.... why would you do this to yourself. You might as well keep using the object variant
19:11:20FromDiscord<Phil> You're exposing yourself to a sleuth of bugs in order to save some typing effort xP
19:11:33FromDiscord<Phil> Might as well convert to json and back
19:11:48FromDiscord<ShalokShalom> In reply to @Life Sucks "i have, veryyyy stupid": Sounds like you're enjoying the language
19:11:52FromDiscord<gerwy> In reply to @Isofruit "That's.... why would you": this fucking fucker doesn't work
19:12:00FromDiscord<ShalokShalom> Do you want to rate us in the app shop?
19:12:00FromDiscord<gerwy> this idea is literally what JS does lol
19:12:57FromDiscord<Phil> Yeh, and nowadays JS is treated more like a compilation target than an actual language xP
19:13:11FromDiscord<Phil> (By Typescript mind you, not nim)
19:16:44FromDiscord<gerwy> Typescript imo is awful too but well 🙄
19:17:10FromDiscord<gerwy> i thought Nim would be able to tolerate my horrible idea but i guess i need to think about it in a different way
19:17:11FromDiscord<ShalokShalom> In reply to @Isofruit "(By Typescript mind you,": Why not by Nim?
19:17:38FromDiscord<ShalokShalom> Practically every language compiles to JS these days
19:17:43FromDiscord<ShalokShalom> Why is Nim different?
19:18:00om3gaStrange thing, I try to add() row I got from mariadb to the sec[string], and it not works :X ... rror: type mismatch: got <seq[string], string>
19:18:01FromDiscord<enthus1ast> it also compiles to c?
19:18:38FromDiscord<enthus1ast> is your seq a var?
19:18:46FromDiscord<ShalokShalom> sent a long message, see http://ix.io/3Ujl
19:18:52FromDiscord<gerwy> i will just have horrible code for now i guess
19:18:59om3gaIf I'm not mistaken, sequences are similar to array of char arrays right?
19:19:04FromDiscord<gerwy> i mostly need this to evaluate expression
19:19:06FromDiscord<ShalokShalom> In reply to @enthus1ast "it also compiles to": Well, it treats JS as a compilation target
19:19:40om3gaenthus1ast: sequence.add(data[i][1])
19:19:40FromDiscord<enthus1ast> show some code please↵(<@709044657232936960_om3ga=5b=49=52=43=5d>)
19:20:05FromDiscord<enthus1ast> where does `sequence` come from?
19:20:10om3gawhere data[i][1] == cell from table (string)
19:20:22om3gasequence: seq[string]
19:20:29FromDiscord<Phil> In reply to @ShalokShalom "Why not by Nim?": That was more a jab in that IIRC Typescript is the largest amount of source code that is used to compile to JS, because... well, it's the default for most of the entire JS ecosystem
19:20:54FromDiscord<Phil> Nim can compile to JS, in terms of sheer amount of code typescript will bury you
19:21:02FromDiscord<Phil> (edit) "Nim can compile to JS, in terms of sheer amount of code ... typescript" added "intended to compile to JS"
19:21:15om3gaI tested in playground... .add() works well with regular strings
19:21:22FromDiscord<enthus1ast> to share a more complete code snippet
19:21:35om3gaok, just a minute
19:21:42FromDiscord<ShalokShalom> In reply to @Isofruit "That was more a": I think its so complicated because of the type system
19:22:05FromDiscord<Phil> In reply to @ShalokShalom "I think its so": You mean TS is complicated?
19:22:08FromDiscord<ShalokShalom> I heard it has a very advanced type system, to accommodate for JS
19:22:20FromDiscord<ShalokShalom> Well, complicated in terms of much code
19:22:47FromDiscord<Phil> TS is basically JS, but you can stick types at the end to guarantee that you didn't just do a dumb mistake in your types
19:22:48FromDiscord<ShalokShalom> Like, basically all functional languages are said to have a simpler type system
19:23:06FromDiscord<ShalokShalom> TS is actually based on researched, that had not been tested in production
19:23:18FromDiscord<ShalokShalom> In reply to @Isofruit "TS is basically JS,": Yeah, from a user side
19:23:37FromDiscord<ShalokShalom> But in order to be 100% compatible, they had to jump through hoops.
19:23:46FromDiscord<Phil> That I can imagine
19:23:48FromDiscord<ShalokShalom> (edit) "a" => "an"
19:23:59FromDiscord<Phil> Stuff like decorator annotations were still barely to non functional IIRC
19:24:10FromDiscord<Phil> (edit) "Stuff like ... decorator" added "some levels of"
19:24:41FromDiscord<Phil> At least they were early last year, I remember being unable to do so because not yet supported
19:24:58FromDiscord<Phil> (edit) "do so" => "annotate a couple decorators how I wanted"
19:26:08om3gaenthus1ast: https://pastebin.pl/view/13519a44
19:26:19om3gashortened example
19:26:41FromDiscord<enthus1ast> sequence is a proc param
19:26:41FromDiscord<ShalokShalom> Still, I guess TS would be able to do, what gerwy wants to do
19:26:52FromDiscord<ShalokShalom> Probably even pretty elegantly.
19:27:02FromDiscord<ShalokShalom> Due to the runtime being dynamic
19:27:05FromDiscord<enthus1ast> proc params are immutable unless you use `sequence: var seq[string]`
19:27:23FromDiscord<Phil> I mean, depends on if you have certain rules active. TS does have rules that enforce every variable must have a specific type
19:27:29FromDiscord<Phil> If you enable that you're once more in fun town
19:27:52*neurocyte8614 quit (Read error: Connection reset by peer)
19:28:00FromDiscord<Phil> Not sure how elaborate they made that one, we're at work working towards being able to enable it without it blowing up various parts of our frontend projects
19:28:02om3gaenthus1ast: yes, db.getAllRows returns sequence of Row type, where Row == string
19:28:47om3gaenthus1ast, oh!
19:28:51*neurocyte86144 joined #nim
19:28:53om3gathat's my fault
19:29:10om3gabut I tried to return new seq from that proc
19:29:22om3gawarning was the same... Let me try again
19:29:52om3gaor yeah, I will try to make param mutable
19:30:25FromDiscord<ShalokShalom> In reply to @Isofruit "I mean, depends on": Sounds like you just have to disable a certain rule and voila.
19:30:33FromDiscord<ShalokShalom> Or just use inline js
19:30:40FromDiscord<tandy> https://github.com/alaviss/union↵(@gerwy)
19:30:41FromDiscord<ShalokShalom> Whatever
19:30:59om3gaenthus1ast: it worked, thanks for helping me
19:31:12FromDiscord<enthus1ast> sure np
19:31:16FromDiscord<gerwy> In reply to @tandy "https://github.com/alaviss/union (<@347345994217816": i really have enough for today thanks, but i will think about it later
19:31:25FromDiscord<ShalokShalom> @tandy#0000 they are anonymous?
19:31:33FromDiscord<ShalokShalom> I think he wants named ones
19:32:05FromDiscord<ShalokShalom> And he is not missing the unions, he is missing something to read and convert it
19:32:35FromDiscord<ShalokShalom> (edit) "he" => "he/she"
19:32:45FromDiscord<ShalokShalom> Or do I not get something
19:33:50FromDiscord<gerwy> In reply to @ShalokShalom "I think he/she wants": i mean, everything will be better than what im currently trying to do... https://media.discordapp.net/attachments/371759389889003532/960623248540848148/unknown.png
19:34:06FromDiscord<gerwy> yeah...
19:39:35FromDiscord<ShalokShalom> I like to mention that the type declarations are by far the most messy thing about this
19:40:01FromDiscord<ShalokShalom> That does look like C
19:40:07FromDiscord<ShalokShalom> Or some other generic language
19:40:25FromDiscord<ShalokShalom> Congratulations, you got Nim out of Nim 🥳
19:41:03FromDiscord<pmunch> Gerwy, an easier way to do that would be to first get the values converted to float, then do the math afterwards.
19:47:03FromDiscord<pmunch> sent a long message, see http://ix.io/3Ujr
19:48:05FromDiscord<pmunch> Hmm, apparently Matrix doesn't have code highlighting
19:48:10FromDiscord<pmunch> But you get the point
20:03:27FromDiscord<gerwy> In reply to @pmunch "Something like this\: \`\`\`nim": well i wouldn't say its easier, since i still need this ugly case but i guess its gonna look better if i make this conversion
20:03:34FromDiscord<gerwy> god this language gonna be so slow haha
20:17:34FromDiscord<ShalokShalom> https://github.com/jart/cosmopolitan#readme=
20:18:18FromDiscord<ShalokShalom> https://github.com/jart/cosmopolitan#readme↵↵Why not incorporating this into the language?
20:20:24FromDiscord<ShalokShalom> It could help making the language available on all platforms, just with one binary.
20:20:55FromDiscord<Rika> Doesn’t work for GUI applications
20:21:03FromDiscord<Rika> Also I can’t sleep lol good luck to me today I guess
20:21:46*xet7 quit (Remote host closed the connection)
20:22:32FromDiscord<Rika> M8 I’m not staying up for another 30 hours
20:22:40FromDiscord<gerwy> yes go to sleep
20:22:43FromDiscord<gerwy> drink tea and sleep
20:22:54FromDiscord<Rika> No, it’s kinda a bit too late now
20:23:08FromDiscord<Rika> I could prolly nap for two or three hours if I can even fall asleep
20:24:15FromDiscord<enthus1ast> whats up @Rika ?
20:24:38FromDiscord<Rika> It’s been an hour or so and I couldn’t fall asleep that’s all
20:24:57FromDiscord<Rika> Prolly gonna stay up again unless I could nap
20:26:14FromDiscord<enthus1ast> put you digital devices away \:)
20:26:58FromDiscord<Rika> That’s not my issue, I have for the whole hour
20:28:42FromDiscord<ShalokShalom> Light blocks the release of the sleep hormone.
20:48:16FromDiscord<morgan> ok so im just a little unsure what to do. i have two tables in an object that have ref objects as the value. do i need to do anything more than declare the object and its inputs? i had read something with `new()` but i can't find anything that fully addresses this
20:49:06*LuxuryMode joined #nim
20:49:30FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#ix=3UjE
20:49:57FromDiscord<morgan> (edit) "https://play.nim-lang.org/#ix=3UjE" => "https://paste.rs/qLi"
20:50:07FromDiscord<morgan> that isn't the code exactly
20:50:24FromDiscord<morgan> it's spread over two files and a bunch of unnecessary stuff
20:50:26FromDiscord<creikey> sent a code paste, see https://paste.rs/iSl
20:50:30FromDiscord<creikey> (edit) "https://play.nim-lang.org/#ix=3UjF" => "https://play.nim-lang.org/#ix=3UjG"
20:53:08FromDiscord<demotomohiro> You can write `flagShort['a'] = FlagVariantRef(...)`
20:54:35FromDiscord<morgan> so there's actually 4 tables, two pairs based on whether its shared with subcommands or not, and then short and long separately
20:54:59FromDiscord<demotomohiro> @creikey https://nim-lang.org/docs/with.html
20:55:01FromDiscord<morgan> https://media.discordapp.net/attachments/371759389889003532/960643677028511804/unknown.png
20:55:12*lain quit (Quit: kthxbai)
20:55:44*lain joined #nim
20:55:47*jjido joined #nim
21:01:23FromDiscord<demotomohiro> You can create object/ref object types like `Foo(fieldName: value)` : https://nim-lang.org/docs/manual.html#types-object-construction
21:02:43FromDiscord<demotomohiro> Then you can put it on `table`.
21:04:17FromDiscord<demotomohiro> @morgan Your code looks fine.
21:11:00FromDiscord<creikey> In reply to @demotomohiro "<@180866243819995136> https://nim-lang.org/docs/wit": is there this but it only uses the argument of `with` if it works in the function?
21:11:09FromDiscord<creikey> so you can have like a `with d:` and other non-d-using functions in the scope
21:18:39FromDiscord<morgan> In reply to @demotomohiro "<@277133333773811712> Your code looks": cool thanks
21:18:48FromDiscord<demotomohiro> How people see if it is a function called with d or not under `with d:`?
21:26:08FromDiscord<demotomohiro> If you want to mix procedures that take an argment of `with` and procedures that doesn't take under `with`, I think you need to implement it yourself.
21:36:06FromDiscord<ShalokShalom> I dont really understand, what the ref keyword is supposed to mean
21:36:24*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
21:36:24FromDiscord<ShalokShalom> I assume, it means reference?
21:36:57FromDiscord<ShalokShalom> And then, the docu says something about "Built-in generic traced pointer type." which does not really say anything about it to me.
21:40:37FromDiscord<demotomohiro> `ref T` means it is a reference to T allocated on heap and actually it is a pointer managed by Nim's memory management.
21:41:00FromDiscord<ShalokShalom> And shouldnt it be called "generically traced"?
21:41:25FromDiscord<ShalokShalom> So I need it for manual memory management?
21:42:07*vicfred joined #nim
21:42:55*wyrd quit (Ping timeout: 240 seconds)
21:43:19FromDiscord<demotomohiro> I think it is called generic because it can be used to reference any types.
21:44:27FromDiscord<demotomohiro> I think traced means Nim's GC manages `ref` types.
21:44:41FromDiscord<ShalokShalom> pfft
21:44:51FromDiscord<ShalokShalom> Is it important for a newbie?
21:44:57FromDiscord<morgan> yeah so ref works with the GC, ptr is ignored by it and you have to do more if you want to have it help you out
21:45:13FromDiscord<morgan> that's my understanding as a newb
21:45:28FromDiscord<morgan> well, maybe moving past newb
21:45:39FromDiscord<morgan> but recent newb at least
21:46:38FromDiscord<ShalokShalom> Isnt the point of GC that I dont need to care about?
21:46:40FromDiscord<demotomohiro> If you want to do manual memory management, you can use `ptr T`. It is just a pointer that Nim's GC do nothing to it.
21:46:46FromDiscord<ShalokShalom> Aha.
21:49:51FromDiscord<demotomohiro> I think the point of GC is heap is freed automatically when it is no longer used.
21:49:57*wyrd joined #nim
21:59:53FromDiscord<ShalokShalom> The point of gc is so you dont have to free and allocate memory yourself↵↵Basically, think about memory
22:06:48*arkanoid quit (Ping timeout: 252 seconds)
22:07:03*om3ga quit (Remote host closed the connection)
22:07:13*ozzz joined #nim
22:20:02FromDiscord<Elegantbeef> I mean you can also use GC'd memory like memory allocations
22:22:21FromDiscord<Elegantbeef> `GCRef` and `GCUnref` let you make references stay alive longer and then deallocate them later when you get them back from pointer
22:28:37NimEventerNew thread by ElegantBeef: This Month with Nim - March and Feburary, see https://forum.nim-lang.org/t/9073
22:40:36FromDiscord<creikey> In reply to @demotomohiro "How people see if": called with d if it makes sense to call with d
22:41:00FromDiscord<creikey> as in you can do with d: and make draw calls which use the d context and also do other math
22:41:53FromDiscord<Elegantbeef> Creikey did you see my long list of suggestions or just the ones i pinged you with?
22:48:03FromDiscord<ShalokShalom> sent a long message, see http://ix.io/3Ukz
22:48:32FromDiscord<ShalokShalom> So proc 1 with a parameter T1 would obviously mix with proc 2 with a T1 para
22:48:47FromDiscord<ShalokShalom> Or how is this?
22:49:01FromDiscord<demotomohiro> Nim's procedure overload picks the procedure based on a number and types of argument, but it seems you are asking to pick arguments based on defined procedures. @creikey
22:49:04FromDiscord<Elegantbeef> What do you mean?
22:49:48FromDiscord<Elegantbeef> If you want the generics to bind to the same type you have to explicitly do it, not use auto
22:50:20FromDiscord<Elegantbeef> Auto as it says emits a generic parameter for each parameter, whereas explicit generics do not
22:50:27FromDiscord<huantian> If you’re asking if having multiple procs with the same generic name effect each other, they do not
22:50:43FromDiscord<huantian> Each generic name is scoped to the individual proc
22:50:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UkD
22:51:36FromDiscord<Elegantbeef> Nim has many mechanisms for resolving ambiguity anyway
22:51:42*jkl quit (Quit: Gone.)
22:52:08*arkanoid joined #nim
22:52:34FromDiscord<demotomohiro> @creikey Maybe creating a template that takes `d` and a code block, and define draw templates work without taking `d` that can be used only in the code block.
22:52:54FromDiscord<Elegantbeef> What are we trying to solve?
22:53:04*jkl joined #nim
22:54:12FromDiscord<Elegantbeef> Is it just the "pass `d` as the first parameter to a bunch of calls"?
22:55:21FromDiscord<ShalokShalom> In reply to @huantian "If you’re asking if": So they would clash, if I am trying to combine different instances of T1?
22:55:39FromDiscord<Elegantbeef> What do you mean?
22:56:20FromDiscord<ShalokShalom> @Elegantbeef#0000 As I read the linked documentation, is your example not correct
22:56:28FromDiscord<ShalokShalom> Or am I reading it wrong
22:56:30FromDiscord<Elegantbeef> My example is correct
22:56:46FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/960674318138900520/image.png
22:56:51FromDiscord<Elegantbeef> My example doesnt disagree with that
22:57:00FromDiscord<ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/960674375919607888/Screenshot_2022-04-05-00-56-53-97.jpg
22:57:09FromDiscord<Elegantbeef> Yes my example agrees with that
22:57:25FromDiscord<Elegantbeef> `# a does not change B's type`
22:58:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UkF
22:58:43FromDiscord<Elegantbeef> I do not get what the confusion is from shalok, can you elaborate what you're asking about?
22:59:28FromDiscord<Elegantbeef> auto generates a generic parameter per parameter, so if you want them to be the same type you need to be explicit
23:00:00FromDiscord<demotomohiro> If you have a proc `foo(a: auto) = echo a` and call it like `foo(1)` and foo("abc"), Nim creates `foo(a: int) = echo a` and `foo(a: string) = echo a`. It is not a problem as Nim have overloading.
23:01:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UkH
23:01:27FromDiscord<Elegantbeef> Nim chooses the most specialised procedure on dispathc
23:01:30FromDiscord<Elegantbeef> dispatch even
23:02:54FromDiscord<demotomohiro> If you call `foo(1)` and `foo(2)`, Nim creates `proc foo(a: int) = echo a` only when `foo(1)` is used and `foo(2)` just calls it.
23:03:21FromDiscord<Elegantbeef> I dont even know what we're talking about
23:03:55FromDiscord<ShalokShalom> In reply to @Elegantbeef "`# a does not": It doesnt say anything about that
23:04:03FromDiscord<ShalokShalom> Where do you read this?
23:04:18FromDiscord<Elegantbeef> It says that
23:04:30FromDiscord<Elegantbeef> `proc name[T1,T2](a: T1, b: T2)`
23:04:32FromDiscord<Elegantbeef> It says it right htere
23:04:45FromDiscord<Elegantbeef> Each parameter gets it's own generic parameter which means `a` does not change `b`'s type
23:05:08FromDiscord<ShalokShalom> In reply to @Elegantbeef "auto generates a generic": This comes probably down to me not understanding generic types in general
23:05:25FromDiscord<Elegantbeef> generics in nim are just templates basically that are emitted on first call
23:05:43FromDiscord<Elegantbeef> So when you get a generic it's specialiized for the given types and instantiated
23:05:58FromDiscord<Elegantbeef> It's called monomorphism i believe
23:06:41FromDiscord<demotomohiro> Nim generics is similar to C++'s template.
23:06:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UkM
23:06:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UkN
23:06:59FromDiscord<Elegantbeef> Eh dont bring in other languages
23:07:06FromDiscord<ShalokShalom> In reply to @Elegantbeef "Each parameter gets it's": But how is this different with auto then?
23:07:14FromDiscord<ShalokShalom> It says clearly it is the same
23:07:29FromDiscord<Elegantbeef> the comparison was with `proc name[T](a, b: T)`
23:07:42FromDiscord<Elegantbeef> Notice how `a` and `b` are assigned `T` as their type?
23:07:58FromDiscord<Elegantbeef> That means if `a is int` b also has to be
23:08:29FromDiscord<ShalokShalom> You said the two examples are different
23:08:43FromDiscord<Elegantbeef> So anyway when you do `MyObject[float]()` what happens is nim types that type definition and replaces `T` with `float`
23:08:48FromDiscord<Elegantbeef> Did you fucking read my message?
23:08:57FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/960677384649076838/image.png
23:09:01FromDiscord<demotomohiro> !eval proc foo(a, b: auto) = echo typeof(a), typeof(b); foo(1, "2")
23:09:03NimBot<no output>
23:09:13FromDiscord<Elegantbeef> Look at the code in that image i just linked
23:09:15FromDiscord<ShalokShalom> My head hurts
23:09:38FromDiscord<Elegantbeef> Generics are simply "Replace all instances of `T ` with my instantiated argument"
23:10:09FromDiscord<Elegantbeef> They arent that complicated really, it's just "we're using X symbol for placeholder of what we're getting passed, when we get that we replace that with our symbol"
23:10:12FromDiscord<ShalokShalom> I just recognized right now, that you sneaked in a T
23:10:24FromDiscord<ShalokShalom> I assumed, you would have just copied the example
23:10:33FromDiscord<Elegantbeef> The example isnt what i wanted to explain
23:10:49FromDiscord<Elegantbeef> The example explains each parameter gets it's own generic parameter
23:10:58FromDiscord<Elegantbeef> I was explaining how to bind multiple parameters to the same type
23:10:58FromDiscord<ShalokShalom> I still dont understand, why you have brought this up
23:11:47FromDiscord<Elegantbeef> I brought it up cause your question made no sense and i thought explaining how generic parameters worked would help
23:11:58FromDiscord<Elegantbeef> But apparently that was a fools errand
23:12:12FromDiscord<Elegantbeef> What even is your question
23:12:44FromDiscord<ShalokShalom> If I am using auto all over the place, would that provide some kind of type safety?
23:12:53FromDiscord<Elegantbeef> Well yes Nim is statically typed
23:13:05FromDiscord<Elegantbeef> It's very annoying to use
23:13:11FromDiscord<Elegantbeef> But yes you still have static type safety
23:13:31FromDiscord<ShalokShalom> Well, that doesnt change anything about the fact, that a statically typed program with just string types and nothing else provides zero type safety
23:13:44FromDiscord<Elegantbeef> What?
23:14:05FromDiscord<ShalokShalom> If all the types are the same, it wont prevent type mismatch
23:14:15FromDiscord<Elegantbeef> But they arent all the same
23:14:18FromDiscord<ShalokShalom> Does auto all over the place prevent type mismatch
23:14:24FromDiscord<Elegantbeef> No
23:14:32FromDiscord<ShalokShalom> Well, if they are on auto, they are all T1, T2
23:14:35FromDiscord<Elegantbeef> `auto` isnt type erasure
23:14:50FromDiscord<Elegantbeef> T1, and T2 are inferred or explicitly got from procedure instantiation
23:15:01FromDiscord<ShalokShalom> So the type generated by T1, etc do produce unique types
23:15:34FromDiscord<ShalokShalom> It would be so much cooler, if it would be inferred from the body
23:15:44FromDiscord<Elegantbeef> Well they're placeholder names of the actual type
23:15:45FromDiscord<Elegantbeef> `myObjFloat.doThing` erros
23:15:46FromDiscord<Elegantbeef> cause `field` is of type `float` and you're attempting to assign `int`
23:15:46FromDiscord<ShalokShalom> I hope that comes, as considered in the docs
23:15:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UkO
23:15:57FromDiscord<Elegantbeef> Concepts exist
23:16:08FromDiscord<huantian> or just↵write out the types you want the arguments to be
23:16:16FromDiscord<Elegantbeef> Inferred would be nice, but concepts are nice
23:16:28FromDiscord<Elegantbeef> So until we get inferred be cool and use conceepts
23:16:29FromDiscord<ShalokShalom> 🤯
23:17:07FromDiscord<Elegantbeef> There we go
23:17:09FromDiscord<Elegantbeef> Much nicer
23:17:12FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/K9X
23:17:25FromDiscord<Elegantbeef> Dont eve need `int(300)` now
23:17:29FromDiscord<Elegantbeef> We statically know it's an int
23:18:30FromDiscord<ShalokShalom> Instead of (int) could I also use my custom type?
23:18:37FromDiscord<Elegantbeef> Of course
23:18:38FromDiscord<ShalokShalom> default is a keyword here?
23:19:00FromDiscord<Elegantbeef> We'll say it's a keyword
23:19:04FromDiscord<Elegantbeef> It's not really, but we'll say it
23:19:20FromDiscord<Elegantbeef> It's a procedure which returns the 0'd value of a type
23:19:59FromDiscord<Elegantbeef> You might say "well this is more typing than auto" but personally having a concrete explanation of what a type needs to implements is much nicer than auto
23:20:31FromDiscord<Elegantbeef> you can also do like `d.someProc("", 3d, 3d)`
23:21:17FromDiscord<ShalokShalom> One is more horrible than the other
23:21:36FromDiscord<Elegantbeef> Yea `auto` fucking sucks
23:30:33FromDiscord<jmgomez> hey guys, super noob question. Im testing out the import of a cpp header file. I have my header file alongside the nim one and Im compiling it with cpp. What else I suppose to do in order to get it compiling?
23:30:58FromDiscord<Elegantbeef> Afaik that should be it
23:32:09FromDiscord<Elegantbeef> Actually you might need to tell nim to compile the C file or link a shared library
23:32:21FromDiscord<Elegantbeef> C++ file\
23:32:31FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma if you havent looked already
23:32:44FromDiscord<ShalokShalom> sent a long message, see http://ix.io/3UkU
23:32:50FromDiscord<Elegantbeef> types are lovely
23:33:01FromDiscord<ShalokShalom> Types are lovely
23:33:14FromDiscord<Elegantbeef> Explicit types give a clear and concise requirement of API
23:33:22FromDiscord<Elegantbeef> `auto` is noise and doesnt help
23:33:32FromDiscord<Elegantbeef> No i dont want to run a docgen on all my code
23:33:44FromDiscord<ShalokShalom> Nothing in the way Nim presents types is not noise.
23:34:09FromDiscord<Elegantbeef> I mean let's look at concepts
23:34:18FromDiscord<Elegantbeef> It gives an explicit requirement of types to match
23:34:37FromDiscord<Elegantbeef> You cannot get that automatically without modifying source code or tools
23:34:44FromDiscord<jmgomez> That's the error Im getting https://media.discordapp.net/attachments/371759389889003532/960683870477504582/message.txt
23:34:46FromDiscord<Elegantbeef> And those two things are tedious to worry about
23:35:14FromDiscord<huantian> I don't think i've ever thought about using auto for param typing ever
23:35:29FromDiscord<Elegantbeef> Me either
23:35:35FromDiscord<Elegantbeef> Maybe as a work around to a compiler bug
23:36:00FromDiscord<Elegantbeef> So is this a `hpp` and `cpp` file?
23:36:11FromDiscord<Elegantbeef> If so you might need `{.compiler: "myfile.cpp".}`
23:36:16FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UkV
23:36:26FromDiscord<Elegantbeef> Ah thanks let me give this a whirl
23:36:43FromDiscord<jmgomez> I tried with compiler but it didnt seem to pick it
23:36:57FromDiscord<huantian> Like \~70% of the time you can just specify the type directly with the name↵and the rest you just use generics and concepts
23:38:25FromDiscord<huantian> I think it would be a bit overkill to say that all types in nim are horrible though
23:38:25FromDiscord<Elegantbeef> Hmm it works here i think
23:38:28FromDiscord<ShalokShalom> @huantian#0000 That was not what was the discussion about
23:38:52FromDiscord<Elegantbeef> atleast with `test.cpp` as the file name
23:39:14FromDiscord<Elegantbeef> Ah works with `.h` aswell
23:39:19FromDiscord<Elegantbeef> These are next to eachother right?
23:39:22FromDiscord<ShalokShalom> In reply to @Elegantbeef "You cannot get that": Yeah, and its still a horrible choice compared to full type inference.
23:39:29FromDiscord<Elegantbeef> It's really not
23:39:33FromDiscord<ShalokShalom> Like no solution at all.
23:40:23FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=3UkW
23:40:48FromDiscord<huantian> you have to specify that a and b are the types you want
23:41:06FromDiscord<jmgomez> aghh I might have something going on because I changed the name of the files and now the linker is complaining about a duplicated name :/
23:43:05FromDiscord<huantian> what is this in response too?↵(@ShalokShalom)
23:44:26FromDiscord<Elegantbeef> it'ss even worse haun, you cannot use static values for optimizations either
23:44:30FromDiscord<Elegantbeef> Or protection
23:44:37FromDiscord<Elegantbeef> Want to only allow a `0..10`in your procedure
23:44:45FromDiscord<Elegantbeef> Well now you need to do `assert myVal in 0..10`
23:44:50FromDiscord<Elegantbeef> Fuck yea i love tedium!
23:45:41FromDiscord<jmgomez> I got it working, I seems like the compile directive was adding the file again and also it seems like the imported class needs to have a different name in nim (which kinda makes sense). Thanks!
23:45:42FromDiscord<ShalokShalom> In reply to @huantian "you have to specify": A and b are parameter names, not types
23:45:44FromDiscord<Elegantbeef> Yea jmgomez it works here so cannot say much
23:45:54FromDiscord<abdu> sent a long message, see http://ix.io/3UkY
23:46:01FromDiscord<ShalokShalom> And there are languages with full type inference
23:46:19FromDiscord<abdu> (edit) "https://paste.rs/H1N" => "https://paste.rs/Oby"
23:46:21FromDiscord<Elegantbeef> Do they have sub range types?
23:46:45FromDiscord<Elegantbeef> abdu `import std/strutils; echo o.join()`
23:46:50FromDiscord<abdu> (edit) "http://ix.io/3Ul0" => "http://ix.io/3UkZ"
23:46:54FromDiscord<huantian> If a language did have full type inference I woudl probably not use that↵typing parameters and return types are great for making self documenting code
23:46:58FromDiscord<abdu> (edit) "http://ix.io/3UkZ" => "http://ix.io/3Ul1"
23:47:30FromDiscord<Elegantbeef> Const generic dispatch and subrange types cant really be done in "typeless" code
23:47:47FromDiscord<Elegantbeef> you cannot really infer something is supposed to be in a range unless there is a range check 😛
23:48:23FromDiscord<Elegantbeef> `proc doThing(s: static string)` i guess can be inferred due to \`when s == "hello"\~
23:49:33FromDiscord<huantian> I think I just don’t see why specifying that a proc takes a string and returns an int is bad
23:49:54FromDiscord<konsumlamm> Haskell actually encourages type annotations for top level definitions, despite having full type inference
23:49:55FromDiscord<Elegantbeef> Well i see that it harms code reuse but not all functions can be reused
23:50:23FromDiscord<ShalokShalom> @huantian#0000 http://www.fssnip.net/86m
23:50:46FromDiscord<ShalokShalom> In reply to @konsumlamm "Haskell actually encourages type": Haskell recommends type declarations everywhere
23:50:57FromDiscord<ShalokShalom> FSharp does it, as you say
23:51:07FromDiscord<Elegantbeef> In the case procedures can be reused use concepts
23:51:08FromDiscord<Elegantbeef> If the procedure cannot be reused use types, since it gives an explicit requirement to use it
23:51:33FromDiscord<konsumlamm> In reply to @ShalokShalom "Haskell recommends type declarations": not really, just for top level definitions
23:51:53FromDiscord<ShalokShalom> In reply to @Elegantbeef "Do they have sub": I really dont care.
23:52:13FromDiscord<Elegantbeef> Ah nice
23:52:14FromDiscord<ShalokShalom> In reply to @konsumlamm "not really, just for": Thats not how 99% of all Haskell code I see.
23:52:23FromDiscord<ShalokShalom> Top level definitions make sense
23:52:41FromDiscord<ShalokShalom> I know one web framework, that encourages ditching them all together
23:53:27FromDiscord<Elegantbeef> Does F# have static parameters?
23:53:30FromDiscord<ShalokShalom> IHP - Integrated Haskell Platform