00:03:18 | FromDiscord | <Bung> "the generic signed integer type; its size is platform-dependent and has the same size as a pointer. This type should be used in general. An integer literal that has no type suffix is of this type if it is in the range low(int32)..high(int32) otherwise the literal's type is int64." |
00:04:06 | FromDiscord | <Bung> I guess this need to be fixed as well |
00:56:39 | FromDiscord | <hmmm> yo broskis! long time no see! check this : https://play.nim-lang.org/#ix=4fLg |
00:56:51 | * | arkurious quit (Quit: Leaving) |
00:57:10 | FromDiscord | <hmmm> now explain to me why it doesn't work like I expect to, very slowly and with pictures ๐ |
00:59:10 | FromDiscord | <tangonov> Ugh this language sucks, I don't want to write with anything else. |
01:05:36 | FromDiscord | <Elegantbeef> Lol what a problem to have |
01:06:25 | FromDiscord | <Rika> In reply to @hmmm "yo broskis! long time": it parses correctly (because the bounds checking is not part of the parsing) |
01:06:29 | FromDiscord | <Elegantbeef> The issue hmmm is that the `parse` proc doesnt sanitise the values before converting to the range so you get a range defect |
01:06:42 | FromDiscord | <Rika> "correctly" |
01:07:03 | FromDiscord | <Rika> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/times.nim#L1349โตthis is where you get the bounds error |
01:07:12 | FromDiscord | <Rika> sorry, the line below that |
01:07:30 | FromDiscord | <Elegantbeef> This is an issue with Nim range types nothing tells you to properly handle them |
01:07:33 | FromDiscord | <Rika> tries to write 61 to a 0..59 type |
01:07:48 | FromDiscord | <Elegantbeef> `range = int` should raise a warning |
01:09:18 | FromDiscord | <hmmm> rika and beefy my faves broskies! can chuck in some kind of except RangeDefectError or smth? |
01:09:24 | FromDiscord | <Elegantbeef> Nope |
01:09:36 | FromDiscord | <Elegantbeef> I mean you can but defects are not meant to be caught |
01:10:08 | FromDiscord | <Rika> how delightful innit |
01:10:09 | FromDiscord | <Elegantbeef> Given your simple scheme i'd use simple parsing to handle this |
01:11:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fLi |
01:11:52 | FromDiscord | <Elegantbeef> Atleast for this simple case |
01:12:10 | FromDiscord | <Elegantbeef> I love scantuple for this shit |
01:12:17 | FromDiscord | <Elegantbeef> 10/10 idea from me ๐ |
01:13:17 | FromDiscord | <hmmm> 7/10 because you used scantuple I had no idea existed before 10 seconds ago. I bet there is an easier version with tools I've seen in my life before and you are just scamming me like usual beefy ๐ |
01:13:46 | FromDiscord | <Elegantbeef> As much as i like range types i'm starting to think `type Range[T: static Slice[auto]] = distinct typeof(T.a)` |
01:13:51 | FromDiscord | <Elegantbeef> Is jusut better |
01:13:55 | FromDiscord | <Elegantbeef> just even ๐ |
02:03:00 | FromDiscord | <.tochka> is there some thing to convert signed integer type to its unsigned counterpart |
02:03:17 | FromDiscord | <Elegantbeef> Bitwise or value? |
02:03:34 | FromDiscord | <.tochka> type itself |
02:03:47 | FromDiscord | <.tochka> want to cast based on size, generically |
02:03:51 | FromDiscord | <Elegantbeef> `cast[uint](myInt)` to do bitwise conversion `uint(myInt)` for value |
02:03:51 | FromDiscord | <amadan> https://nim-lang.github.io/Nim/typetraits.html#toUnsigned.t%2Ctypedesc%5B%5DโตMaybe this? |
02:04:08 | FromDiscord | <Elegantbeef> Yea that'd do it |
02:04:15 | FromDiscord | <Elegantbeef> Also spot the #devel user ๐ |
02:04:26 | FromDiscord | <.tochka> In reply to @amadan "https://nim-lang.github.io/Nim/typetraits.html#toUn": thank you |
02:04:53 | FromDiscord | <amadan> In reply to @Elegantbeef "Also spot the #devel": lol, I like life on the edge ๐ |
02:29:43 | FromDiscord | <scarf> weird, it gets installed normally in choosenim `stable` but crashes on locally built `devel` https://media.discordapp.net/attachments/371759389889003532/1041178013129252914/err.log |
02:31:57 | FromDiscord | <Rika> stable and devel are very different.... |
02:32:28 | FromDiscord | <Elegantbeef> Ugh that might be on me ๐ |
02:33:41 | FromDiscord | <Elegantbeef> Ansiwave cannot install on devel due to Error\: 'recvAction' is not GC-safe as it calls 'search' |
02:34:15 | FromDiscord | <Elegantbeef> No clue how you get that mSlice error, but if you can compile it with Nim and show the code it errors on that'd be great |
02:37:13 | FromDiscord | <scarf> In reply to @Elegantbeef "No clue how you": alright, you mean cloning nimwave and compiling it locally, right? |
02:41:40 | FromDiscord | <Elegantbeef> I just install `nimwave` through nimble |
02:41:45 | FromDiscord | <Elegantbeef> I thought that was ansiwave i cannot read |
02:41:49 | FromDiscord | <Elegantbeef> Update your devel |
02:41:53 | FromDiscord | <Elegantbeef> `choosenim update devel` |
02:47:39 | FromDiscord | <scarf> is it different from `choosenim ~/repo/nim`? |
02:48:09 | * | wallabra joined #nim |
02:50:10 | FromDiscord | <Elegantbeef> It |
02:50:12 | FromDiscord | <Elegantbeef> 's a nighly build |
02:50:23 | FromDiscord | <Elegantbeef> It worked here with `8e1181bde593ba3ab4409f1454a7b7280b659cd0` |
03:04:27 | * | wallabra_ joined #nim |
03:05:47 | * | wallabra quit (Ping timeout: 256 seconds) |
03:05:50 | * | wallabra_ is now known as wallabra |
03:47:24 | * | jjido joined #nim |
03:51:53 | * | jjido quit (Client Quit) |
04:00:11 | FromDiscord | <!&luke> In reply to @amadan "lol, I like life": Same |
04:29:24 | FromDiscord | <scarf> In reply to @Elegantbeef "It worked here with": heck, weird but recompiling from latest commit worked |
04:29:26 | NimEventer | New post on r/nim by bouffy_hairdo: Idiomatic, standard Nim codebase for beginner to look at, see https://reddit.com/r/nim/comments/ytrqq3/idiomatic_standard_nim_codebase_for_beginner_to/ |
04:40:38 | FromDiscord | <Elegantbeef> Might've been on a weird commit inbetween my PRs? |
04:41:12 | FromDiscord | <scarf> In reply to @Elegantbeef "Might've been on a": not sure, on commit `1410243d3bd5a5898bea2130e2f3534bd23f5c04` which is latest |
04:41:43 | FromDiscord | <Rika> bisect time? |
04:42:30 | FromDiscord | <Elegantbeef> They said it worked on latest |
04:42:33 | FromDiscord | <Elegantbeef> So is it really an issue? |
04:42:41 | FromDiscord | <scarf> i guess not? |
04:42:55 | FromDiscord | <scarf> (edit) "not?" => "not?โตit works on upstream/devel HEAD and I'" |
04:43:06 | FromDiscord | <scarf> (edit) "upstream/devel" => "`upstream/devel`" | "I'" => "I'm happy with it" |
04:44:40 | FromDiscord | <scarf> now back to finally implementing <https://www.youtube.com/watch?v=55iwMYv8tGI> on nim... |
04:45:18 | * | rockcavera quit (Remote host closed the connection) |
04:46:31 | FromDiscord | <ringabout> Make sure you clean up the nimcache of the compiler and pre-built binary, which can have surprising side effects, |
04:46:43 | FromDiscord | <scarf> oh, that might be the case, thank you. |
05:07:59 | * | wallabra quit (Ping timeout: 260 seconds) |
05:12:28 | FromDiscord | <Mr.Ender> what hashing algorithm does std/hashes use |
05:13:59 | FromDiscord | <ringabout> In reply to @Mr.Ender "what hashing algorithm does": https://github.com/wangyi-fudan/wyhash |
05:14:19 | * | jjido joined #nim |
05:17:59 | FromDiscord | <ringabout> Though, the Nim port can be updated to v4. |
05:18:09 | FromDiscord | <Mr.Ender> ok |
05:18:10 | * | wallabra joined #nim |
05:18:13 | FromDiscord | <Mr.Ender> thanks |
05:19:14 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzโฆ) |
05:19:29 | FromDiscord | <ChocolettePalette> You're welcome |
05:51:56 | FromDiscord | <.tochka> std memory allocation functions are supposed to raise defects on error right? so there's no way to catch allocation errors or im missing something |
05:52:43 | FromDiscord | <Rika> should be so |
06:07:36 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fM5 |
06:11:47 | FromDiscord | <.tochka> unpack package might work |
06:12:24 | FromDiscord | <.tochka> gotta do some macro magic otherwise |
06:13:31 | FromDiscord | <Elegantbeef> What's `data`? |
06:14:22 | FromDiscord | <.tochka> string, i imagine |
06:20:48 | FromDiscord | <Elegantbeef> Meh doesnt matter there isnt much of a better way |
06:24:41 | FromDiscord | <Elegantbeef> There is a tinge better way for if you dont mind not supporting JS |
06:28:16 | FromDiscord | <Elegantbeef> Actually never mind |
06:29:13 | FromDiscord | <scarf> In reply to @Elegantbeef "What's `data`?": nimpng raw data |
06:29:33 | FromDiscord | <Elegantbeef> So bytes |
06:31:00 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fM8 |
06:31:40 | FromDiscord | <Rika> const |
06:31:43 | FromDiscord | <Rika> use let |
06:31:51 | FromDiscord | <.tochka> or static begin ;p |
06:32:12 | FromDiscord | <Rika> requires effort lol |
06:32:21 | FromDiscord | <Rika> id be too lazy |
06:33:10 | FromDiscord | <scarf> alright, so parameter wasn't comptimeโตI'm not sure if this is idiomatic nim code tho |
06:33:45 | FromDiscord | <.tochka> HSlice could be nicer than tuple probably |
06:38:41 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fM9 |
06:39:19 | FromDiscord | <Elegantbeef> `let foo = 0..100` |
06:42:05 | FromDiscord | <scarf> sent a code paste, see https://paste.rs/j3C |
06:44:27 | FromDiscord | <.tochka> nice |
06:52:56 | FromDiscord | <Elegantbeef> `func normalize[T](num: T, begin, to: static Slice[T]): T` write less ๐ |
06:53:24 | FromDiscord | <scarf> that's nicer. can a func be conditionally consteval? |
06:54:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/lt3 |
06:55:03 | FromDiscord | <Elegantbeef> Also not called consteval here it's just 'static' ๐ |
06:55:35 | FromDiscord | <scarf> thx, are there any difference with `or` or `|`? ` begin, to: Slice[T] | static Slice[T]` |
06:55:56 | FromDiscord | <Elegantbeef> I prefer `or` they're identical |
06:59:06 | * | Guest30 joined #nim |
06:59:08 | FromDiscord | <scarf> thanks for all the help, here's an ugly script that prints ascii stuff https://media.discordapp.net/attachments/371759389889003532/1041245810945445888/image.png https://media.discordapp.net/attachments/371759389889003532/1041245811301945384/nimapple.nim |
06:59:29 | FromDiscord | <Elegantbeef> It's not a script ๐ |
06:59:50 | FromDiscord | <scarf> In reply to @Elegantbeef "*It's not a script*": it is! <https://nim-lang.org/docs/nims.html> |
07:00:54 | * | Guest30 quit (Client Quit) |
07:00:55 | FromDiscord | <Yardanico> In reply to @scarf "thanks for all the": finally, bad apple with Nim |
07:01:01 | FromDiscord | <Yardanico> In reply to @scarf "it is! <https://nim-lang.org/docs/nims.html>": surprised nimpng works with nimscript |
07:02:34 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4fMf |
07:02:40 | FromDiscord | <ringabout> What does `return 1` mean? |
07:03:01 | FromDiscord | <ringabout> Shouldn't it use exit 1? |
07:03:22 | FromDiscord | <Elegantbeef> Wow it's yardanico |
07:03:37 | FromDiscord | <Yardanico> wow |
07:03:52 | FromDiscord | <Yardanico> beef is still beef |
07:04:00 | FromDiscord | <Elegantbeef> Fuck dont tell beef |
07:05:39 | FromDiscord | <Elegantbeef> Yard you can see the discord join statistics right? |
07:06:11 | FromDiscord | <Elegantbeef> if so what's the spike from that popular youtube video |
07:06:29 | FromDiscord | <Yardanico> yeah there was a spike, not a big one though |
07:06:43 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1041247726341459988/image.png |
07:06:50 | FromDiscord | <Yardanico> I mean it is big compared to usual joins, like 4x |
07:06:57 | FromDiscord | <Yardanico> this is daily stats |
07:07:03 | FromDiscord | <Elegantbeef> Yea not as substantiate as one would imagine |
07:08:34 | FromDiscord | <Yardanico> I'm surprised people still use the invite, I wonder which one |
07:48:34 | * | dnh joined #nim |
08:02:18 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4fMq |
08:03:04 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4fMq" => "https://paste.rs/ckg" |
08:04:04 | FromDiscord | <FetchBot> whats the right channel for just asking general questions that don't really fall into a specific category |
08:04:22 | FromDiscord | <Phil> is it about nim syntax? Here |
08:04:41 | FromDiscord | <Phil> Is it about other programming languages or non coding topics? offtopic |
08:05:04 | FromDiscord | <Yardanico> In reply to @Isofruit "hmmm nimqml seems to": Try with `--mm:refc` on devel, since ARC/ORC is the new default |
08:05:24 | FromDiscord | <Yardanico> But the issue here usually is the object destructor being generated before the constructor proc was written |
08:05:28 | FromDiscord | <spoon> oh nim 2 is devel branch? |
08:05:33 | FromDiscord | <Yardanico> In reply to @spoon "oh nim 2 is": yes |
08:05:40 | FromDiscord | <Yardanico> nim devel always has the newest in-development Nim |
08:05:42 | FromDiscord | <Phil> Aye, I tend to compile everything with devel nowadays |
08:05:55 | FromDiscord | <Phil> Mostly because there are a couple library fixes that I refuse to do without |
08:07:46 | FromDiscord | <FetchBot> sent a code paste, see https://play.nim-lang.org/#ix=4fMu |
08:08:04 | FromDiscord | <Phil> In reply to @Yardanico "Try with `--mm:refc` on": Ohhh yeah that is the issue, I tend to compile everything ever always with ORC so I didn't even think it could be memory management related |
08:09:11 | FromDiscord | <Yardanico> In reply to @FetchBot "I'm hoping someone can": Interesting, going to look a bit, never seen such an error |
08:09:46 | FromDiscord | <Elegantbeef> I'll blame it on using `const` for ref objects |
08:09:48 | FromDiscord | <Yardanico> maybe it's https://github.com/nim-lang/Nim/issues/11268 |
08:10:12 | FromDiscord | <Yardanico> "const objects are not allowed to inherit and are not allowed to have case in them, the compiler's error message should say so, but doesn't." |
08:10:32 | FromDiscord | <Yardanico> In reply to @FetchBot "I'm hoping someone can": If you change it to `let` it'll work, do you require this code to work at compile-time ? |
08:10:43 | FromDiscord | <Yardanico> `const` in Nim means computed at compile-time, it's not related to scope as in some other languages |
08:12:14 | FromDiscord | <FetchBot> ye, that seems to be it. thank you ๐ |
08:13:03 | FromDiscord | <Yardanico> Basically `const` means immutable, computed at compile-time, `let` is immutable (unless it's a ref object, then you can mutate its fields) but computed at runtime |
08:13:06 | FromDiscord | <Yardanico> And `var` is runtime and mutable |
08:13:32 | FromDiscord | <Yardanico> There are also some separate things, like you can have a compile-time `var` to be able to mutate it at compile-time (useful for metaprogramming and the like) |
08:14:57 | FromDiscord | <FetchBot> ye, i just defaulted to const coming from typescript, swapped it to let |
08:17:17 | FromDiscord | <Phil> In reply to @FetchBot "ye, i just defaulted": If that's the case please note that there is no equivalent to const from TS.โตThe closest one is `let` but it is imo more similar to Object.freeze than anything else |
08:17:39 | FromDiscord | <Phil> (edit) "TS.โตThe" => "TS, due to const being merely "can not re-assign but can mutate".โตThe" |
08:17:59 | FromDiscord | <Elegantbeef> `let a = someRef` is the same |
08:18:20 | FromDiscord | <Phil> (edit) "else" => "elseโตunless ref object, god I keep forgetting that ref objects screw everything up" |
08:18:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fMw |
08:18:45 | FromDiscord | <Yardanico> Also the new methods for ORC do seem fast and compact |
08:19:00 | FromDiscord | <Yardanico> I was trying to compile older NimES commit where it had methods, and the ORC binary is 3x smaller after stripping |
08:19:08 | FromDiscord | <Yardanico> since no type names by default |
08:19:15 | FromDiscord | <Yardanico> or only very compact ones |
08:19:21 | FromDiscord | <Elegantbeef> Yea it's as fast as refc's iirc |
08:19:25 | FromDiscord | <Elegantbeef> Or faster |
08:19:29 | FromDiscord | <Elegantbeef> Dont recall the benchmarks |
08:21:05 | FromDiscord | <FetchBot> In reply to @Isofruit "If that's the case": for sure ๐ I think the main reason for my confusion was due to where the error was pointing to, its something i will be keeping in mind moving forwords |
08:21:28 | FromDiscord | <Yardanico> yeah that error is not really descriptive |
08:21:51 | FromDiscord | <Elegantbeef> The error is oddly bubbling from the wrong place |
08:23:03 | FromDiscord | <Yardanico> btw @beef https://github.com/nim-lang/Nim/issues/20820 still doesn't seem to work |
08:23:14 | FromDiscord | <Yardanico> I edited the line to ` texts.map((proc(s: string): int)(runeLen)).max` but it still fails |
08:23:21 | FromDiscord | <Yardanico> with ambiguous runeLen |
08:23:29 | FromDiscord | <Elegantbeef> Uhh |
08:23:33 | FromDiscord | <Yardanico> it still thinks it's ambiguous between string and openArray[char] |
08:23:40 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1041267087970160710/image.png |
08:23:57 | FromDiscord | <Yardanico> compiler bug? :P |
08:24:13 | FromDiscord | <Elegantbeef> Seems like it equates the two |
08:24:22 | FromDiscord | <Yardanico> yeah |
08:24:23 | FromDiscord | <Elegantbeef> If you want a PR to Pakku do it properly |
08:24:33 | FromDiscord | <Yardanico> so this isn't really a compiler bug? |
08:24:35 | FromDiscord | <Elegantbeef> Dont use map then max like this is haskell ๐ |
08:24:39 | FromDiscord | <Yardanico> I mean I don't use Pakku myself, just got curious |
08:24:43 | FromDiscord | <Yardanico> It seems to be abandoned anyway |
08:24:47 | FromDiscord | <Elegantbeef> Yea it's likely a compiler bug |
08:24:56 | FromDiscord | <Yardanico> Ah nvm https://github.com/zqqw/pakku is a maintained fork |
08:26:06 | FromDiscord | <Yardanico> also ` texts.mapIt(runeLen(it)).max` will work here too and it's shorter |
08:26:09 | FromDiscord | <Yardanico> Wonder why the original used map |
08:26:19 | FromDiscord | <Elegantbeef> Ugh |
08:26:35 | FromDiscord | <Yardanico> yeah yeah for loop better :P |
08:26:44 | FromDiscord | <Yardanico> I know |
08:26:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fMx |
08:27:03 | FromDiscord | <Elegantbeef> Oh i know you know |
08:27:25 | FromDiscord | <Elegantbeef> you could do `text.applyit(max(it, result))` |
08:27:30 | FromDiscord | <Elegantbeef> If you want to be silly ๐ |
08:27:39 | FromDiscord | <Elegantbeef> Actually dont recall if it has to return a value |
08:27:41 | FromDiscord | <Yardanico> btw weirdly enough https://github.com/zqqw/pakku seems to compile without changes on devel |
08:27:51 | FromDiscord | <Yardanico> wonder why are they trying the original, and not the fork |
08:28:09 | FromDiscord | <Elegantbeef> It's so weird that it errors |
08:28:40 | FromDiscord | <Elegantbeef> https://wandbox.org/permlink/iImERr2hHmmEntfL |
08:29:10 | FromDiscord | <Yardanico> ah nvm it worked because I didn't clone properly |
08:29:18 | FromDiscord | <Elegantbeef> lol |
08:29:47 | FromDiscord | <Elegantbeef> Maybe `const myRuneLen = (proc(s: string): int)(runeLen)` works? |
08:30:05 | FromDiscord | <Elegantbeef> It might be that proc dispatch looks at the symbol instead of the more specific symbol? |
08:30:11 | FromDiscord | <Yardanico> nope, doesn' work |
08:30:37 | FromDiscord | <Yardanico> it errors at the const line saying it's ambiguous, same error |
08:30:46 | FromDiscord | <Elegantbeef> what the hell |
08:31:33 | FromDiscord | <Elegantbeef> I wonder if it's the `extern` and `rtl` stuff |
08:32:34 | FromDiscord | <Yardanico> Anyway https://github.com/zqqw/pakku/pull/28 |
08:32:40 | FromDiscord | <Phil> Another self answered SO question incoming with the recent enlightenment about how "cannot bind another =destroy" means "use --mm:refc", no real need to answer that one. |
08:32:56 | FromDiscord | <Yardanico> well --mm:refc isn't a "proper" fix |
08:33:01 | FromDiscord | <Yardanico> since then you're missing on ORC |
08:33:04 | FromDiscord | <Yardanico> a proper fix is reordering code |
08:33:05 | NimEventer | New question by Philipp Doerner: `cannot bind another &#39;=destroy&#39;` when compiling nimqml project with nim devel compiler, see https://stackoverflow.com/questions/74419532/cannot-bind-another-39-destroy39-when-compiling-nimqml-project-with-nim |
08:33:13 | FromDiscord | <Yardanico> wow that was fast |
08:33:23 | FromDiscord | <Yardanico> glad to see at least nimeventer is stable to run unattended on the vps |
08:33:44 | FromDiscord | <Phil> In reply to @Yardanico "a proper fix is": I mean yeah, but from what I'm seeing that means updating nimqml to work with ORC |
08:33:49 | FromDiscord | <Elegantbeef> The issue with nimqml is that it's across like 10 included files and they use finalizers so it's a bitch to mvoe to destructors |
08:34:00 | FromDiscord | <Yardanico> In reply to @Isofruit "I mean yeah, but": yes, just make sure the SO answer says it's specific to NimQML |
08:34:00 | FromDiscord | <Phil> Which is beyond my area of expertise |
08:34:14 | FromDiscord | <Yardanico> otherwise people might see that error in their projects, google, find the SO answer and just change to refc |
08:34:16 | FromDiscord | <Phil> Wait... motherfuck it deleted the answeer |
08:34:19 | FromDiscord | <Phil> (edit) "answeer" => "answer" |
08:34:22 | FromDiscord | <Yardanico> lopl |
08:34:26 | FromDiscord | <Phil> grrr retyping, one minute |
08:34:32 | FromDiscord | <Elegantbeef> I tried to make Nimqml use import a while ago, but damn it's cyclical |
08:35:00 | FromDiscord | <Yardanico> @beef guess since I'm a bit bored now I'll try to run pakku with orc and useMalloc and see how much unneeded allocations it does |
08:35:07 | FromDiscord | <Yardanico> seems like it likes functional style stuff |
08:35:13 | FromDiscord | <Elegantbeef> lol |
08:35:19 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1041270019612483645/image.png |
08:35:21 | FromDiscord | <Yardanico> ๐ฉ |
08:35:29 | FromDiscord | <Yardanico> this works btw |
08:35:32 | FromDiscord | <Yardanico> wonder why the other one didn't |
08:35:45 | FromDiscord | <Elegantbeef> dispatch works but getting the name doesnt |
08:35:47 | FromDiscord | <Yardanico> yeah |
08:35:55 | FromDiscord | <Yardanico> since this is a normal lambda, not just passing the proc |
08:36:40 | FromDiscord | <Yardanico> what no strformat does to someone https://media.discordapp.net/attachments/371759389889003532/1041270357614673930/image.png |
08:37:00 | FromDiscord | <Elegantbeef> there is some code i've seen that's just like "jesus who hurt you" some times |
08:37:44 | FromDiscord | <Elegantbeef> It's mostly whenever phil here posts code ๐ |
08:37:55 | FromDiscord | <Yardanico> ruude |
08:38:08 | FromDiscord | <Elegantbeef> He knows it's in jest, atleast he better |
08:38:33 | madprops | sweetie we have a CoC for that |
08:38:37 | FromDiscord | <Yardanico> those poor wasted sequences https://media.discordapp.net/attachments/371759389889003532/1041270849451339786/image.png |
08:38:58 | FromDiscord | <Yardanico> they live to be deleted just a few moments later |
08:39:14 | FromDiscord | <Elegantbeef> Yea people see `sequtils` and go "why not" |
08:39:47 | FromDiscord | <Elegantbeef> Sadly my `chain` macro doesnt make me happy enough to say anything |
08:40:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fMB |
08:40:33 | FromDiscord | <Yardanico> I mean it might be not really evident that it's inefficient if you're new to the language |
08:40:57 | FromDiscord | <Elegantbeef> Atleast iirc |
08:40:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fMC |
08:41:38 | FromDiscord | <Elegantbeef> actually one might need to do `x` instead of discard, my memory is shotty here |
08:41:52 | FromDiscord | <Phil> In reply to @Elegantbeef "*It's mostly whenever phil": This is because I plan on dropping constructor as a dependency the second nim-devel supports default-constructor-procs for fields with `distinct DateTime` types ๐ |
08:42:01 | FromDiscord | <Phil> (edit) "This" => "I bet this heckling" |
08:42:02 | FromDiscord | <Elegantbeef> Good |
08:44:12 | FromDiscord | <Elegantbeef> On the plus side yard the runelen issue is reproducible outside of their code |
08:45:22 | FromDiscord | <Phil> In reply to @Yardanico "those poor wasted sequences": Isn't that the case in any functional style stuff, you do tons of copying with sequences in order to not mutate them? |
08:45:34 | FromDiscord | <Yardanico> functional languages have special optimizations regarding that |
08:45:41 | FromDiscord | <Elegantbeef> In Nim yes |
08:45:42 | FromDiscord | <Elegantbeef> In other languages it's not done in the same way |
08:45:44 | FromDiscord | <Yardanico> so it can be as efficient as imperative code I think |
08:45:50 | FromDiscord | <Yardanico> or at least close |
08:46:09 | FromDiscord | <Elegantbeef> The thing with FP is that you "rebuild the world" |
08:46:18 | * | krux02 joined #nim |
08:48:15 | FromDiscord | <Elegantbeef> Interesting it's getting `convNotLegal` |
08:50:42 | FromDiscord | <Elegantbeef> Oh god yard we're dumb |
08:51:26 | FromDiscord | <Elegantbeef> It's an inline proc |
08:51:38 | FromDiscord | <Elegantbeef> so it's `(proc(s: string): int {.inline.})(runeLen)` |
08:51:42 | FromDiscord | <Yardanico> that didn't work for me |
08:51:44 | FromDiscord | <Yardanico> I tried :P |
08:51:49 | FromDiscord | <Yardanico> does it work for you? |
08:51:49 | FromDiscord | <Elegantbeef> It works here |
08:52:02 | FromDiscord | <Yardanico> not here |
08:52:14 | FromDiscord | <Yardanico> ah wait it's indeed weird |
08:52:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fMD |
08:52:24 | FromDiscord | <Yardanico> ` Calling convention mismatch: got '{.inline.}', but expected '{.closure.}'.` |
08:52:27 | FromDiscord | <Yardanico> for `map` |
08:52:31 | FromDiscord | <Elegantbeef> Yea |
08:52:40 | FromDiscord | <Yardanico> but how did it work before then |
08:52:51 | FromDiscord | <Elegantbeef> Before my PR it wasnt inlined |
08:53:01 | FromDiscord | <Yardanico> oh |
08:53:04 | FromDiscord | <Yardanico> so you broke it :PP |
08:53:11 | FromDiscord | <Elegantbeef> With my PR all str ops are inlined and call their `openArray[char]` now |
08:53:12 | FromDiscord | <Yardanico> but yeah that's fine for nim 2 |
08:53:22 | FromDiscord | <Yardanico> so it's not a bug but just a breaking change, fair enough |
08:53:36 | FromDiscord | <Elegantbeef> Well I mean we're not going to change back to the previous version of only having unicode for string |
08:53:40 | FromDiscord | <Elegantbeef> Or parseutils for string |
08:53:41 | FromDiscord | <Yardanico> of course |
08:54:00 | FromDiscord | <Elegantbeef> I'm quite chuffed with that change cause no one will notice it but i will know it's there |
08:54:21 | FromDiscord | <Elegantbeef> want to read unicode on a cstring, you can without converting.... want to parse from a cstring, you can |
08:54:49 | FromDiscord | <Elegantbeef> Plus `toOpenArray` now works on the VM which is equally as fun |
08:55:39 | FromDiscord | <Elegantbeef> Plus this is only breaking cause they wrote the code the way they did |
08:55:54 | FromDiscord | <Elegantbeef> if they wrote it in the calling form it's a 0 issue, so this makes better code |
08:56:00 | FromDiscord | <Elegantbeef> You wouldnt be looking at pakku if it wasnt for this! ๐ |
08:57:03 | FromDiscord | <Elegantbeef> Now that i think about it it's kinda odd that all calling conventions dont implicitly convert to closure |
08:57:45 | FromDiscord | <Elegantbeef> Like it's just "emit an anonymous procedure that pass the arguments if we need to convert" |
08:59:10 | FromDiscord | <Elegantbeef> Aw shit here i am rambling again |
09:00:56 | FromDiscord | <Yardanico> Also was thinking of setting up a reddit monitor to watch programming subreddits for Nim mentions, won't hook it up to nimeventer as it'd be too noisy, just for myself |
09:01:05 | FromDiscord | <Yardanico> But I wrote the PoC in python with the reddit lib :P |
09:01:06 | FromDiscord | <Yardanico> not nim :(( |
09:01:17 | FromDiscord | <Elegantbeef> Nim is infact a toy language |
09:02:13 | FromDiscord | <Elegantbeef> You like distinct types as much as the next programmer right? |
09:02:44 | FromDiscord | <Yardanico> แตข ๐นโโ'โ แตคโโ โโโโ |
09:02:52 | FromDiscord | <Elegantbeef> I'm debating about yet another macro package, and need atleast another view on this https://github.com/beef331/nimtrest/blob/master/lender.nim#L224-L261 |
09:02:54 | FromDiscord | <Elegantbeef> Damn |
09:03:03 | FromDiscord | <Elegantbeef> Not using distincts, blocked |
09:03:10 | FromDiscord | <Yardanico> yes sad, but my code is usually just very plain and simple |
09:03:13 | FromDiscord | <Yardanico> procs and objects |
09:03:24 | FromDiscord | <Elegantbeef> I like my distincts |
09:03:35 | FromDiscord | <Elegantbeef> Micros is lovely, makes things like this a breeze |
09:03:41 | FromDiscord | <Elegantbeef> That is if i can ever remember the fucking api i made ๐ |
09:04:58 | FromDiscord | <Yardanico> also if you want more stats about that nim video |
09:05:00 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1041277491488243722/image.png |
09:05:03 | FromDiscord | <Yardanico> github repo visitors |
09:06:18 | FromDiscord | <Yardanico> git clones are weird though, too many bots? |
09:06:20 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1041277825447112724/image.png |
09:06:53 | FromDiscord | <Yardanico> green is total clones, blue unique cloners |
09:09:47 | FromDiscord | <ShalokShalom> In reply to @Yardanico "since no type names": How can type names take up so much space?โตโตI mean its obviously not the space for the name itself. |
09:10:06 | FromDiscord | <Yardanico> In reply to @ShalokShalom "How can type names": nim with refc does always include runtime type information |
09:10:06 | FromDiscord | <Elegantbeef> It's a pointer and the heap allocated name |
09:10:22 | FromDiscord | <Yardanico> or maybe you can disable it, I forgot |
09:10:32 | FromDiscord | <Elegantbeef> Plus the entire type structure |
09:10:32 | FromDiscord | <Elegantbeef> You could disable names |
09:10:36 | FromDiscord | <Elegantbeef> But that's it afaik |
09:10:40 | FromDiscord | <ShalokShalom> In reply to @Yardanico "green is total clones,": It seems almost double the clones as the unique ones |
09:10:57 | FromDiscord | <Yardanico> not double, the graphs aren't on same scale |
09:11:04 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Plus the entire type": That sounds like the most expensive? |
09:11:06 | FromDiscord | <Yardanico> left is clones, right is unique cloners |
09:11:21 | FromDiscord | <ShalokShalom> And the heap is part of the binary? |
09:11:33 | FromDiscord | <Yardanico> @ShalokShalom https://media.discordapp.net/attachments/371759389889003532/1041279139342188544/image.png |
09:11:37 | FromDiscord | <ShalokShalom> I thought that is basically allocated in memory, on runtime |
09:11:45 | FromDiscord | <Elegantbeef> Actually it's not heap allocated it's likely statically allocated |
09:11:46 | FromDiscord | <Yardanico> green on the left shows scale for the green graph, blue on the right shows the scale for the blue graph |
09:12:18 | FromDiscord | <Yardanico> most of these clones are probably just CI services and other bots |
09:12:35 | FromDiscord | <Elegantbeef> Yard is devel just using an int for type information? |
09:12:39 | FromDiscord | <ShalokShalom> @Yardanico so those numbers in the middle of the screen show the total numbers over that time? |
09:12:41 | FromDiscord | <Elegantbeef> Or is ptype still complex? |
09:12:56 | FromDiscord | <ShalokShalom> In reply to @Yardanico "most of these clones": Yeah, probably. |
09:12:59 | FromDiscord | <Yardanico> In reply to @ShalokShalom "<@177365113899057152> so those numbers": It's just two graphs with different scale overlayed on each other |
09:13:02 | FromDiscord | <Elegantbeef> I'm amazed a dual y axis graph is causing this must confusion |
09:13:12 | FromDiscord | <ShalokShalom> Does the heap become part of the binary? |
09:13:15 | FromDiscord | <Elegantbeef> Green is left scale, blue is right |
09:13:20 | * | jjido joined #nim |
09:13:21 | FromDiscord | <Elegantbeef> The heap is your ram so no |
09:13:28 | FromDiscord | <ShalokShalom> Yes, I thought so |
09:13:31 | FromDiscord | <ShalokShalom> Thanks |
09:13:35 | FromDiscord | <Elegantbeef> You have heap, stack, and static generally |
09:13:39 | FromDiscord | <Elegantbeef> There is more but those are the 3 |
09:13:55 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "It's a pointer and": I understood that so |
09:14:43 | FromDiscord | <Yardanico> regarding binary size of ORC - if we exclude the type information, ARC/ORC binaries should actually take more space than the refc ones |
09:14:52 | FromDiscord | <Yardanico> because of all the generated copy/sink/destroy procs |
09:15:12 | FromDiscord | <Elegantbeef> But Refc also has the GC |
09:15:19 | FromDiscord | <Elegantbeef> And orc/arc binaries are generally smaller |
09:15:19 | FromDiscord | <Yardanico> true ๐ค |
09:15:31 | FromDiscord | <Yardanico> they are smaller, because of no runtime information I guess |
09:16:06 | FromDiscord | <Elegantbeef> With stable the still have RTTI |
09:16:13 | FromDiscord | <Elegantbeef> they\ |
09:16:45 | FromDiscord | <Yardanico> i'm talking devel refc vs orc |
09:16:50 | FromDiscord | <Elegantbeef> Ah |
09:16:55 | FromDiscord | <Yardanico> like for nimes with danger clang lto it's 96KB with orc, 376KB with refc |
09:17:05 | FromDiscord | <Yardanico> the commit where it was with methods |
09:17:14 | FromDiscord | <Yardanico> let's compare the newer commit where I replaced method by "interfaces" |
09:17:47 | FromDiscord | <Yardanico> still 376KB refc vs 104KB ORC |
09:17:47 | FromDiscord | <Elegantbeef> I think you're going to be hardpressed to make orc larger than refc, but who knows |
09:18:03 | FromDiscord | <Yardanico> so apparently those interfaces I made take more space for orc than new orc methods :D |
09:18:18 | FromDiscord | <ShalokShalom> In reply to @Yardanico "like for nimes with": You compiled the older with current compilers, yes? |
09:18:22 | FromDiscord | <Elegantbeef> Most types arent going to have overly complex destructors i imagine |
09:18:34 | FromDiscord | <ShalokShalom> Or just compared them to todays gcc or clang? |
09:18:35 | FromDiscord | <Yardanico> In reply to @ShalokShalom "You compiled the older": no |
09:18:42 | FromDiscord | <Yardanico> Both with newest nim devel with clang |
09:18:46 | FromDiscord | <Yardanico> refc vs orc |
09:18:50 | FromDiscord | <Yardanico> clang 14.0.6 |
09:18:50 | FromDiscord | <ShalokShalom> Ok |
09:19:01 | FromDiscord | <Yardanico> gcc is similar but the binaries are a bit bigger for both |
09:19:12 | FromDiscord | <Elegantbeef> Static musl time ๐ |
09:19:17 | FromDiscord | <Yardanico> zigcc |
09:19:29 | FromDiscord | <Yardanico> I don't want to try to build this statically, since it also links sdl2 :P |
09:19:43 | FromDiscord | <Elegantbeef> You're on linux you should have the .a |
09:20:02 | FromDiscord | <Elegantbeef> inb4 "I'm on windows" |
09:20:11 | FromDiscord | <Yardanico> nonono |
09:20:44 | FromDiscord | <Elegantbeef> I'd jokingly say "nlvm 2 when" but i dont want arne to come swat me |
09:20:49 | FromDiscord | <Yardanico> lol |
09:21:36 | FromDiscord | <Yardanico> 100KB orc vs 384KB refc, a bit bigger than clang |
09:21:40 | FromDiscord | <Yardanico> gcc I mean |
09:21:56 | FromDiscord | <Yardanico> is the compiler on devel built with orc nowadays, or still refc? |
09:22:03 | FromDiscord | <Elegantbeef> Orc |
09:22:24 | FromDiscord | <Elegantbeef> Araq wanted to drink his own flavour aid finally |
09:22:40 | FromDiscord | <Elegantbeef> Still causes some memory/performance issues where cursor inference fails |
09:22:52 | FromDiscord | <Yardanico> yeah I know there are still some arc/orc bugs left |
09:23:28 | FromDiscord | <Elegantbeef> I've never really ran into any of them myself which makes me happy ๐ |
09:23:53 | FromDiscord | <Elegantbeef> I guess i've likely had cursor inference fail, but that's a silent bug |
09:24:18 | FromDiscord | <Elegantbeef> The interesting thing is that the bug i was talking about was due to a refc 'bug' |
09:24:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fMG |
09:24:53 | FromDiscord | <Elegantbeef> Apparently in refc `let b = string or seq` doesnt copy |
09:24:53 | FromDiscord | <Yardanico> argh did new github search break sorting by date |
09:25:59 | FromDiscord | <Yardanico> AH okay github search is not broken, it just shows wrong dates |
09:27:59 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1041283273860579419/image.png |
09:28:05 | FromDiscord | <Yardanico> funny name :P (it's actually updated a few hours ago) |
09:28:38 | FromDiscord | <Elegantbeef> Hey i did nimtrest, so is stealing my schtick |
09:29:00 | FromDiscord | <Elegantbeef> I take it back they're doing malware related stuff |
09:29:07 | FromDiscord | <Yardanico> yes |
09:29:12 | FromDiscord | <Elegantbeef> But they use `openarray` so they're alright in my books |
09:29:13 | FromDiscord | <Yardanico> but yeah it's surely ethical research |
09:29:36 | FromDiscord | <Elegantbeef> Anyone that uses openarray gets a gold star from me |
09:29:38 | FromDiscord | <Elegantbeef> I'm a simple man |
09:30:05 | FromDiscord | <Elegantbeef> Not a github star, but a imaginary gold start |
09:30:20 | FromDiscord | <scarf> how do i test `runnableExamples`? |
09:30:28 | FromDiscord | <Yardanico> nim doc |
09:30:34 | FromDiscord | <Elegantbeef> `nim doc` runs it |
09:31:11 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fMJ |
09:31:27 | FromDiscord | <Yardanico> Yes, those examples are meant for documentation, so they're tested when you build docs |
09:31:30 | FromDiscord | <Elegantbeef> `runnableExamples` is to show how it workss |
09:31:44 | FromDiscord | <Yardanico> if you want to write tests, just write them separately |
09:32:00 | FromDiscord | <scarf> alright, i guess so |
09:39:43 | FromDiscord | <Phil> ~~Or make `nim docs` part of your CI pipeline~~ |
09:39:58 | FromDiscord | <Elegantbeef> I mean it likely should be |
09:40:05 | FromDiscord | <Elegantbeef> But not as unit testing |
09:40:19 | FromDiscord | <Elegantbeef> But also who uses a CI |
09:40:39 | FromDiscord | <Elegantbeef> Guy who has 0 CIs for any of his repos |
09:41:32 | FromDiscord | <Phil> In reply to @Elegantbeef "But also who uses": Mystery people |
09:41:58 | FromDiscord | <Elegantbeef> see i've considered setting up a CI but i also concede there isnt much reason to |
09:47:09 | FromDiscord | <scarf> wdym you don't host your docs on github pages |
09:47:16 | FromDiscord | <scarf> savages smh |
09:48:15 | FromDiscord | <Elegantbeef> I just added myself to treeform's nimdoc and when it's not down it gives my docs |
09:48:27 | FromDiscord | <scarf> oh, that'd work |
09:51:16 | FromDiscord | <Elegantbeef> Plus no one uses my code so it's fine! |
10:10:54 | FromDiscord | <Slazaa> Hi, how does error handling work in Nim, I saw there is a Result type but how does it work ? |
10:11:12 | FromDiscord | <Yardanico> Default Nim error handling is via exceptions, similar to how Python does it |
10:11:31 | FromDiscord | <Yardanico> There are libraries that allow you to use different ways, like nim-result |
10:11:37 | FromDiscord | <Elegantbeef> Seems there is more talk/want of results, it's going to make me sad |
10:11:52 | FromDiscord | <Slazaa> So I should use exceptions ? :o |
10:11:58 | FromDiscord | <Elegantbeef> Yes you should |
10:12:03 | FromDiscord | <Slazaa> Alright x) |
10:12:08 | FromDiscord | <Slazaa> Exceptions it is |
10:12:24 | FromDiscord | <Slazaa> Thank for you responding :D |
10:12:29 | FromDiscord | <ieltan> In reply to @Elegantbeef "Seems there is more": I think it's because of rust |
10:12:37 | FromDiscord | <Elegantbeef> Exceptions are what Nim uses, you can use results if you want the explicitly and mild performance benefits |
10:12:53 | FromDiscord | <Elegantbeef> I really prefer the semantics of exceptions it's just nicer imo, but sadly the performance isnt there |
10:13:15 | FromDiscord | <Slazaa> I don't know, Result makes more sense to me |
10:13:38 | FromDiscord | <ieltan> Maybe it makes more sense for Rust |
10:13:45 | FromDiscord | <Elegantbeef> Results force unpacking on the user even if they really dont care |
10:14:06 | FromDiscord | <Slazaa> Yeah, I know Nim is meat to be less annoying than Rust |
10:14:11 | FromDiscord | <Elegantbeef> I can already hear "but you can use the `?` operator" |
10:14:12 | FromDiscord | <Yardanico> yeah, it's a bit similar to Go but with better syntax since Nim has overloading, metaprogramming, and a lot of other goodies |
10:14:29 | FromDiscord | <Yardanico> I mean using stuff like result |
10:14:33 | FromDiscord | <Yardanico> or Zig if you're into that |
10:15:13 | FromDiscord | <ieltan> Zig has no overloading and metaprogramming tho |
10:15:13 | FromDiscord | <Slazaa> Exceptions inherite from Exception right ? :o |
10:15:29 | FromDiscord | <Yardanico> In reply to @ieltan "Zig has no overloading": I mean the way it does errors |
10:15:36 | FromDiscord | <ieltan> Ah yes |
10:15:53 | FromDiscord | <Elegantbeef> `CatchableError` iirc |
10:15:59 | FromDiscord | <Yardanico> yeah |
10:16:25 | FromDiscord | <Yardanico> and Defect if your exception is supposed to be non-recoverable |
10:16:45 | FromDiscord | <Slazaa> Uhh, alright :o |
10:16:59 | FromDiscord | <Slazaa> Thank you |
10:17:13 | FromDiscord | <Phil> In reply to @Elegantbeef "Plus no one uses": Fucking lying to me to my face when I'm in the same channel and can read that message |
10:18:38 | FromDiscord | <Elegantbeef> image.pngโต(@Phil) https://media.discordapp.net/attachments/371759389889003532/1041296022510501918/image.png |
10:18:40 | FromDiscord | <ieltan> What's the state of `not nil` anyways? Is it shipping for v2? |
10:19:10 | FromDiscord | <ieltan> By Default I mean |
10:19:18 | FromDiscord | <Phil> In reply to @Elegantbeef "image.png (<@180601887916163073>)": I still have my local copy, you will never take that from me!! |
10:19:20 | FromDiscord | <Elegantbeef> Nope |
10:19:37 | FromDiscord | <Yardanico> In reply to @Elegantbeef "image.png (<@180601887916163073>)": why |
10:19:43 | FromDiscord | <Yardanico> it's nice |
10:20:05 | FromDiscord | <Elegantbeef> That's what i'm told, but i rarely use it |
10:20:22 | FromDiscord | <Yardanico> just archive it then |
10:20:28 | FromDiscord | <Yardanico> like <https://github.com/Yardanico/nim-strenc> |
10:22:13 | FromDiscord | <Elegantbeef> Nah it's actually supported |
10:22:16 | FromDiscord | <Elegantbeef> yard read the context |
10:23:09 | FromDiscord | <Elegantbeef> I said no one used my code, Phil said he does, i threatened deleting it |
10:23:54 | FromDiscord | <Phil> Funnily enough even in a nimv2 world I think constructor has a pretty important usecase due to it allowing values to be generated at runtime |
10:24:49 | FromDiscord | <Elegantbeef> It's funny cause i think defaults is the less fun version |
10:25:03 | FromDiscord | <Elegantbeef> The constructor macro is what i gravitate to |
10:26:32 | FromDiscord | <Phil> The main reason I believe is mostly because I actually do not care about instantiation one single bit. Norm does, I don't. Norm just needs empty instances, so I give norm empty instances |
10:27:00 | FromDiscord | <Phil> If norm managed to instantiate model types itself I wouldn't need to write construction procs |
10:29:21 | FromDiscord | <Elegantbeef> Funnily enough iirc the last time i went to use constructor i found a bug, so clearly no one else uses it |
10:29:33 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzโฆ) |
10:32:04 | * | jjido joined #nim |
10:39:36 | FromDiscord | <aq47> Will these be stabilized in v2? https://nim-lang.org/docs/manual_experimental.html#view-types |
10:40:40 | FromDiscord | <aq47> and `compiletimeFFI`? |
10:41:04 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzzโฆ) |
10:47:52 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fMS |
10:48:35 | FromDiscord | <Yardanico> an object :D |
10:48:40 | FromDiscord | <Yardanico> but really, just x, y |
10:48:41 | FromDiscord | <Yardanico> why yx? |
10:49:07 | FromDiscord | <scarf> since for y , for x is used a lot when iterating over pixels? |
10:49:57 | FromDiscord | <Phil> Do the obvious one (x, y) unless you performance concerns |
10:50:29 | FromDiscord | <Phil> Which... I'm not sure how there would be any but I'm also not doing high performance stuff |
10:50:50 | FromDiscord | <scarf> on other thoughts, since nim tuples are named x,y seems better |
10:51:31 | FromDiscord | <Yardanico> In reply to @Isofruit "Which... I'm not sure": It can be different, but unless you're doing some really really high performance stuff it's not going to be noticeable |
10:53:40 | FromDiscord | <aq47> In reply to @scarf "since for y ,": You want a struct of arrays then, try making a row of xs an object |
10:54:13 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fMT |
10:54:25 | FromDiscord | <Yardanico> seq[bool] ๐ค |
10:54:42 | FromDiscord | <Yardanico> data can be different length? |
10:54:55 | FromDiscord | <Yardanico> Is it just a few predefined values, or arbtirary length? |
10:55:16 | FromDiscord | <scarf> their size is always `term.w term.h`, but can arrays be dynamically allocated? |
10:56:02 | FromDiscord | <Yardanico> ah, fair enough, you can just preallocate the seq then |
10:56:15 | FromDiscord | <Yardanico> I wonder if seq[bool] will use 8 bytes for each bool or not |
10:56:51 | FromDiscord | <scarf> tho it's simple png to ascii program so maybe performance won't hurt much |
10:57:55 | FromDiscord | <Yardanico> okay just checked, it's all fine |
10:58:02 | FromDiscord | <Yardanico> ` result.x = newSeq[bool](10)` allocates 18 bytes |
10:58:06 | FromDiscord | <Yardanico> so the compiler can optimize it |
10:58:10 | FromDiscord | <Yardanico> the C compiler I mean |
10:58:58 | FromDiscord | <Yardanico> 18 because 10 data + 8 for the capacity |
10:59:02 | FromDiscord | <Yardanico> 8 being int64 |
10:59:40 | FromDiscord | <scarf> so `int64_t` for capacity, 10 `int8_t` for each array element |
10:59:54 | FromDiscord | <Yardanico> yeah, capacity is actually just `int`, but `int` in Nim is `int64` on 64-bit platforms |
11:00:12 | FromDiscord | <Yardanico> on 32-bit it would be 4 bytes |
11:00:26 | FromDiscord | <scarf> interesting, tho i kind of wish nim used i32 or i64 everywhere to be explicit |
11:25:09 | * | jmdaemon quit (Ping timeout: 268 seconds) |
11:50:20 | FromDiscord | <aq47> In reply to @scarf "yeah kinda made similar": you can use a bitset instead of `seq[bool]` |
11:50:57 | * | pro joined #nim |
11:54:24 | FromDiscord | <aq47> Ah, I thought [bitfields](https://nim-lang.org/docs/manual.html#set-type-bit-fields) supported doing that, looks like it doesn't |
11:56:09 | FromDiscord | <auxym> https://github.com/treeform/bitty |
12:00:01 | FromDiscord | <auxym> or https://github.com/YesDrX/bitarray, https://github.com/onecodex/nim-bitarray |
12:09:39 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=4fNh |
12:10:03 | FromDiscord | <Bung> what's the theory here? |
12:30:51 | * | pro quit (Ping timeout: 260 seconds) |
12:42:33 | FromDiscord | <scarf> would there be a library to split an mp4 to png frames? |
12:42:39 | FromDiscord | <scarf> (edit) "split" => "process" |
12:51:09 | FromDiscord | <Slazaa> Hey, I'm working with OpenGL and I have this type `ptr GLubyte` and I need to make it a string, how can I do that ? |
13:16:54 | FromDiscord | <Yardanico> In reply to @Slazaa "Hey, I'm working with": If it's in fact a string and is null-terminated you can do `$cast[cstring](yourptr)` |
13:22:19 | FromDiscord | <Slazaa> In reply to @Yardanico "If it's in fact": Awsome thank you :3 |
13:23:21 | FromDiscord | <Slazaa> Can I ignore warnings in a specific file ? |
13:27:27 | FromDiscord | <scarf> any video processing library with nim bindings? opencv lacks `cv::VideoCapture`, nimpy fails to find modules, `futhark` fails to build |
13:30:33 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in) |
13:30:57 | NimEventer | New thread by sls1005: Memory strategies with OpenMP, see https://forum.nim-lang.org/t/9601 |
13:32:33 | FromDiscord | <Yardanico> In reply to @scarf "any video processing library": about Futhark - are you on Windows? |
13:32:41 | FromDiscord | <scarf> In reply to @Yardanico "about Futhark - are": ubuntu 22.04 |
13:32:44 | FromDiscord | <Yardanico> Futhark requires you to have Clang installed, since it uses libclang to generate bindings |
13:33:37 | FromDiscord | <scarf> and dom's `opencv/highgui` won't work because `could not import: cvCreateFileCapture` but `libopencv-highgui-dev is already at the latest version 4.5.4+dfsg-9ubuntu4` |
13:33:48 | FromDiscord | <Yardanico> yeah it was written for a very old opencv version and isn't maintained anymore |
13:34:32 | FromDiscord | <scarf> then i thought, let's use nimpy but it couldn't find installed modules |
13:34:46 | FromDiscord | <Yardanico> In reply to @scarf "then i thought, let's": can you show your nimpy code? |
13:35:07 | FromDiscord | <Yardanico> but generally I'd recommend trying to use some C lib through Futhark, for example ffmpeg |
13:35:12 | FromDiscord | <Yardanico> And generally you can just call ffmpeg from cmdline |
13:35:43 | FromDiscord | <scarf> also nimpy doesn't support 3.10 and 3.11 |
13:35:51 | FromDiscord | <scarf> (edit) "3.11" => "3.11, had to mess with source code" |
13:37:18 | * | krux02 quit (Quit: Leaving) |
13:39:24 | * | nyeaa49284 quit (Quit: Ping timeout (120 seconds)) |
13:40:10 | * | nyeaa49284 joined #nim |
13:40:48 | FromDiscord | <hmmm> broskis what was the shorthand way of making something like this : var myseq = @[1,1,1,1,1,1,1,1,1,1,1] |
13:40:58 | FromDiscord | <hmmm> 1 x 200 works lol? |
13:41:51 | FromDiscord | <hmmm> I think there is something like repeat in strutils? |
13:42:33 | FromDiscord | <scarf> you can use `repeat(1, 200)` from `std/sequtils`โต<https://nim-lang.org/docs/sequtils.html#repeat%2CT%2CNatural> |
13:42:50 | FromDiscord | <hmmm> ty bro! ๐ |
13:43:16 | FromDiscord | <scarf> hecc but what is nim type for numpy.NDArray, those documentations are non-exisistent |
13:46:10 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fNC |
13:46:36 | FromDiscord | <scarf> (edit) "https://play.nim-lang.org/#ix=4fNC" => "https://play.nim-lang.org/#ix=4fND" |
13:47:29 | FromDiscord | <Yardanico> To use numpy you need to do stuff like <https://github.com/yglukhov/nimpy/blob/master/tests/numpytest.nim> |
13:47:47 | FromDiscord | <albassort> i can write fucked up C code and its fine because nim gcc will save me right? |
13:47:53 | FromDiscord | <Yardanico> ? |
13:48:00 | FromDiscord | <albassort> gc |
13:48:02 | FromDiscord | <albassort> extra c |
13:48:10 | FromDiscord | <Yardanico> no, Nim GC only works for Nim code |
13:48:17 | FromDiscord | <Yardanico> if you emit C code in Nim, it's untouched |
13:48:29 | FromDiscord | <albassort> fuck |
13:48:47 | FromDiscord | <Yardanico> if you want a GC for C code, maybe use stuff like Boehm (not the boehm in Nim, but Boehm directly with C)? |
13:49:07 | FromDiscord | <Yardanico> Also what's your use-case for emitting C code? |
13:49:53 | FromDiscord | <scarf> In reply to @Yardanico "To use numpy you": but cap.read() returns a tuple or bool, NDArray, and it seems that i have to cast it using `to` on assignment, so I really need the NDArray type |
13:50:34 | FromDiscord | <albassort> In reply to @Yardanico "Also what's your use-case": I had to use C libraries and I didn't wanna deal with the ugly nim wrapping code |
13:50:37 | FromDiscord | <albassort> so i just wrote C |
13:50:43 | FromDiscord | <albassort> and im gonna wrap my prettier functions |
13:50:46 | FromDiscord | <Yardanico> well, you chose this path yourself then |
13:51:01 | FromDiscord | <Yardanico> If you want proper Nim handling etc, do proper C FFI :P |
13:51:18 | FromDiscord | <albassort> theres no difference |
13:51:21 | FromDiscord | <aq47> In reply to @albassort "fuck": Write an allocator in Nim and allocate in C using that? Should be doable in theory |
13:51:23 | FromDiscord | <albassort> apart from the fact im not a cp rogrammer |
13:51:27 | FromDiscord | <albassort> (edit) "cp rogrammer" => "c programmer" |
13:51:31 | FromDiscord | <albassort> and i suck at c |
13:51:33 | FromDiscord | <Yardanico> In reply to @aq47 "Write an allocator in": there is, you can then use automatic Nim GC stuff like destructors |
13:51:43 | FromDiscord | <Yardanico> well destructors aren't GC since they're inserted at compile-time, but still |
13:51:51 | FromDiscord | <albassort> ^ |
13:51:59 | FromDiscord | <albassort> it seems like it would just become chaotic as hell |
13:52:02 | FromDiscord | <Yardanico> you can use Nim as a "better C" if you want to |
13:52:36 | FromDiscord | <albassort> i have the stupidest idea for a language that is "better C" |
13:52:52 | FromDiscord | <aq47> In reply to @albassort "it seems like it": You can also try writing inline C in Nim and minimize the C |
13:52:54 | FromDiscord | <albassort> i will work on that one day |
13:53:07 | FromDiscord | <albassort> > inline c in Nim |
13:53:13 | FromDiscord | <albassort> i haven't... heard of this |
13:53:18 | FromDiscord | <albassort> is there like a C macro |
13:53:19 | FromDiscord | <albassort> lol |
13:53:31 | FromDiscord | <Yardanico> In reply to @albassort "i haven't... heard of": he's talking about emit |
13:53:37 | FromDiscord | <Yardanico> which I assume is what you're already using |
13:53:43 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma |
13:53:55 | FromDiscord | <albassort> no its all in its own file |
13:53:58 | FromDiscord | <albassort> importC |
13:54:25 | FromDiscord | <albassort> im doing it the same way i usually do python interop |
13:59:05 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fNH |
13:59:11 | FromDiscord | <scarf> (edit) "https://play.nim-lang.org/#ix=4fNH" => "https://play.nim-lang.org/#ix=4fNI" |
14:08:19 | FromDiscord | <albassort> huh nim hcv |
14:08:24 | FromDiscord | <albassort> (edit) "hcv" => "has c" |
14:08:25 | FromDiscord | <albassort> (edit) "c" => "cv" |
14:08:27 | * | pro joined #nim |
14:08:38 | FromDiscord | <albassort> oh its a pywrapper |
14:09:04 | NimEventer | New thread by linwaytin: Yet another c compiler (under development), see https://forum.nim-lang.org/t/9602 |
14:47:37 | FromDiscord | <fwsgonzo> is there a way to avoid libnss on embedded and still get working HTTP client/server? |
14:49:00 | FromDiscord | <fwsgonzo> basically no getaddrinfo |
15:05:43 | * | carce joined #nim |
15:09:59 | * | carce quit (Ping timeout: 256 seconds) |
15:11:13 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i go about making my own nodetree in nim. With my own node types but ways of walking through the tree and basic tree stuff. |
15:12:40 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4fNW |
15:13:18 | FromDiscord | <auxym> I'm sure you can figure out DFS/BFS from there |
15:13:47 | FromDiscord | <pietroppeter> ok, we have imported Google Analytics Data (since March 2014) in plausible! (no details on pages and sources is available for the google data) https://media.discordapp.net/attachments/371759389889003532/1041370296000708760/image.png |
15:17:48 | * | carce joined #nim |
15:20:03 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4fNY |
15:22:56 | FromDiscord | <auxym> mm good point. indirection is needed for a recursive structure, but the seq might take care of that? |
15:26:58 | FromDiscord | <Rika> yes |
15:35:09 | * | carce quit (Remote host closed the connection) |
15:35:41 | * | carce joined #nim |
15:39:22 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4fO6 |
15:40:01 | * | carce quit (Ping timeout: 256 seconds) |
15:40:46 | FromDiscord | <Phil> I get that defer is try finally but like... this calls all of the following code and when that code ends/fails it calls `app.delete` ? |
15:41:12 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4fO6" => "https://play.nim-lang.org/#ix=4fO7" |
15:41:56 | FromDiscord | <Phil> How many layers of try-finally can I go deep before things start becoming problematic I wonder |
15:45:17 | FromDiscord | <Rika> i dont understand your question |
15:46:00 | FromDiscord | <Phil> I think while asking the question I kinda realized the answer myself, now I'm wondering if too many defer statements are problematic |
15:47:36 | FromDiscord | <Rika> it could be |
15:48:42 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4fOc |
15:48:50 | FromDiscord | <ringabout> (edit) "https://play.nim-lang.org/#ix=4fOc" => "https://play.nim-lang.org/#ix=4fOd" |
15:54:51 | FromDiscord | <ringabout> In reply to @Isofruit "I get that defer": `defer` is just transforming the code into `try-finally` pairs. When the program leaves its block (like procs); the final part will clean up the resource,. |
16:01:31 | * | carce joined #nim |
16:02:26 | * | carce quit (Read error: Connection reset by peer) |
16:02:38 | * | carce joined #nim |
16:04:40 | * | Guest1473 is now known as om3ga |
16:07:46 | FromDiscord | <.tochka> how can you check if some type is subrange one |
16:12:07 | FromDiscord | <Slazaa> sent a code paste, see https://play.nim-lang.org/#ix=4fOs |
16:29:43 | FromDiscord | <jmgomez> In reply to @Slazaa "Given a seq of": not sure if there something else but cast should work |
16:29:52 | FromDiscord | <jmgomez> (edit) "In reply to @Slazaa "Given a seq of": not sure if there ... something" added "is" |
16:30:05 | FromDiscord | <Slazaa> In reply to @jmgomez "not sure if there": So what do I need to change ? |
16:30:40 | * | jjido joined #nim |
16:31:04 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4fOC |
16:31:06 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/hqH |
16:31:24 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4fOE" => "https://play.nim-lang.org/#ix=4fOD" |
16:31:40 | FromDiscord | <jmgomez> In reply to @Isofruit "Hmm you're running into": didnt know about of, this is better |
16:32:08 | FromDiscord | <Slazaa> Oh I can do filter too :o |
16:32:10 | FromDiscord | <Phil> `item of B` will be true if item is an instance of B and false if item is an instance of A. |
16:33:05 | FromDiscord | <Phil> However, if you want all base object (so all pure A's, not its children) you'll need to be slightly clever about it.โต`item of A` will always be true for the selection above.โตSo you'll have to check for `not item of B` if you want all pure A's |
16:33:15 | FromDiscord | <Yardanico> https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-labs is interesting |
16:33:32 | FromDiscord | <Yardanico> apparently like all other language models Copilot understands prompts, and this extension wraps some prompts into functions, or you can make custom prompts |
16:34:10 | FromDiscord | <Slazaa> Thank you :D |
16:34:37 | FromDiscord | <Slazaa> What's std/sugar though ? |
16:35:21 | FromDiscord | <Phil> In reply to @Slazaa "Thank you :D": Here the docs for it btw: https://nim-lang.org/docs/system.html#of%2CT%2Ctypedesc%5BS%5D |
16:35:41 | FromDiscord | <Phil> In reply to @Slazaa "What's std/sugar though ?": std/sugar is for allowing java/javascript style definition of procs |
16:35:56 | FromDiscord | <Slazaa> What would be the Nim way ? |
16:36:17 | FromDiscord | <Phil> So you can do `item => item of B` instead of `proc(item: A): bool = item of B` |
16:36:29 | FromDiscord | <Slazaa> I feel like Nim's doc is kinda hard to find |
16:36:39 | FromDiscord | <Phil> Generously use the search function |
16:37:09 | FromDiscord | <Rika> or be me and just read every module's docs wholly |
16:37:13 | FromDiscord | <Phil> But yeah, some things aren't immediately obviously (like std/sugar) |
16:37:19 | FromDiscord | <Phil> (edit) "obviously" => "obvious" |
16:37:46 | FromDiscord | <Slazaa> Maybe I fell into advanced stuff too quickly |
16:38:15 | FromDiscord | <Phil> In reply to @Slazaa "Maybe I fell into": You're just doing OO, advanced stuff is when you jump into templates and macros ๐ |
16:38:52 | FromDiscord | <Slazaa> That's true x) |
16:39:20 | FromDiscord | <Phil> On that note, you'll be amazed by how far just generics, templates and compile-time procs can get you |
16:40:07 | FromDiscord | <Slazaa> Maybe I should dive into metaprogramming someday |
16:41:14 | FromDiscord | <Phil> In reply to @Slazaa "Maybe I should dive": If you have a usecase I can recommend. I don't have one and that's kinda prevented me from mustering the motivation to jump into it |
16:41:30 | FromDiscord | <Phil> The stuff you can do with it is kinda insane though and can be very useful |
16:41:44 | FromDiscord | <Phil> Though I'd recommend first getting a solid grasp on the general stuff |
16:41:57 | FromDiscord | <Phil> (edit) "usecase" => "usecase," | "recommend." => "recommend learning it." |
16:42:45 | FromDiscord | <Slazaa> I've worked with C and Rust, and I've never found myself in trouble not using metaprogramming |
16:43:56 | * | def- quit (Quit: -) |
16:44:07 | * | def- joined #nim |
16:44:58 | FromDiscord | <Rika> well of course there isnt risk in not doing it |
16:45:43 | FromDiscord | <Slazaa> I meant having the need to use it x) |
16:45:49 | FromDiscord | <Phil> sent a long message, see http://ix.io/4fOK |
16:46:27 | FromDiscord | <Slazaa> :o |
16:46:52 | FromDiscord | <Phil> But it's the kind of thing where at least I would need to be able to use it before I start seeing where in my own stuff I could beneficially apply it |
16:47:26 | * | carce quit (Remote host closed the connection) |
16:47:34 | FromDiscord | <Phil> constructor is from beef, nimja from enthus1ast, nimqml from... I forgot the author, and jester from dom |
16:47:58 | * | carce joined #nim |
16:48:23 | FromDiscord | <Phil> Filippo Cucchetto and Will Szumski |
16:48:30 | FromDiscord | <Phil> (edit) "Filippo Cucchetto and Will Szumski ... " added "are the authors of nimqml" |
16:48:46 | FromDiscord | <Phil> Okay the fact that Filippo's name is the spanish equivalent of my own is kinda weird |
16:52:33 | * | carce quit (Ping timeout: 256 seconds) |
16:53:20 | FromDiscord | <Slazaa> Omg my first OpenGL triangle in Nim ! :D |
16:53:21 | FromDiscord | <Slazaa> Yay |
17:05:49 | FromDiscord | <deech> Is there a way to make a decrementing loop eg. for i in 10..<0: ... |
17:05:57 | FromDiscord | <Yardanico> `countdown` |
17:06:07 | FromDiscord | <Yardanico> https://nim-lang.org/docs/system.html#countdown.i%2CT%2CT%2CPositive |
17:20:52 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4fOP |
17:24:08 | * | pro quit (Quit: pro) |
17:28:47 | * | arkurious joined #nim |
17:36:58 | * | carce joined #nim |
18:22:57 | FromDiscord | <aq47> In reply to @Isofruit "Syntax question: Anybody have": That `delete` probably should go into `QApplication`'s destructor |
18:30:15 | Amun-Ra | let's say I have array[8, byte]; I can check the type via varname.typedef is array; how can I check the array element type? |
18:30:33 | Amun-Ra | got it, varname[0].typeof |
18:32:48 | FromDiscord | <Horizon [She/Her]> What's a small thing I should make in Nim, i need a project but also want to actually complete it |
18:34:44 | Amun-Ra | write someting you already wrote in a different language |
18:35:27 | FromDiscord | <Horizon [She/Her]> I don't have anything i could rewrite :p |
18:35:48 | FromDiscord | <Horizon [She/Her]> ADHD is too bad for trying to complete a project |
18:46:56 | Amun-Ra | google for project ideas for beginners |
18:49:15 | FromDiscord | <spoon> is `nim e` best for evaluating nimscript with `time`? tried comparing lua vs nims eval speed |
18:50:35 | FromDiscord | <spoon> and i mean are there no flags that will help performance like release flag |
18:51:23 | Amun-Ra | is release flag for eval makes sense? |
18:52:03 | FromDiscord | <spoon> no not really, just wondering if it may work more favorably when using the vm alongside importing compiler/nimeval really |
18:52:47 | FromDiscord | <albassort> how do I like libraries when using {.compile: "".} + {.importc.} |
18:52:47 | Amun-Ra | I haven't played nimscript much |
18:52:55 | FromDiscord | <albassort> (edit) "like" => "link" |
18:53:26 | FromDiscord | <spoon> made three tests comparing eval speed with time, each one made a for loop print "test <number>" 100 times, nimscript did it in 0.185s, lua did it in 0.004s and python did it in 0.019s |
18:53:32 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4fP4 |
18:53:39 | FromDiscord | <albassort> (which is what i use to compile it in gcc) |
18:54:11 | Amun-Ra | albassort: you have to pass that information to the linker (passl) |
18:54:21 | FromDiscord | <albassort> ah im braindead |
18:54:57 | FromDiscord | <spoon> so nim eval speed is 46x slower than lua and 9.7 times slower than python from my very unscientific test |
18:55:39 | Amun-Ra | how have you measured eval speed? |
18:56:04 | Amun-Ra | time measures startup + eval |
18:56:10 | FromDiscord | <spoon> i ran it with the `time` command on linux terminal |
18:56:13 | FromDiscord | <spoon> hm true |
18:56:29 | FromDiscord | <spoon> but also python and lua have to start up their own environments, right? |
18:57:03 | Amun-Ra | yes |
18:58:55 | FromDiscord | <spoon> well there is a nim library that measures runtime without external programs, whatever it is. i could run it with that |
18:59:47 | Amun-Ra | you can print cpuTime() diff or sth like that |
19:00:13 | Amun-Ra | let start = cpuTime(); dostuff(); echo cpuTime() - start |
19:01:26 | * | carce quit (Remote host closed the connection) |
19:01:59 | * | carce joined #nim |
19:02:06 | * | carce quit (Remote host closed the connection) |
19:02:38 | * | carce joined #nim |
19:02:42 | FromDiscord | <spoon> well then i'd also have to look into lua and python equivalent functions |
19:03:21 | * | carce quit (Remote host closed the connection) |
19:03:54 | * | carce joined #nim |
19:04:36 | Amun-Ra | hmm, maybe printing difference of seconds (as float) from the epoch? |
19:04:43 | Amun-Ra | python has time.time() |
19:04:57 | Amun-Ra | nim has times.epochTime() |
19:05:01 | * | def- quit (Quit: -) |
19:05:22 | * | def- joined #nim |
19:05:29 | Amun-Ra | and luaโฆ no clue |
19:06:16 | FromDiscord | <spoon> also just realized running `lua filename` doesn't convert it to jit, so effective performance is probably higher |
19:07:13 | Amun-Ra | I think python's version of cpuTime is time.process_time() and lua's is os.clock() |
19:08:28 | * | carce quit (Remote host closed the connection) |
19:09:00 | * | carce joined #nim |
19:11:54 | Zevv | performance measuring in Lua is done with os.clock() |
19:12:07 | Zevv | that's the total CPU time taken by the lua vm since started |
19:12:24 | FromDiscord | <emanresu3> Hi, do you know if there something like the \`\`\`once\`\`\` template, but executes only the last time the block is reached? |
19:12:27 | Zevv | there is no high-res timer in lua by default, only epoch seconds |
19:13:18 | Zevv | emanresu3: interesting idea, but how should it know it is the running last time? |
19:15:15 | FromDiscord | <emanresu3> I wouldnt know, but I know the Raku language implemented it with the \`END\` block, and the \`BEGIN\` block is the analogous of \`once\` in Nim |
19:15:36 | FromDiscord | <emanresu3> Maybe with a macro? |
19:16:13 | Amun-Ra | is that an equivalent of awk's BEGIN and END? |
19:16:44 | Amun-Ra | hmm, I guess you could use defer: |
19:17:54 | Amun-Ra | but that wouldn't work in a different function scope |
19:18:21 | FromDiscord | <emanresu3> Oh, sorry, yeah, they are. Instead I was referring to the ENTER and LEAVE blocks in Rakuโต(<@709044657232936960_=41mun-=52a=5b=49=52=43=5d>) |
19:20:14 | FromDiscord | <lfanew> Is there a way to, say using `when`, to conditionally remove debugging code if the file is being compiled with `-d:release`? |
19:20:31 | FromDiscord | <lfanew> Currently I'm just using some constants, i.e. `const debug = true` and setting that manually |
19:21:28 | Amun-Ra | when not defined release: |
19:22:17 | Amun-Ra | you can also use custom defined variables, ie: const doThat {.booldefine.} = false |
19:22:26 | Zevv | `LAEVE` "Runs at every block exit time (even stack unwinds from exceptions), except when the program exits abruptly (e.g. with exit)." |
19:22:42 | Amun-Ra | compile with -d=doThat to set that constant to true |
19:23:15 | Amun-Ra | Zevv: given that description LEAVE looks just like defer: |
19:23:16 | Zevv | emanresu3: https://nim-lang.org/docs/manual.html#exception-handling-defer-statement |
19:23:31 | Zevv | exactly |
19:23:33 | FromDiscord | <lfanew> Oh both of those will work perfectly. Thank you Amun-Ra |
19:24:08 | Amun-Ra | lfanew: you can also have intdefine for ints and strdefine for strings |
19:24:26 | Amun-Ra | -d=intDefine=2 etc. |
19:25:18 | Amun-Ra | lfanew: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compileminustime-define-pragmas |
19:25:38 | FromDiscord | <lfanew> Looking at those pragmas now too. The comptime options here are exactly what I needed |
19:25:53 | Amun-Ra | lfanew: although if you just want to turn debugging code on/off checking release define is preferred |
19:27:01 | FromDiscord | <Phil> Aye, you want to check for -d:release instead of adding another flag that indicates if you compile debug builds or actual builds |
19:27:32 | FromDiscord | <Phil> -d:release should be the single source of truth for the question "am I compiling a releaseable binary?" |
19:28:17 | FromDiscord | <lfanew> I agree. There's no need to complicate that portion. The other pragmas though will give me some tuning though on some of the verbosity if the time comes I think |
19:29:07 | FromDiscord | <Phil> Given that you want to play around with compiler flags, how are you running those commands so far? Typing in yourself? vscode tasks? Or are you using nimble tasks / nim config ? |
19:29:58 | FromDiscord | <lfanew> I'm still very green to Nim. I'm typing them in currently/creating shell scripts |
19:30:39 | FromDiscord | <Phil> Ahh check, if you want I can give you a quick run down on how you can do the same in nimble and then instead of `bash compileScript.sh` you can do `nimble compile`or `nimble brewMyProject` or whatever you want to call it |
19:30:52 | * | krux02 joined #nim |
19:31:00 | FromDiscord | <Phil> though sadly nimble tasks do not tab autocomplete in the terminal, at least not for me v.v. |
19:31:01 | FromDiscord | <Phil> (edit) "v.v." => "v.v" |
19:31:29 | FromDiscord | <Phil> Though naturally that is something you can always keep for later |
19:31:35 | FromDiscord | <Phil> (edit) "keep for" => "learn" |
19:31:45 | FromDiscord | <lfanew> I'll definitely get to that point. Could I think of nimble as a system comparable to cargo for Rust? |
19:31:56 | FromDiscord | <Phil> Pretty much, it's a package manager |
19:32:34 | FromDiscord | <Phil> You install via `nimble install <package`, you find packages via `nimble search <search string>` and can do a whole lot more with custom defined tasks |
19:32:42 | FromDiscord | <Phil> (edit) "<package`," => "<package>`," |
19:34:11 | FromDiscord | <Phil> There's also a ton more functionality which is documented on the nimble github page (from package publishing to doc generation to cooking you pancakes etc.) |
19:34:51 | FromDiscord | <lfanew> Okay that sounds really useful. I'll probably hold off just a few more days since I'm still really fresh and mostly trying to soak in the language still and learning all ways to work with the compiler |
19:35:10 | FromDiscord | <lfanew> Definitely on my list though because shell scripts and typing is not a fun task for long ๐ |
19:35:15 | FromDiscord | <Phil> All good, we're not here all day, but typically always sometime during the day ๐ |
19:36:06 | FromDiscord | <Phil> In reply to @lfanew "Definitely on my list": I can relate, my webapp-backend had like... 10 different bash scripts to build it in various ways until I figured out how to do the same thing with nimble |
19:38:05 | FromDiscord | <lfanew> I know the pain... lol |
19:43:29 | * | krux02 quit (Remote host closed the connection) |
19:44:09 | * | krux02 joined #nim |
20:40:30 | FromDiscord | <! Nilts> Im planning on installing nim on my main machine, how large is it, im very sensitive about things with large mem. |
20:42:22 | FromDiscord | <! Nilts> (edit) "machine," => "machine." |
20:45:24 | FromDiscord | <Generic> excluding temporary folders my Nim installation (build from git) is around 73 MB |
20:45:40 | FromDiscord | <Generic> though keep in mind that you'll also need a C compiler |
20:45:51 | FromDiscord | <Generic> if you haven't gotten one already |
20:48:28 | FromDiscord | <! Nilts> In reply to @Generic "though keep in mind": i have g++ |
20:49:19 | FromDiscord | <Generic> ok then you're good to go |
20:49:45 | FromDiscord | <! Nilts> In reply to @Generic "excluding temporary folders my": thats alot, is there any way to make it smaller? It is not too much to install id just prefer a smaller version |
20:51:52 | FromDiscord | <Generic> well apparently half of what I measured are compiler sources |
20:52:00 | FromDiscord | <Generic> which you won't have with a binary installation |
20:52:05 | FromDiscord | <Generic> so I guess that's better |
20:52:31 | FromDiscord | <Generic> ah there're are still temporary binaries lurking around |
20:52:33 | FromDiscord | <Generic> in that folder |
20:52:56 | FromDiscord | <Generic> idk how they go there |
20:52:59 | FromDiscord | <! Nilts> well, ill try and see how much it takes |
20:54:07 | FromDiscord | <Phil> Are you sure you're talking about the same things?โตNilts seemed to have asked about memory footprint and from what I gathered from you generic you talked about the size of files etc. |
20:54:23 | FromDiscord | <Phil> At least I'd interpret mem as memory footprint |
20:54:29 | FromDiscord | <Generic> oh |
20:55:05 | FromDiscord | <Generic> idk about memory usage of the compiler |
20:55:15 | FromDiscord | <Generic> but don't use nimsuggest if you care about ram usage hehe |
20:55:27 | arkanoid | is it possible to make a range type from a distinct float? I would like "type Percent = range[UnitLess(0)..UnitLess(100)]" where "type UnitLess = distinct float" |
20:56:20 | FromDiscord | <Phil> I'm not even sure how that would look conceptually. Like, how many members does that range have? |
20:56:28 | arkanoid | I'm getting Error: ordinal or float type expected |
20:56:30 | FromDiscord | <Phil> or rather is it supposed to have |
20:57:12 | FromDiscord | <Generic> In reply to @Isofruit "I'm not even sure": I mean technically floats are discrete haha |
20:57:58 | arkanoid | range type works with float type, but not distinct float type. Maybe there's something I need to borrow? |
20:57:59 | FromDiscord | <Elegantbeef> It should be possible to make a subrange type of a distinct |
20:58:02 | FromDiscord | <Elegantbeef> I swear i bugfixed that |
20:58:05 | FromDiscord | <Phil> Yeh but that's the technical limitation of how far the float can resolve decimal numbers no? |
20:58:33 | FromDiscord | <Generic> yeah, though for a range type it shouldn't matter |
20:59:02 | FromDiscord | <Elegantbeef> I swore i fix this, shame |
20:59:08 | FromDiscord | <Generic> a range can also be defined for a continous value |
20:59:18 | FromDiscord | <Generic> yeah I actually remember that PR |
20:59:52 | arkanoid | I mean: https://play.nim-lang.org/#ix=4fPv |
21:00:59 | arkanoid | I'm receiving same error from all previous versions of nim |
21:01:09 | * | wallabra joined #nim |
21:01:49 | FromDiscord | <Generic> ah hm though |
21:02:04 | FromDiscord | <Generic> it kind of makes sense for the range of distinct float to be not defined |
21:02:24 | FromDiscord | <Generic> unless comparison operators for it are reintroduced |
21:02:39 | FromDiscord | <Elegantbeef> I fixed it for enums i know cause it was an error with httpresponses |
21:02:39 | FromDiscord | <Elegantbeef> So it still exists here |
21:02:42 | arkanoid | kinda of yes, that's why I asked if there's something I need to borrow |
21:03:19 | arkanoid | the error is not something like "you need `<` and `==`" |
21:03:56 | FromDiscord | <Elegantbeef> No |
21:04:08 | FromDiscord | <Elegantbeef> The error is someone doesnt skip `tyDistinct` |
21:04:26 | FromDiscord | <Elegantbeef> I just made it compile right now by adding a single enum value |
21:04:43 | FromDiscord | <Generic> but conceptually it would make more sense if it would require < and == to be defined |
21:04:45 | FromDiscord | <Elegantbeef> semtypes.nim line 270 is the issue |
21:04:49 | FromDiscord | <Elegantbeef> It only skips static types |
21:04:52 | FromDiscord | <Generic> and then the range type would use those custom operators |
21:04:53 | FromDiscord | <Elegantbeef> Indeed |
21:06:12 | FromDiscord | <Elegantbeef> Jeez this error message from this change is funny `Error: conversion from MyDistinct to MyRange is invalid` |
21:07:34 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in) |
21:07:43 | arkanoid | is it worth opening an issue? |
21:07:48 | FromDiscord | <Elegantbeef> Given one cannot define the comparison operators for this it seems a bit odd to support though |
21:08:02 | arkanoid | ok |
21:08:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fPz |
21:08:40 | FromDiscord | <Elegantbeef> Doesnt run for semi obvious reasons |
21:08:53 | * | wallabra joined #nim |
21:09:06 | FromDiscord | <Generic> ideally you should be eable to create ranges of any type which can be ordered |
21:09:23 | FromDiscord | <Elegantbeef> Eh Nim's range types are nice but have the wrong semantics |
21:09:41 | FromDiscord | <Generic> yeah I don't really use them for anything but enums either |
21:11:02 | arkanoid | I've faced this problem while working with a scientific library that deals with unit of measures. There's the UnitLess types that is a distinct float, and a distinct type that limits the range to 0.0..100.0 would make my code safer |
21:11:04 | * | wallabra quit (Client Quit) |
21:12:16 | arkanoid | I know that UnitLess type can be ordered, would be happy to borrow |
21:15:08 | FromDiscord | <! Nilts> I installed nim on windows given the instructions and it is in path yet when i run in cmd it says can't find nim |
21:15:24 | FromDiscord | <Elegantbeef> Personally i find this API better than the Nim range types https://play.nim-lang.org/#ix=4fPA |
21:15:40 | FromDiscord | <Elegantbeef> It doesnt cause an annoying hidden range defect |
21:15:54 | FromDiscord | <Elegantbeef> Ranges have to be converted to so there is no hidden logic you know when there can be a range defect |
21:15:59 | FromDiscord | <Elegantbeef> Did you restart windows? |
21:16:04 | FromDiscord | <Elegantbeef> I know window's path is funny |
21:16:30 | FromDiscord | <! Nilts> In reply to @Elegantbeef "Did you restart windows?": no... |
21:17:14 | FromDiscord | <Elegantbeef> Then there is the issue that Nim range types use the base types operators |
21:17:27 | FromDiscord | <Elegantbeef> So like `a + b` returns float instead of `MyDistinct` and it's unchecked |
21:18:39 | * | wallabra joined #nim |
21:19:23 | FromDiscord | <pietroppeter> In reply to @pietroppeter "Btw <@800432830605819906> I": @rlipsc here is the issue with polymorph not working with js backend https://github.com/rlipsc/polymorph/issues/21 |
21:22:39 | FromDiscord | <! Nilts> In reply to @Elegantbeef "Did you restart windows?": works after restart |
21:22:47 | FromDiscord | <Elegantbeef> Blame winblows |
21:23:09 | arkanoid | Elegantbeef, with "So like `a + b` returns float instead of `MyDistinct` and it's unchecked" are you still talking about Nim range types, or your witty implementation you've just shared? |
21:23:36 | FromDiscord | <Elegantbeef> Both cause i have a converter ๐ |
21:23:47 | * | derpydoo quit (Ping timeout: 260 seconds) |
21:25:55 | * | carce quit (Remote host closed the connection) |
21:26:27 | * | carce joined #nim |
21:26:37 | FromDiscord | <Elegantbeef> There is still the issue that i'm using defects and defects are a great idea but are bad cause they're untracked |
21:27:28 | arkanoid | just use RangeError! :P |
21:27:40 | FromDiscord | <Elegantbeef> No |
21:27:44 | * | carce quit (Remote host closed the connection) |
21:27:46 | arkanoid | it was a joke |
21:27:53 | FromDiscord | <Elegantbeef> I know |
21:27:56 | * | carce joined #nim |
21:28:25 | FromDiscord | <Elegantbeef> The issue with range defects is that the programmer doesnt know about them, so in reality i'd probably never actually have `toBase` for my range types |
21:28:25 | arkanoid | btw, my brain is not powerful enough to follow here, I think too many Nim internals are tangled here. I need a brain upgrade, or possibly a coffee |
21:28:34 | FromDiscord | <pietroppeter> btw polymorph is at 99 stars, who wants to be #100? https://github.com/rlipsc/polymorph |
21:28:51 | FromDiscord | <Elegantbeef> Wait i have more stars on nimscripter than rlispc has on polymorph |
21:29:02 | FromDiscord | <Elegantbeef> That's unconscionable |
21:29:20 | FromDiscord | <Elegantbeef> Too bad i dont star repos |
21:31:34 | FromDiscord | <Elegantbeef> Nimscripter has 106 stars so you people need to click with more feeling |
21:31:36 | arkanoid | pietroppeter, only if compared with https://github.com/paranim/pararules ! |
21:31:56 | FromDiscord | <Elegantbeef> I mean they're two different systems |
21:32:07 | arkanoid | what's the use case for Nimscripter? |
21:32:31 | FromDiscord | <Elegantbeef> Embeding nimscript in a program and crying about the NimVm's speed |
21:32:52 | arkanoid | ECS and rule-based shares a lot, the first is much newer than the second |
21:33:09 | FromDiscord | <Elegantbeef> It was mostly just done cause i liked Pmunch's idea of using NimVm for configuration and the like |
21:33:26 | FromDiscord | <Elegantbeef> But now i'm a wasm fan, so shucks ๐ |
21:33:40 | arkanoid | ok, but why I want to embed nimscript and it's VM in a nim program? Is it more convenient than lua/python/whatever? |
21:33:44 | FromDiscord | <pietroppeter> In reply to @Elegantbeef "Too bad i dont": well at some point you did ๐ https://github.com/beef331?tab=stars |
21:33:53 | FromDiscord | <Elegantbeef> Yea it is |
21:34:25 | * | fallback quit (Ping timeout: 260 seconds) |
21:34:43 | FromDiscord | <Elegantbeef> Meh i use stars for bookmarks more than anything |
21:35:10 | arkanoid | could you make me an example why NimVM is more convenient than other made-for-runtime scripting languages? |
21:35:15 | FromDiscord | <pietroppeter> yeah yeah fair enough just busting b... stars.... |
21:35:26 | FromDiscord | <albassort> i have a pointer to an array of integers in C |
21:35:34 | FromDiscord | <albassort> how do i case it in C |
21:35:45 | FromDiscord | <albassort> How do i cast it in Nim |
21:35:52 | FromDiscord | <Elegantbeef> Nimscript is Nim, so you can export all your code to the backend and use it the same as you'd use there |
21:35:57 | FromDiscord | <alice.> so when is nim going to actually let me define duplicate items in `case` ADT type syntax |
21:36:01 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimscripter#getting-global-variables-from-nimscript |
21:36:16 | FromDiscord | <alice.> kinda insane this isnt a feature yet every other FP language has it |
21:36:20 | FromDiscord | <Elegantbeef> `cast[T](y)` |
21:36:24 | FromDiscord | <Elegantbeef> Nim isnt a FP language |
21:36:26 | FromDiscord | <albassort> i tried ptr seq[cint] but im getting nothing |
21:36:41 | FromDiscord | <Elegantbeef> You cannot cast a pointer to a sequence |
21:36:46 | FromDiscord | <alice.> sure but its unions cant be that shit that u need to tag every item |
21:36:49 | FromDiscord | <albassort> hmmmmmm |
21:36:54 | FromDiscord | <albassort> then what do i use for this function |
21:36:59 | FromDiscord | <alice.> (edit) "shit" => "bad" |
21:37:12 | FromDiscord | <alice.> this is the one feature stopping it from being my favorite language |
21:37:36 | FromDiscord | <albassort> if you want it to be a feature |
21:37:41 | FromDiscord | <albassort> you can probably macro your way into i t |
21:37:48 | FromDiscord | <albassort> macros are pretty neat |
21:38:23 | FromDiscord | <Elegantbeef> Declaring duplicate items in branches is a complexity on the unpacking end |
21:38:24 | FromDiscord | <Elegantbeef> Especially if you have a complex union |
21:38:24 | FromDiscord | <Elegantbeef> Or if you allow them to have different types |
21:38:25 | FromDiscord | <Elegantbeef> `cast[ptr UncheckedArray[int])(myPtrInt)`? |
21:38:40 | FromDiscord | <auxym> In reply to @albassort "**How do i cast": `cast[ptr UncheckedArray[SomeType]](yourPointer) |
21:38:45 | FromDiscord | <Generic> I'm still not sure how that would even be implemented |
21:38:48 | FromDiscord | <Elegantbeef> Well there is an RFC and it's planned to be implemented |
21:38:54 | FromDiscord | <auxym> also consider `toOpenArray` |
21:39:05 | FromDiscord | <Generic> either there would be separate unions for those shared fields |
21:39:05 | FromDiscord | <Elegantbeef> Araq's rfc seems to indicate reusing the case |
21:39:10 | FromDiscord | <alice.> In reply to @Generic "I'm still not sure": every FP language does it |
21:39:27 | arkanoid | Elegantbeef, I'm wrapping my head around this, and I start to see where I would apply NimVM in my projects. Next natural question is: why wasm would compete in same arena? |
21:39:35 | FromDiscord | <Generic> In reply to @alice. "every FP language does": yes, but they work differently than Nim |
21:39:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fPH |
21:39:46 | FromDiscord | <Generic> I'm talking about the internal representation |
21:39:53 | FromDiscord | <Elegantbeef> Cause wasm is an embedable VM that is language agnostic |
21:39:58 | FromDiscord | <alice.> the nim source code is really confusing |
21:40:03 | FromDiscord | <Elegantbeef> Yea i started writing the message before that was clear |
21:40:05 | FromDiscord | <Generic> with FP language you pretty much always unpack the whole case object |
21:40:14 | FromDiscord | <alice.> then do that? |
21:40:33 | Amun-Ra | and as for me: wasm can handle 64-bit uints and js doesn't |
21:40:38 | FromDiscord | <Elegantbeef> PR's welcome\ ๐ |
21:40:48 | FromDiscord | <Elegantbeef> Amun we're talking about embedding wasm |
21:40:53 | FromDiscord | <Elegantbeef> So like embeding JS is doable it's dumb |
21:40:55 | FromDiscord | <Generic> In reply to @alice. "then do that?": that would require disallowing something which is currently allowed in Nim |
21:41:11 | FromDiscord | <Generic> which is that you can access individual members of case objects |
21:41:22 | FromDiscord | <Generic> like normal members |
21:41:35 | FromDiscord | <alice.> then disallow it |
21:41:39 | FromDiscord | <Elegantbeef> It also makes the checks on objects more costly ๐ |
21:41:45 | FromDiscord | <alice.> if it means case objects can be actually good |
21:41:51 | FromDiscord | <alice.> not some win32 prefix level bs |
21:41:54 | FromDiscord | <Generic> it would break tons of code |
21:42:06 | arkanoid | I think I need a good read about wasm and how it can be used. I only know wasm as "faster JS but not always" to replace frontend.js |
21:42:17 | FromDiscord | <Generic> and also would just not fit idiomatically with Nim |
21:42:25 | FromDiscord | <Generic> there are ways around it |
21:42:27 | FromDiscord | <Elegantbeef> Wasm has embeddable runtimes just like other scripting languages |
21:42:32 | FromDiscord | <Elegantbeef> So it's a fantastic idea to use it for scripting |
21:42:42 | FromDiscord | <albassort> /`` |
21:42:59 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4fPJ |
21:43:24 | FromDiscord | <Elegantbeef> Look at this module https://github.com/beef331/wasm3/blob/master/wasmsources/maths.nim i load it here and call the procedures https://github.com/beef331/wasm3/blob/master/tests/test1.nim#L82-L87 |
21:44:09 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fPK |
21:44:22 | FromDiscord | <Elegantbeef> I mean you're making your AST complex and slow |
21:44:25 | FromDiscord | <Elegantbeef> ๐ |
21:44:25 | FromDiscord | <Generic> I know what the issue is, I don't like it either |
21:44:28 | FromDiscord | <alice.> (edit) "https://play.nim-lang.org/#ix=4fPK" => "https://play.nim-lang.org/#ix=4fPL" |
21:44:39 | FromDiscord | <alice.> yeah its stopping me from liking this language |
21:44:48 | FromDiscord | <alice.> everythign else is pretty modern |
21:44:52 | FromDiscord | <alice.> this screams 1990s windows |
21:45:22 | arkanoid | Elegantbeef ok but for *scripting* you usually mean something human readable and hackable out of the box, like a py or lua file. If you drop a "compile to wasm" step in the middle, isn't it the same of compiling myscript.dll, reload it at runtime, execute it? |
21:45:32 | FromDiscord | <Generic> I mean if you're coming from fp you can just make the members of the case branches tuples |
21:45:36 | FromDiscord | <Elegantbeef> Wasm is sandboxed |
21:45:39 | FromDiscord | <Elegantbeef> It's vastly more safe |
21:45:43 | FromDiscord | <Generic> and then you always pack and unpack those |
21:45:48 | FromDiscord | <alice.> In reply to @Generic "I mean if you're": isnt that less efficient |
21:45:57 | FromDiscord | <alice.> for a giant AST |
21:46:23 | FromDiscord | <! Nilts> Is there anything in nim like eval or exec in python? |
21:46:23 | FromDiscord | <Generic> if you're putting giant value types in there yes |
21:46:24 | arkanoid | Elegantbeef, that's a very good point. Gamechanger actually. Yeah |
21:46:28 | FromDiscord | <alice.> rust did ADTs good |
21:46:28 | FromDiscord | <Generic> otherwise no |
21:46:36 | arkanoid | thanks |
21:47:18 | FromDiscord | <Generic> though what I wanted to say the whole time is that the issue is that every struct member has to have a fixed memory offset |
21:47:25 | FromDiscord | <Elegantbeef> Aslong as you dont use a JIT'd wasm runtime that is |
21:47:28 | FromDiscord | <Generic> if you have a case object like this: |
21:47:43 | FromDiscord | <Elegantbeef> Making a giant AST object variant is a bad idea for memory allocations and likely speed ๐ |
21:48:04 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4fPM |
21:48:32 | FromDiscord | <Generic> what is `offsetof(someValueofX, x)`? |
21:48:42 | FromDiscord | <alice.> sent a code paste, see https://paste.rs/nyF |
21:48:46 | FromDiscord | <alice.> if rust can do it |
21:48:48 | FromDiscord | <alice.> nim can |
21:48:50 | FromDiscord | <alice.> no excuses |
21:48:54 | FromDiscord | <Generic> yes, because you always unpack it |
21:49:00 | FromDiscord | <Generic> I've said this before |
21:49:01 | FromDiscord | <alice.> then do that too |
21:49:12 | FromDiscord | <Generic> no, because it would break the language |
21:49:17 | FromDiscord | <alice.> seems weird that they would pick the worse way |
21:49:26 | FromDiscord | <! Nilts> In reply to @not logged in "Is there anything in": like execute a chuck of nim and get the result. Like `eval("1+2")` would result in the int 3 |
21:49:30 | FromDiscord | <alice.> why would u ever inspect an element that may not be there?? |
21:49:56 | FromDiscord | <alice.> without first unpacking |
21:50:25 | FromDiscord | <Generic> e.g. if you're calling a function which assumes that the case objects are of a certain kind |
21:52:13 | FromDiscord | <auxym> In reply to @not logged in "like execute a chuck": the reason you can do that in python or js is that they are interpreted. Nim is compiled ahead of time, so no, you can't do that. Unless you include a parser/interpreter in your program, which is possible (nimscripter) |
21:52:51 | FromDiscord | <alice.> also what is up w/ the hungarian notation for enums? |
21:52:59 | FromDiscord | <alice.> we ditched that with C++ |
21:53:06 | FromDiscord | <! Nilts> In reply to @auxym "the reason you can": i kinda got that, just making sure. |
21:53:28 | FromDiscord | <Generic> In reply to @alice. "also what is up": it's not hungarian notation |
21:53:40 | FromDiscord | <Generic> it's just a short form prefix identifying the type |
21:53:49 | FromDiscord | <Generic> it's getting phased out though with overloadable enums |
21:54:32 | FromDiscord | <Generic> and imho it's was better than always having to type out the full typename with EnumName.enumValue |
21:55:09 | FromDiscord | <Elegantbeef> You're likely to make a much larger object than you need which will make allocations slower and slow down smaller object branches |
21:55:17 | FromDiscord | <Elegantbeef> Anyway arkanoid I am mostly looking at wasm for game plugins so it's much safer for distributing wasm files, they're also language/platform agnostic so one written and compiled on a linux machine runs everywhere the VM does |
21:55:17 | FromDiscord | <Elegantbeef> System libraries are both platform specific and suspect as all hell |
21:55:18 | FromDiscord | <Elegantbeef> Anyway alice https://github.com/nim-lang/RFCs/issues/368 |
21:55:51 | FromDiscord | <Elegantbeef> Offset of `x` is an error ๐ |
21:56:01 | FromDiscord | <alice.> the accepted proposal is shit |
21:56:07 | FromDiscord | <alice.> i cant just recreate the rust example using that |
21:56:08 | FromDiscord | <alice.> because |
21:56:33 | FromDiscord | <Elegantbeef> Matrix had a stroke, i'm back bitches! |
21:56:43 | FromDiscord | <auxym> In reply to @alice. "also what is up": v2 will have OverloadableEnums, which eliminates the need to the "hungarian" stuff. Personally I just use pure enums (almost) everywhere |
21:56:43 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fPS |
21:57:06 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fPU |
21:57:11 | FromDiscord | <Generic> In reply to @Elegantbeef "Offset of `x` is": how so, it would make sense |
21:57:23 | FromDiscord | <Generic> ah I see the accepted RFC makes sense |
21:57:27 | FromDiscord | <alice.> anyway its a gripe |
21:57:33 | FromDiscord | <alice.> its just annoying when the rest of the language is modern |
21:57:42 | FromDiscord | <Elegantbeef> It requires runtime logic to figure out the offset as such there isnt a way to figure it out statically and isnt `offsetOf` static |
21:57:50 | FromDiscord | <Generic> no it doesn't |
21:57:53 | FromDiscord | <alice.> and its enums are basically C enums w/ "syntax sugar" |
21:57:57 | FromDiscord | <Generic> that's the whole beauty of it |
21:58:04 | FromDiscord | <Generic> each case is a different tagged union |
21:58:17 | FromDiscord | <Generic> I see now |
21:58:56 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fPX |
21:59:07 | FromDiscord | <alice.> under the hood |
21:59:18 | FromDiscord | <Generic> no |
21:59:22 | FromDiscord | <Elegantbeef> I like that you call them `enum NimEnum` |
21:59:27 | FromDiscord | <Generic> it's a union type |
21:59:35 | FromDiscord | <Elegantbeef> Each branch is a Union |
21:59:38 | FromDiscord | <Generic> that's the issue, they share memory |
21:59:53 | FromDiscord | <Generic> In reply to @Elegantbeef "Each branch is a": no it's a union of structs this way around |
22:00:06 | FromDiscord | <alice.> In reply to @Elegantbeef "I like that you": i was giving an example |
22:00:11 | FromDiscord | <alice.> of how its probably structured |
22:00:19 | FromDiscord | <alice.> seeing as it allows u to directly access members |
22:00:29 | FromDiscord | <alice.> it wouldnt be a enum of pointers to structs |
22:00:31 | FromDiscord | <Elegantbeef> I'd say that's each branch is a union but i'll say i'm wrong |
22:00:59 | FromDiscord | <Generic> in the generated C code there's one union per case and each case branch is a struct within that union |
22:01:19 | FromDiscord | <Elegantbeef> \I still say that's |
22:01:25 | FromDiscord | <Elegantbeef> each branch is a union\ ๐ |
22:01:40 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fQ0 |
22:01:44 | arkanoid | Elegantbeef, yes I see the picture now. Wasm is the answer to many problems: performance, security, obfuscation, compactness |
22:01:48 | FromDiscord | <alice.> ofc in a union |
22:02:05 | FromDiscord | <alice.> (edit) "https://play.nim-lang.org/#ix=4fQ0" => "https://paste.rs/Y4j" |
22:02:30 | FromDiscord | <alice.> so i think nim enums would need to be significantly changed to fix this |
22:02:42 | FromDiscord | <Generic> Nim enums are completely fine |
22:02:48 | FromDiscord | <Generic> and in memory the Nim version (where the different idents have different prefixes) and the Rust version have the exact same representation |
22:02:50 | FromDiscord | <alice.> theyre not |
22:02:55 | FromDiscord | <alice.> they suck for my use cases |
22:03:04 | FromDiscord | <alice.> im not gonna prefix variable names like a caveman |
22:03:08 | FromDiscord | <Generic> overloadable enums |
22:03:13 | FromDiscord | <alice.> i mean |
22:03:16 | FromDiscord | <Generic> I've said it before |
22:03:16 | FromDiscord | <alice.> the `case of` |
22:03:22 | FromDiscord | <alice.> overloadable enums wont fix that |
22:03:25 | FromDiscord | <Generic> yes say tagged enums or variant objects |
22:03:27 | FromDiscord | <Elegantbeef> Generic they mean like `bVal` and `strVal` |
22:03:29 | FromDiscord | <Generic> if you mean those |
22:03:33 | FromDiscord | <Generic> not enums |
22:03:35 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fQ1 |
22:03:40 | FromDiscord | <alice.> In reply to @Elegantbeef "Generic they mean like": yeah this |
22:03:44 | FromDiscord | <Generic> use the right term |
22:03:45 | FromDiscord | <alice.> ADTs then |
22:03:54 | FromDiscord | <Elegantbeef> ADTs mean so much |
22:04:00 | FromDiscord | <alice.> when i mean enums i mean rust style enums |
22:04:01 | FromDiscord | <alice.> or ADTs |
22:04:06 | FromDiscord | <alice.> whatever they are called |
22:04:53 | FromDiscord | <Generic> well you could probably write a macro which would allow you to do things like in Rust |
22:05:07 | FromDiscord | <Generic> where you could share names across branches |
22:05:16 | FromDiscord | <Generic> but you would loose the ability to just freely access fields |
22:05:19 | FromDiscord | <.tochka> In reply to @alice. "and its enums are": never knew C enums are sum types, pretty cool pretty cool :D |
22:06:38 | FromDiscord | <alice.> i mean |
22:06:41 | FromDiscord | <alice.> theyre just unions |
22:06:52 | FromDiscord | <.tochka> In reply to @alice. "rust enums (would look": thats invalid C ;p |
22:06:54 | FromDiscord | <Elegantbeef> You used `enum` instead of `struct` |
22:07:05 | FromDiscord | <alice.> In reply to @.tochka "thats invalid C ;p": is it? |
22:07:05 | FromDiscord | <Elegantbeef> Cause rust enums rot the brain |
22:07:14 | FromDiscord | <Generic> to be fair, Java did it first |
22:07:17 | FromDiscord | <alice.> rust enums are nice :( |
22:07:22 | FromDiscord | <alice.> granted enum is a bad name for them |
22:07:43 | FromDiscord | <Elegantbeef> Rust doesnt even have enum indexed arrays it's literally unusable |
22:07:58 | FromDiscord | <Generic> ^ |
22:08:15 | FromDiscord | <Elegantbeef> It also doesnt have bitsets |
22:08:20 | FromDiscord | <Elegantbeef> It's a language made as a toy! |
22:08:22 | FromDiscord | <Elegantbeef> ๐ |
22:08:40 | FromDiscord | <Generic> strong ordinal support ftw |
22:08:52 | FromDiscord | <alice.> In reply to @Elegantbeef "Rust doesnt even have": TIL |
22:09:07 | FromDiscord | <alice.> what are ur thoughts on D? |
22:09:19 | FromDiscord | <Elegantbeef> It's C++ but slightly less cursed |
22:09:19 | FromDiscord | <Generic> it's ok I guess |
22:09:30 | FromDiscord | <Generic> to me it feels a bit like too little, too late |
22:09:36 | FromDiscord | <.tochka> sent a code paste, see https://play.nim-lang.org/#ix=4fQ4 |
22:10:10 | FromDiscord | <Elegantbeef> All that pointer indirection is not good for your health |
22:10:43 | arkanoid | haha |
22:10:52 | FromDiscord | <Elegantbeef> It stack allocates though right? ๐ |
22:11:50 | FromDiscord | <.tochka> In reply to @Elegantbeef "It also doesnt have": rust be like: use external crate, we like our std smol |
22:12:03 | FromDiscord | <Elegantbeef> The crate doesnt even work though |
22:12:18 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fQ5 |
22:12:18 | FromDiscord | <Elegantbeef> You cannot use it on arbitrary enums |
22:12:40 | FromDiscord | <Generic> well we'll just pretend you wrote C++ |
22:12:42 | FromDiscord | <Generic> then it's ok |
22:12:43 | FromDiscord | <.tochka> nim bad cos no pattern matching builtin |
22:13:03 | FromDiscord | <alice.> i wonder if nim could let u pattern match on objects and then have the ability to have duplicate members too |
22:13:15 | FromDiscord | <alice.> or some mix |
22:13:33 | FromDiscord | <alice.> maybe have `case` for traditional, and `match` where it matches the whole object? |
22:13:37 | FromDiscord | <.tochka> duplicate members? |
22:13:53 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fQ6 |
22:13:56 | FromDiscord | <Elegantbeef> Object variants with repeated names |
22:13:59 | FromDiscord | <alice.> yep |
22:14:04 | FromDiscord | <.tochka> ahh |
22:14:07 | FromDiscord | <Elegantbeef> Runtime checks get fucking funky there |
22:14:24 | * | jmdaemon joined #nim |
22:14:55 | FromDiscord | <.tochka> it should be able if you match for variant, so, names are local to particular variant then |
22:15:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fQ7 |
22:15:56 | FromDiscord | <.tochka> lol |
22:16:56 | FromDiscord | <Elegantbeef> Say what you will but atleast with OOP it's less complex for field access ๐ |
22:20:23 | FromDiscord | <Generic> well if you force unpacking, it's relatively simple again |
22:20:53 | FromDiscord | <Generic> also alice, I've just noticed there's a much more often and practical advantage to Nim's design of tagged unions |
22:21:13 | FromDiscord | <Elegantbeef> You can have nested complex trees is my one major benefit |
22:21:19 | FromDiscord | <Elegantbeef> Without having to make 3 different types |
22:23:38 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4fQa |
22:26:14 | FromDiscord | <.tochka> kind gets sanity checked on access of field? |
22:26:40 | FromDiscord | <Generic> yes |
22:26:57 | FromDiscord | <.tochka> rust with its forcing of unpacking to get access kinda makes it more secure, at least semantically |
22:29:00 | FromDiscord | <Elegantbeef> Nim can have definitive reasoning, just not implemented |
22:29:39 | FromDiscord | <Generic> it would eliminate the first advantage of the advantages of it's case objects I mentioned |
22:29:47 | FromDiscord | <Generic> but the second one would still remain |
22:30:06 | FromDiscord | <Elegantbeef> The first being? |
22:30:45 | FromDiscord | <Generic> that you could for example have a function which gets case objects passed and it assumes that they have a certain type |
22:30:55 | FromDiscord | <Generic> well now that I'm thinking about it, you could also just add an assertion |
22:31:01 | FromDiscord | <Generic> and if the analysis is good enough |
22:31:22 | FromDiscord | <Elegantbeef> Yep |
22:31:53 | FromDiscord | <Elegantbeef> Value/range narrowing is something I'd like to see |
22:32:00 | FromDiscord | <Generic> yeah me to |
22:32:02 | FromDiscord | <Elegantbeef> I dont know if it has a proper name, but meh |
22:32:10 | FromDiscord | <Generic> I even made the RFC for that |
22:32:32 | FromDiscord | <Generic> https://github.com/nim-lang/RFCs/issues/429 |
22:32:45 | FromDiscord | <Elegantbeef> Oh right i commented on that |
22:32:55 | FromDiscord | <Elegantbeef> I forgot which duck wrote that ๐ |
22:33:26 | FromDiscord | <Generic> ducks are cool |
22:33:34 | FromDiscord | <Generic> I don't blame anyone else for have a duck username as well |
22:42:06 | * | carce quit (Remote host closed the connection) |
22:42:39 | * | carce joined #nim |
22:47:17 | * | carce quit (Ping timeout: 256 seconds) |
22:53:23 | * | adium quit (Ping timeout: 252 seconds) |
23:34:58 | * | fallback joined #nim |
23:38:37 | * | krux02 quit (Remote host closed the connection) |
23:49:01 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzzโฆ) |
23:57:53 | * | dnh joined #nim |