00:30:30 | * | duuude quit (Ping timeout: 260 seconds) |
00:38:39 | * | reversem3[m] quit (Ping timeout: 240 seconds) |
00:39:21 | * | buster_blue[m] quit (Ping timeout: 248 seconds) |
00:53:36 | * | sagax quit (Remote host closed the connection) |
01:03:45 | * | vicfred joined #nim |
01:07:20 | FromDiscord | <ynfle> How do I get the root dir of the nimble package? |
01:07:53 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/nimscript.html#projectDir |
01:08:15 | FromDiscord | <Elegantbeef> If you're inside nimble that might work, otherwise you're pooched |
01:09:09 | * | reversem3[m] joined #nim |
01:10:54 | FromDiscord | <ynfle> Thanks I realized it doesn't make sense for me because it's a binary |
01:11:04 | FromDiscord | <ynfle> At runtime |
01:11:23 | FromDiscord | <Elegantbeef> `getAppDir` or w/e in the `std/os` |
01:22:15 | * | bananahead quit (Ping timeout: 252 seconds) |
01:23:04 | * | bananahead joined #nim |
01:26:42 | FromDiscord | <Zoom> How do you deal with ambiguous calls to funcs taking `openArray[char]` and `cstring`? `string` satisfies both |
01:27:06 | FromDiscord | <Elegantbeef> What do you mean? |
01:27:27 | FromDiscord | <Elegantbeef> you can do `proc(a: string)(myProcName)` |
01:29:06 | FromDiscord | <Zoom> I mean `Error: ambiguous call; both modA.foo(s: openArray[char]) blah-blah and modB.foo(s: cstring) match for (string)` |
01:29:57 | FromDiscord | <Elegantbeef> yea i mean `proc(a: openarray[char])(foo)(myString)` |
01:30:14 | FromDiscord | <Elegantbeef> That's how you resolve ambiguity in Nim |
01:32:59 | * | sagax joined #nim |
01:39:10 | FromDiscord | <Zoom> Sorry, not following. `modA.foo` was a direct match before, the changes introduced ambiguity |
01:40:34 | FromDiscord | <Elegantbeef> If you are authoring the module you can do `a: cstring and not string` or the same for `openArray[T]` |
01:41:34 | FromDiscord | <Elegantbeef> The old implicit conversion is kicking resolution's ass |
01:42:19 | FromDiscord | <Zoom> Thanks, this will do |
01:44:47 | FromDiscord | <Zoom> Nope, `openArray[char] and not cstring` doesn't work \:P |
01:47:25 | * | stkrdknmibalz quit (Ping timeout: 256 seconds) |
01:49:35 | FromDiscord | <Elegantbeef> Nope it wont |
01:49:36 | FromDiscord | <Elegantbeef> openarray is dumbly evaluated |
01:49:36 | FromDiscord | <Elegantbeef> Forgot about that |
01:51:52 | FromDiscord | <Zoom> Well, `foo(a: string | openArray[char])` works, however stupid it may look. |
01:52:17 | FromDiscord | <ynfle> I'm just using a cache dir |
01:58:39 | * | buster_blue[m] joined #nim |
02:16:08 | * | fallback quit (Ping timeout: 260 seconds) |
02:16:36 | * | qwestion quit (Ping timeout: 248 seconds) |
02:18:12 | * | droidrage quit (Ping timeout: 248 seconds) |
02:18:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/EFF |
02:18:46 | FromDiscord | <Elegantbeef> I'm dumb |
02:19:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/0fs |
02:20:03 | FromDiscord | <Elegantbeef> Implicit conversions dont work with generic type classes |
02:27:25 | * | fallback joined #nim |
02:42:53 | * | Zectbumo quit (Remote host closed the connection) |
02:49:43 | * | kayabaNerve joined #nim |
02:56:12 | FromDiscord | <Prestige> Is there a way to have a param type be a subset of an enum's values? |
02:56:31 | FromDiscord | <Prestige> like proc foo(a: SomeEnum.A | SomeEnum.B) |
02:57:00 | FromDiscord | <Elegantbeef> You cannot dispatch on values only ranges |
02:57:02 | FromDiscord | <Elegantbeef> you can do `proc foo(a: A..B)` |
02:57:23 | FromDiscord | <Prestige> hmm |
02:59:28 | FromDiscord | <Elegantbeef> It doesnt let you specialize for values though it's just runtime checked |
03:00:01 | FromDiscord | <Elegantbeef> You make want `proc foo(a: static Foo) = when a in {A, B}: ... else: {.error: "Invalid type".}` |
03:02:07 | FromDiscord | <Prestige> oh cool that would work great actually |
03:02:09 | FromDiscord | <Prestige> thanks |
03:11:55 | FromDiscord | <Elegantbeef> Static parameters are wonderful |
03:12:55 | FromDiscord | <Prestige> Hm I actually need a different additional param if it's a certain set of enum states passed in |
03:13:05 | FromDiscord | <Prestige> idk maybe I'll just write duplicate functions |
03:15:24 | FromDiscord | <Elegantbeef> Yea no clue what you're doing |
03:16:47 | FromDiscord | <Elegantbeef> 😄 |
03:16:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/KTF |
03:17:43 | * | arkurious quit (Quit: Leaving) |
03:18:09 | FromDiscord | <Prestige> It's for controller axes |
03:18:16 | * | Zectbumo joined #nim |
03:18:39 | FromDiscord | <Prestige> So if they pass in Axis.LEFT_X I need to check Direction. LEFT and Direction.RIGHT |
03:19:21 | FromDiscord | <Prestige> I need to disallow passing in Direction.UP and Direction.DOWN if they pass in an X axis, etc |
03:19:33 | FromDiscord | <Prestige> which should all be able to be done at compile time |
03:20:54 | FromDiscord | <Elegantbeef> Yea you can do `static: assert dir in {Up, Down}` |
03:22:52 | FromDiscord | <Prestige> ah inside the function? Neat |
03:25:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XyC |
03:26:24 | FromDiscord | <Elegantbeef> then you do `dir.toHorz` and have a safely typed Horz/Vert 😄 |
03:35:01 | FromDiscord | <Prestige> Okay one more thing, is there a way to go from an enum value to the enum state? Where the values are sparse ints, can't use them for ordinals. Maybe I just need to iterate and match |
03:36:08 | FromDiscord | <Elegantbeef> "the enum state"? |
03:37:13 | FromDiscord | <Prestige> like Axis.LEFT_X = 5 |
03:37:17 | FromDiscord | <huantian> Do you mean like ParseEnum? |
03:37:19 | FromDiscord | <Prestige> I need to go from 5 to LEFT_X |
03:37:28 | FromDiscord | <Elegantbeef> Yea make a table at compile time |
03:37:33 | FromDiscord | <Elegantbeef> I do it with SDL2 in my inputs.nim |
03:39:03 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/inputs.nim#L22-L54 |
03:39:05 | FromDiscord | <Prestige> just a const table to reverse the mapping? |
03:39:08 | FromDiscord | <Prestige> ty |
03:39:38 | FromDiscord | <Elegantbeef> I emit my own enum instead of using theirs |
03:39:47 | FromDiscord | <Elegantbeef> Then i convert to mine in the event handle loop |
03:40:18 | FromDiscord | <Elegantbeef> I like enum indexed stuff, not that it's ideal the way i use it 😄 |
03:40:47 | * | rockcavera quit (Remote host closed the connection) |
03:44:36 | FromDiscord | <Prestige> I think I'll just do a const table |
03:44:42 | FromDiscord | <Prestige> macros are still too unreadable for me |
03:46:33 | * | kayabaNerve quit (Ping timeout: 276 seconds) |
03:46:50 | FromDiscord | <Elegantbeef> iirc it emits the table for an enum to another |
03:46:53 | FromDiscord | <Elegantbeef> So you maay want to steel that |
03:57:09 | * | slowButPresent quit (Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)) |
03:58:07 | * | kayabaNerve joined #nim |
04:08:26 | FromDiscord | <Rika> Beef do I need to make a new pico project just to run an example in the repo |
04:08:38 | FromDiscord | <Rika> Also is this why you technically have no tests |
04:08:40 | FromDiscord | <Elegantbeef> I think so |
04:28:42 | * | duuude joined #nim |
05:04:33 | * | ltriant_ joined #nim |
05:06:39 | * | ltriant quit (Ping timeout: 252 seconds) |
05:09:52 | FromDiscord | <Prestige> There's really no way to create a type that's a set of enum states? I really thought that would be a thing that exists |
05:10:09 | FromDiscord | <Elegantbeef> I showed you how but you didnt want it |
05:10:13 | FromDiscord | <Rika> You can? Just not a selective set |
05:10:26 | FromDiscord | <Elegantbeef> You can with a selective set aswell |
05:10:34 | FromDiscord | <Rika> Really? |
05:10:40 | FromDiscord | <Prestige> eh? |
05:11:00 | FromDiscord | <Prestige> Were you talking about the `toHorz` thing? |
05:11:07 | FromDiscord | <Elegantbeef> Before that |
05:11:12 | FromDiscord | <Prestige> I mean something like https://play.nim-lang.org/#ix=3XyS |
05:11:57 | FromDiscord | <Prestige> or `SubFoo = A | C` |
05:14:53 | FromDiscord | <Prestige> I couldn't get your `MyCheckedFoo` thing to work if that's what you meant |
05:15:50 | FromDiscord | <Elegantbeef> Ruh roh compiler bug |
05:18:32 | FromDiscord | <Prestige> What now? |
05:21:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XyT |
05:22:18 | FromDiscord | <Elegantbeef> Sadly cannot do `type CheckedEnum[T: enum, S: static set[T]] = distinct T` |
05:22:28 | FromDiscord | <Elegantbeef> Compiler cannot reason `static set[T]` |
05:23:53 | FromDiscord | <Prestige> weird |
05:24:13 | FromDiscord | <Prestige> I might just make 4 functions, 1 for each direction, then |
05:26:44 | * | duuude quit (Remote host closed the connection) |
05:28:10 | * | duuude joined #nim |
05:33:12 | FromDiscord | <Elegantbeef> I did the fucked up stuffs |
05:33:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/bcR |
05:33:24 | FromDiscord | <Prestige> I'm still shocked we can't create concrete types like that, it sohuld be possible |
05:33:28 | FromDiscord | <Prestige> (edit) "sohuld" => "should" |
05:33:33 | FromDiscord | <Elegantbeef> I just did |
05:33:37 | FromDiscord | <Elegantbeef> So uhh take that |
05:33:38 | FromDiscord | <Prestige> hmm |
05:34:12 | FromDiscord | <Prestige> I mean like, we should be able to do simple things like `type Foo = 3 | 8` imo |
05:34:25 | FromDiscord | <Prestige> Because you could check that at compile time, right |
05:34:35 | FromDiscord | <Elegantbeef> that doesnt make sense to me |
05:35:03 | FromDiscord | <Prestige> It would just mean any type of `Foo` would have to be 3 or 8 |
05:35:04 | FromDiscord | <Elegantbeef> I mean it's practically what i did above i guess |
05:35:14 | FromDiscord | <Prestige> Yeah just more uh.. involved |
05:35:22 | FromDiscord | <Elegantbeef> Eh we can resolve that |
05:35:42 | FromDiscord | <huantian> Just make a better range type that can combine multiple ranges ez clap |
05:36:09 | FromDiscord | <Prestige> Maybe I'm just spoiled by typescript |
05:36:56 | FromDiscord | <Elegantbeef> That's actually probably a better method of what i'm doing here↵(@huantian) |
05:37:07 | FromDiscord | <Prestige> We _should_ be able to have this, but god knows how much work it'd be to add to the compiler |
05:38:29 | FromDiscord | <Prestige> Maybe I'll write up another RFC for people to shoot down |
05:38:42 | FromDiscord | <Elegantbeef> People shot down your RFCs? |
05:39:00 | FromDiscord | <Prestige> Mostly the MI one, lol |
05:39:25 | FromDiscord | <Prestige> I also proposed changes to Tables which seemed well received but nothing became of it |
05:39:59 | FromDiscord | <Prestige> https://github.com/nim-lang/Nim/issues/18250 |
05:41:15 | FromDiscord | <Prestige> https://github.com/nim-lang/Nim/pull/18835 this is interesting... |
05:42:06 | FromDiscord | <huantian> Hmm does left..left | up..up not work lol |
05:42:24 | FromDiscord | <Elegantbeef> It could huan |
05:43:17 | FromDiscord | <Prestige> Interesting idea |
05:44:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XyX |
05:45:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/CxU |
05:46:07 | FromDiscord | <Verdure> I have found a particularly good airdrop program. There is no raffle and you don't have to pay to get it. ONLY ONE THOUSAND NFTS,FIRST-COME, FIRST-SERVED!!! For more details please see https://twitter.com/MetaNotey/status/1514800247339646976?s=20&t=QALG_O1tBe7v7D8KbFAHag |
05:46:10 | FromDiscord | <Prestige> Would be nice if you could just do `let a: FiveEight = 5` |
05:46:33 | FromDiscord | <Prestige> Can someone ban @Verdure |
05:47:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XyY |
05:47:12 | FromDiscord | <Elegantbeef> dont let that guy that doesnt get banter to see that joke |
05:47:14 | FromDiscord | <Prestige> Neat |
05:47:35 | FromDiscord | <Prestige> No more chucklehead? |
05:47:51 | FromDiscord | <Elegantbeef> You cannot do it generically but for specific generics you can |
05:48:47 | FromDiscord | <Rika> In reply to @Verdure "I have found a": <@&371760044473319454> |
05:48:56 | FromDiscord | <Prestige> now I just need to write up an RFC so we could simplify this down to `type FiveEight = 5 | 8` |
05:49:06 | FromDiscord | <Elegantbeef> Ugh |
05:49:41 | FromDiscord | <Elegantbeef> That adds so much to the compiler that it doesnt really need 😄 |
05:50:13 | FromDiscord | <huantian> Maybe you can abuse concepts for this 😛 |
05:50:38 | FromDiscord | <Elegantbeef> What's more needed is the abillity to instantiate `Checked[T; valid: static openarray[T]] = distinct T` |
05:50:59 | FromDiscord | <huantian> Hmm |
05:51:27 | FromDiscord | <Elegantbeef> Like if you can instantiate that you can just make a macro that handles lets you do `checkedType(5, 8)` no need for compiler ssupport |
05:51:31 | FromDiscord | <Prestige> That'd be a good step but would still be somewhat complicated as an end user, moreso that just defining type like I was showing (with literals) |
05:51:48 | FromDiscord | <Prestige> hm true |
05:51:53 | FromDiscord | <Elegantbeef> Except the issue there prestige is you can use literals as a type parameter |
05:52:06 | FromDiscord | <Elegantbeef> `var a: seq[100]` is valid |
05:52:24 | FromDiscord | <Elegantbeef> Maybe not with seq |
05:52:54 | FromDiscord | <Elegantbeef> Ok how the hell did it work huan i showed it to you before |
05:53:51 | FromDiscord | <Elegantbeef> Ah nevermind i goofed it |
05:53:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XyZ |
05:55:47 | FromDiscord | <Elegantbeef> Actually we can use macro magic to emit this all |
05:56:21 | FromDiscord | <Elegantbeef> So we can do `checkedVal(5, 8)` then check if there is a `CheckedVal` in the collection that has the value |
06:00:40 | FromDiscord | <huantian> Range types are implemented in the compiler right |
06:00:57 | FromDiscord | <Elegantbeef> Yes |
06:01:29 | FromDiscord | <huantian> Makes sense |
06:02:23 | FromDiscord | <huantian> It’s kind of both a compile time and runtime type |
06:13:15 | FromDiscord | <j-james> What are view types? |
06:13:35 | FromDiscord | <Elegantbeef> Types that enable safely borrowing memory |
06:13:35 | FromDiscord | <j-james> I found https://nim-lang.org/docs/manual_experimental.html#view-types but I don't fully understand `lent T` or what view types are used for |
06:14:23 | FromDiscord | <Elegantbeef> They're used for reducing memory consumption and increasing performance |
06:15:01 | FromDiscord | <j-james> So like a reference in Rust? |
06:15:15 | FromDiscord | <Elegantbeef> Yes |
06:16:15 | FromDiscord | <j-james> interesting |
06:17:02 | FromDiscord | <Rika> Move semantics that aren’t completely opaque to the programmer pretty much |
06:17:48 | FromDiscord | <j-james> they're pretty opaque to me while i'm trying to wrap my head around them haha |
06:18:29 | FromDiscord | <Elegantbeef> @Prestige\: hotshot part deux https://play.nim-lang.org/#ix=3Xz2 |
06:19:03 | FromDiscord | <Elegantbeef> Like it's not overly dramatic to add code for it, just need to use your noggin and work against the compiler's wishes 😄 |
06:19:14 | FromDiscord | <Prestige> Hmm |
06:20:11 | FromDiscord | <Prestige> With a converter that works quite well |
06:20:36 | FromDiscord | <j-james> The docs say a view type is one of `lent T` or `openArray[T]`: are those equivalent to being passed by value and passed by reference? |
06:21:06 | FromDiscord | <Elegantbeef> View types reuse memory so they're always passed by reference |
06:21:21 | FromDiscord | <Elegantbeef> It's not equivalent to it though |
06:21:38 | FromDiscord | <j-james> oh, is it just that anything is either `T` or `openArray[T]` |
06:21:56 | FromDiscord | <Elegantbeef> `lent T` is saying "Hey we're borrowing this variable immutably" |
06:22:10 | FromDiscord | <Elegantbeef> `openArray[T]` is also technically a borrow |
06:23:52 | FromDiscord | <Prestige> Now if we can https://play.nim-lang.org/#ix=3Xz3 |
06:25:29 | FromDiscord | <Elegantbeef> Though it's presently implemented in a way that you cannot have it outlive the source |
06:25:50 | FromDiscord | <Elegantbeef> The big thing that view types give you is the abillity to statically know your memory is always safely owned, so you can hold onto a `var T` from a getter |
06:25:57 | FromDiscord | <Elegantbeef> With view types the above can set the `myType`'s `a` to `100` without it we copy `a.myVal` and mutate it |
06:25:57 | FromDiscord | <Elegantbeef> though i think it'd be `var a : var int = myType.getVal` |
06:26:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/uRO |
06:28:05 | FromDiscord | <Elegantbeef> Would have to steal code fro m unions i think |
06:29:17 | FromDiscord | <Elegantbeef> I'm dumb |
06:29:25 | FromDiscord | <Elegantbeef> i used `getType` again |
06:29:38 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Xz5 |
06:29:40 | FromDiscord | <Elegantbeef> That works |
06:31:03 | FromDiscord | <j-james> hmm i'm having some trouble following the example |
06:31:05 | FromDiscord | <j-james> what does `: var int` indicate? |
06:31:18 | FromDiscord | <Elegantbeef> You want a view type instead of a copy |
06:31:47 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Xz7 fixed even more |
06:32:47 | FromDiscord | <Elegantbeef> Downside is prestige `[Right, Left]` doesnt match |
06:32:58 | FromDiscord | <Elegantbeef> But if you use type aliases you should be fine |
06:33:24 | FromDiscord | <Prestige> Thanks :) |
06:33:50 | FromDiscord | <Elegantbeef> No problem |
06:35:01 | FromDiscord | <j-james> what happens to `a` when `myType` dies in the example? |
06:35:09 | FromDiscord | <j-james> that's enforced by the compiler to never happen? |
06:35:18 | FromDiscord | <Elegantbeef> It's ensured `a` cannot outlive `myType` |
06:35:32 | FromDiscord | <Elegantbeef> That's the big part of safe view types they have a borrow checker |
06:36:03 | FromDiscord | <Elegantbeef> Prestige you know you arent doing the check right? |
06:36:09 | * | PMunch_ is now known as PMunch |
06:36:24 | FromDiscord | <j-james> interesting, that makes sense |
06:36:32 | FromDiscord | <j-james> thanks for the explanation 😄 |
06:36:46 | FromDiscord | <Elegantbeef> Need to do `assert d in Horizontal.T` or similar there |
06:36:54 | FromDiscord | <Elegantbeef> Yes you can rename the generic parameter if you wish |
06:51:51 | * | jjido joined #nim |
06:53:10 | * | duuude quit (Ping timeout: 240 seconds) |
07:12:25 | FromDiscord | <j-james> holy smokes concepts look incredible |
07:12:31 | FromDiscord | <j-james> how did i not know about these |
07:12:35 | FromDiscord | <Elegantbeef> They are |
07:12:39 | FromDiscord | <impbox [ftsf]> hmm `echo not 1` -> `-2` i'd expect `0`. are my expectations off or is nim doing something weird? |
07:12:59 | PMunch | impbox_[ftsf], why would you expect 0? |
07:13:31 | FromDiscord | <Elegantbeef> All bits but the first are turn on |
07:13:32 | FromDiscord | <Elegantbeef> the first is off |
07:13:38 | FromDiscord | <impbox [ftsf]> and `echo not 0` -> `-1`, i'd expect `1` |
07:13:40 | PMunch | 1 is 0b00000001 not 1 is 0b11111110, if you know your two's complement rule of negative binary numbers that's 2 |
07:14:14 | FromDiscord | <impbox [ftsf]> hmm ok! i'm just silly then, thanks |
07:14:22 | FromDiscord | <Rika> “Not” is bit wise not |
07:14:49 | FromDiscord | <Rika> It isn’t Boolean not; Boolean not naturally only happens when the type is Boolean |
07:15:01 | FromDiscord | <impbox [ftsf]> gotcha |
07:15:13 | PMunch | Yeah, not true returns false, and not false returns true |
07:15:18 | FromDiscord | <Rika> 👌 |
07:15:39 | FromDiscord | <impbox [ftsf]> i have an int holding either a 0 or 1 value, should probably be a bool |
07:15:49 | FromDiscord | <Rika> It isn’t |
07:16:02 | FromDiscord | <Rika> That assumption isn’t applied |
07:16:11 | FromDiscord | <impbox [ftsf]> i mean, i should make it a bool instead of an int |
07:16:20 | FromDiscord | <Rika> Oh okay |
07:16:24 | FromDiscord | <Rika> I misread |
07:16:35 | FromDiscord | <impbox [ftsf]> though I want it to be a 1 bit integer =p |
07:17:10 | FromDiscord | <Rika> Usually it isn’t time efficient |
07:17:16 | FromDiscord | <Rika> In such case, I mean |
07:17:24 | FromDiscord | <Rika> Space efficient but not time efficient |
07:17:45 | FromDiscord | <Rika> Even worse if you’re storing a Boolean in a type with other fields |
07:17:55 | FromDiscord | <Rika> Then you have to add padding anyway |
07:37:37 | FromDiscord | <jmgomez> Hey guys, arent static var supported in type pragma macros? |
07:38:03 | FromDiscord | <Rika> What’s the issue exactly? |
07:38:03 | FromDiscord | <Elegantbeef> Code example? |
07:38:19 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Xzi |
07:38:28 | FromDiscord | <Elegantbeef> Doesnt make sense to be static |
07:39:09 | FromDiscord | <Elegantbeef> Actually nevermind thought that was a pragma pragma |
07:39:28 | * | Arrrrrrr joined #nim |
07:40:33 | FromDiscord | <jmgomez> so arent they supported or is there soemthing wrong in the code? |
07:40:51 | FromDiscord | <Elegantbeef> Nah values to pragma macros arent supported it seems |
07:41:00 | FromDiscord | <Elegantbeef> Atleast typedesc macros |
07:41:20 | FromDiscord | <Rika> Weird exception |
07:41:26 | FromDiscord | <Rika> Since they work with function pragmas |
07:41:35 | FromDiscord | <Elegantbeef> They're specially handled and poorly at that |
07:41:39 | FromDiscord | <jmgomez> okay.. yes, that why I wasnt sure |
07:41:41 | FromDiscord | <Elegantbeef> Wait |
07:41:45 | FromDiscord | <Elegantbeef> you're doing `typed` |
07:41:46 | FromDiscord | <Rika> Fix it then beef smh |
07:41:54 | FromDiscord | <Elegantbeef> typdef macros do not work with `typed` |
07:42:00 | FromDiscord | <Elegantbeef> I tried rika, i'm not smart enough |
07:42:12 | FromDiscord | <jmgomez> ohh that make it compile |
07:42:16 | FromDiscord | <jmgomez> didnt know that |
07:42:17 | FromDiscord | <mratsim> use `macro(pathToGenFile: static string, body: utyped): untyped` |
07:42:31 | FromDiscord | <Elegantbeef> Too late mratsim i realized it was typed 😛 |
07:42:41 | FromDiscord | <mratsim> (edit) "utyped):" => "untyped):" |
07:42:45 | FromDiscord | <jmgomez> thanks guys! |
07:43:11 | FromDiscord | <jmgomez> one last thing, can you call a macro from another macro? like to do a wrapper of that one where the parameter is set? |
07:43:37 | FromDiscord | <mratsim> with `quote do` or make the common part a proc on NimNode |
07:43:41 | FromDiscord | <Rika> Just use a proc |
07:43:41 | FromDiscord | <Rika> Yeah |
07:43:48 | FromDiscord | <Rika> A proc that handles NimNodes |
07:44:06 | FromDiscord | <jmgomez> problem with proc is that I still what to use the other macro but just less often |
07:44:19 | FromDiscord | <mratsim> both can call the proc |
07:44:20 | FromDiscord | <jmgomez> and it will require one extra |
07:44:24 | PMunch | Then you probably want to return something that will call your macro with a static parameter |
07:44:43 | FromDiscord | <jmgomez> I guess that's cleaner approach |
07:44:52 | PMunch | You can have optional parameters to procedures as well |
07:45:20 | FromDiscord | <jmgomez> 👍 |
07:45:27 | PMunch | Hmm, I found this video https://www.youtube.com/watch?v=ExwqNreocpg, and now I'm trying to create a tiny Nim program that uses Xlib |
07:45:43 | PMunch | Currently I have it down to 14472, but I can't seem to get it further |
07:45:58 | PMunch | Following of course this guide: https://hookrace.net/blog/nim-binary-size/ |
07:46:27 | PMunch | but it quickly gets irrelevant because I need some of the stuff they remove to actually call X11 libraries.. |
07:46:39 | FromDiscord | <Elegantbeef> You are using arc right? |
07:46:43 | PMunch | Yes |
07:47:04 | FromDiscord | <Elegantbeef> LTO on? `--opt:size`? |
07:47:20 | PMunch | This is what I have so far: http://ix.io/3Xzl |
07:48:32 | FromDiscord | <Elegantbeef> Can try the other exception modes, dont recall if they work with arc though |
07:51:26 | PMunch | I tried exceptions:goto, but that didn't give me anything |
07:51:47 | FromDiscord | <Rika> That’s default on ARC no? |
07:51:53 | FromDiscord | <Elegantbeef> arc uses it by default yes |
07:53:35 | PMunch | Nope, none of the others where any better |
07:57:55 | FromDiscord | <Elegantbeef> Dont recall does danger turn off all checks? |
07:58:18 | PMunch | Yeah it should disable just about everything |
07:58:21 | FromDiscord | <Elegantbeef> actually gets off his ass to read the nimc docs, yes |
07:59:15 | PMunch | Hmm, seems like a C program doing the same thing gets to about the same size.. |
07:59:52 | FromDiscord | <Elegantbeef> Well fuck |
08:00:38 | FromDiscord | <Rika> Don’t think there’s much you can do about that |
08:00:49 | FromDiscord | <Rika> Just use a jumbo sized QR xd |
08:00:54 | FromDiscord | <Elegantbeef> Use a different C compiler perhaps |
08:01:08 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Xzv |
08:01:47 | FromDiscord | <Rika> It doesn’t need to be a static string in the procedure |
08:01:53 | FromDiscord | <Elegantbeef> it needs to be `string` as an argument |
08:01:55 | FromDiscord | <Elegantbeef> `static` is only for dispatch it's then lowered to `string` inside |
08:02:09 | FromDiscord | <jmgomez> ohh okay |
08:02:30 | PMunch | @Rika, the biggest QR codes can only store about 2.5kb.. |
08:02:50 | PMunch | I'm currently at about 14k |
08:02:51 | FromDiscord | <Elegantbeef> Time to make a bigger standard |
08:03:07 | FromDiscord | <enthus1ast> There are several standards already |
08:03:33 | FromDiscord | <Elegantbeef> Do they statically link the code? |
08:03:54 | FromDiscord | <Elegantbeef> I notice you arent statically linking anything which means you're probably using dynlib loading for x11 right? |
08:06:21 | FromDiscord | <Rika> Static linking would just make it larger? |
08:06:45 | FromDiscord | <Elegantbeef> The code to interact with the dynamic library might be smaller than the used parts of the static library |
08:06:47 | FromDiscord | <Elegantbeef> In small examples it's very likely |
08:06:55 | FromDiscord | <Elegantbeef> might be larger than\ |
08:07:57 | PMunch | Yeah I thought about that |
08:08:23 | FromDiscord | <Rika> A lot of these standards max at around 3 kilobytes |
08:08:37 | FromDiscord | <enthus1ast> i read a article about the same issue but with windows pe |
08:08:40 | FromDiscord | <Rika> I highly doubt your dynamic loading code is 11 kilobytes |
08:09:21 | FromDiscord | <Rika> There’s a lot more trimming down to do |
08:28:28 | PMunch | Welp, static linking with X11 made the binary go from 18744 to 964240 :P |
08:28:34 | PMunch | So no big surprise there |
08:30:37 | FromDiscord | <Elegantbeef> We're getting close |
08:30:49 | PMunch | Close to what? :P |
08:30:58 | FromDiscord | <Elegantbeef> My new standard's limit |
08:32:38 | PMunch | Hmm, a program which just does `echo "Hello world"` takes 14568 bytes.. |
08:38:44 | * | duuude joined #nim |
08:42:04 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:51:45 | FromDiscord | <jmgomez> hey guys, one question. If a type A uses another type B (or inherit from it) can you access the other type B and inspect it within a macro? |
08:52:16 | FromDiscord | <Elegantbeef> You can use macros to go up the type tree yes |
08:52:49 | FromDiscord | <Elegantbeef> You need to use `getTypeImpl` or the other `getType` proccedures on the symbol |
08:52:52 | FromDiscord | <Elegantbeef> If it's not a symbol you're SOL |
08:54:49 | PMunch | Well, not entirely |
08:55:41 | FromDiscord | <Elegantbeef> I more mean in reference to the fact they had a macro on a typedef 😄 |
08:56:23 | FromDiscord | <Elegantbeef> @jmgomez\: you may want to take a peak at https://github.com/beef331/oopsie it atleast shows the AST traversals you can copy |
08:57:22 | FromDiscord | <jmgomez> cool, thanks!! |
09:00:35 | * | firq quit (Quit: WeeChat 3.5) |
09:10:40 | * | koltrast joined #nim |
09:22:02 | FromDiscord | <Zoom> That's some wtf moment (#6529, #7432, #18325).↵Ar@q said in 2017\:> Maybe they should, not sure if that's safe to do in general though. Type systems are tricky. But since you live with the generic instantiations already, use a concept instead?↵And in 2021\:> We need to write an RFC and outline why nothing bad can happen when the "or" types become less picky.↵Do we have an RFC? |
09:22:21 | FromDiscord | <Elegantbeef> We do not |
09:22:40 | FromDiscord | <Elegantbeef> You know you can just write his name he's on discrod he only responds to pings from here |
09:23:39 | FromDiscord | <Elegantbeef> I did try to fix it but no avail |
09:24:49 | * | Zectbumo quit (Remote host closed the connection) |
09:26:12 | FromDiscord | <Zoom> I don't know how pings on Discord work and don't care much.↵We need to get Sixte to write that RFC so no one could possibly argue. |
09:26:28 | * | dtomato6 joined #nim |
09:26:39 | * | dtomato quit (Ping timeout: 240 seconds) |
09:26:39 | * | dtomato6 is now known as dtomato |
09:26:41 | FromDiscord | <Elegantbeef> You mean so no one would care to read it to argue |
09:27:03 | FromDiscord | <Zoom> Does it matter? |
09:27:08 | FromDiscord | <Elegantbeef> Sixte speaks generally like he's writing a white paper with no regard for actual messages parsed 😄 |
09:29:54 | FromDiscord | <Elegantbeef> But yes openarray have many sharp edges that should be resolved 😄 |
09:31:47 | FromDiscord | <Elegantbeef> I could document all the issues with them presently, if you want |
09:32:52 | FromDiscord | <Zoom> Who's he by the way? Wasn't it insinuated once he's that Chinese CS guy? |
09:32:52 | FromDiscord | <Zoom> Yin Wang |
09:32:58 | FromDiscord | <Elegantbeef> No clue |
09:33:13 | FromDiscord | <Elegantbeef> I just know that they come of very academic and dont understand 99% of what they say |
09:33:33 | FromDiscord | <Zoom> https://www.yinwang.org/resources/gucs-sample-chapter1.pdf |
09:34:37 | FromDiscord | <Zoom> This reads offensive \:D |
09:34:43 | FromDiscord | <Elegantbeef> and i dont\ |
09:34:45 | FromDiscord | <xflywind> In reply to @Zoom "Who's he by the": Why do think it is him? |
09:35:37 | FromDiscord | <Zoom> Someone just said it or asked him. I just know nothing about him/her |
09:36:14 | FromDiscord | <Elegantbeef> So Zoom just for some of the fun in bite size form `proc doThing(a: openarray[int or char])` doesnt work without explicit `toOpenArray`, but `proc doThing[T: int or char](a: openarray[T]` does |
09:37:59 | FromDiscord | <Zoom> @xflywind\: I remember I tried to read some of yinwang.org artiles through deepl and to be frank it felt a bit more engaging than Sixte's posts \:-/ |
09:38:39 | FromDiscord | <Elegantbeef> Open array much like iterable does not compose |
09:38:42 | FromDiscord | <Elegantbeef> Which makes it sad |
09:39:15 | FromDiscord | <Elegantbeef> `proc doThing(a: openarray[int] or int)` doesnt accept both yet again 😄 |
09:39:47 | FromDiscord | <Elegantbeef> `template doThing(a: iterable[int] or openarray[int])` doesnt work either 😄 |
09:39:55 | FromDiscord | <xflywind> In reply to @Zoom "Someone just said it": I don't know him much, though he is infamous on my country's internet. |
09:43:58 | * | Arrrrrrr quit (Quit: Arrrrrrr) |
09:46:02 | FromDiscord | <Zoom> Care to elaborate in #offtopic? I like me some internet lore.↵(@xflywind) |
09:49:02 | FromDiscord | <xflywind> sure |
10:01:22 | FromDiscord | <Zoom> This is all very frustrating and a serious obstacle in cleaning up stdlib \:( |
10:29:10 | FromDiscord | <Zoom> Is a `defined(nimscript)` a subset of `defined(nimvm)`? |
10:32:04 | FromDiscord | <Zoom> The limitations on when nimvm statements lead to lots of duplicate code in branches for js/nimdoc... |
10:38:44 | FromDiscord | <ambient> using Arraymancer, I'm little confused how there's: float, float32, system.float |
10:44:50 | FromDiscord | <ambient> ideally there would be only 1 32-bit float and I wouldn't have to worry about it |
10:53:32 | PMunch | system.float is the same as float |
10:54:32 | PMunch | And float is the same as float64 |
10:54:51 | PMunch | There is only 1 32-bit float, and that is float32 |
10:55:00 | PMunch | (on 64-bit systems at least) |
10:55:04 | PMunch | @ambient ^ |
10:55:53 | FromDiscord | <ambient> ok gotcha |
10:56:36 | PMunch | Great.. Another Python project which doesn't work because of mismatched dependencies.. |
10:56:42 | FromDiscord | <ambient> (I mean: got you) according to dict the meaning doesn't seem to be the same |
10:56:57 | PMunch | According to dict? |
10:57:07 | FromDiscord | <ambient> https://www.merriam-webster.com/dictionary/gotcha |
10:57:30 | * | jmdaemon quit (Ping timeout: 276 seconds) |
10:58:06 | * | duuude quit (Ping timeout: 252 seconds) |
10:58:22 | PMunch | @ambient, that is gotcha the noun. It comes from "I got you!" |
10:58:48 | PMunch | Not sure how widespread the usage of gotcha as a verb is, but I understood what you meant anyways |
10:59:39 | PMunch | According to the three comments on that page this is at least fairly common |
11:00:28 | PMunch | The Cambridge dictionary has both definitions: https://dictionary.cambridge.org/dictionary/english/gotcha |
11:06:34 | * | jjido joined #nim |
11:21:07 | * | ttkap quit (Ping timeout: 240 seconds) |
11:22:13 | NimEventer | New Nimble package! blarg - A basic little argument parser, see https://github.com/squattingmonk/blarg |
11:42:17 | * | ttkap joined #nim |
11:43:11 | FromDiscord | <ambient> sent a code paste, see https://paste.rs/ti0 |
11:51:30 | * | Gustavo6046 joined #nim |
11:52:25 | * | wallabra quit (Ping timeout: 248 seconds) |
11:52:28 | * | Gustavo6046 is now known as wallabra |
11:57:23 | PMunch | Hmm, so apparently when dynamically linking the ELF format will create data pages for the symbols it expects to load etc. So the ELF binary is just full of nulls that get mmapped into memory before being filled in. |
12:15:54 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=3XAm |
12:16:47 | FromDiscord | <mratsim> and there is one that is optimized here: https://github.com/SciNim/impulse/blob/master/impulse/fft/pocketfft.nim#L300-L339= |
12:16:58 | FromDiscord | <mratsim> (edit) "https://github.com/SciNim/impulse/blob/master/impulse/fft/pocketfft.nim#L300-L339=" => "https://github.com/SciNim/impulse/blob/master/impulse/fft/pocketfft.nim#L300-L339, it's framework agnostic" |
12:18:11 | * | duuude joined #nim |
12:19:38 | FromDiscord | <ambient> I wish I knew about scim a week ago 🥲 |
12:22:18 | NimEventer | New Nimble package! limiter - A simple to use HTTP rate limiting library to limit any action during a specific period of time., see https://github.com/supranim/limiter |
12:24:13 | FromDiscord | <Stuffe> which variable type declaration matches this argument type `openarray[tuple[key, value: string]]`? |
12:24:33 | FromDiscord | <Stuffe> I tried `seq` but it didn't work https://media.discordapp.net/attachments/371759389889003532/974285953919230032/Screen_Shot_2022-05-12_at_19.24.29.png |
12:25:20 | FromDiscord | <Yardanico> In reply to @Stuffe "which variable type declaration": you can't declare this as a type directly, but openArray accepts seqs and arrays |
12:25:30 | FromDiscord | <Stuffe> i know |
12:25:48 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XAq |
12:25:56 | FromDiscord | <Stuffe> i want to declare an empty one |
12:26:09 | FromDiscord | <Stuffe> is there a way to do that? |
12:26:18 | FromDiscord | <Yardanico> specifically for httpclient or something else? |
12:26:23 | FromDiscord | <Stuffe> actually I want the type for a struct |
12:26:38 | FromDiscord | <Yardanico> httpclient just uses https://nim-lang.org/docs/httpcore.html#HttpHeaders |
12:26:49 | FromDiscord | <Stuffe> i am using jester though |
12:27:08 | FromDiscord | <Yardanico> it is using HttpHeaders as well |
12:27:29 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/974286694423609354/unknown.png |
12:27:37 | FromDiscord | <Stuffe> ok well that doesn't help |
12:27:49 | FromDiscord | <Yardanico> but generally you can probably store the values as `seq[tuple[key, val: string]]` and pass them, but not really efficient |
12:28:06 | FromDiscord | <Yardanico> isn't it better to create some base headers once without having to create them each time |
12:28:19 | FromDiscord | <Yardanico> i just don't know your usecase |
12:28:21 | FromDiscord | <Stuffe> i want to put it in a struct though |
12:28:28 | FromDiscord | <Yardanico> In reply to @Stuffe "i want to put": yes, but why you can't put headers in a struct? |
12:28:32 | FromDiscord | <Yardanico> `HttpHeaders` i mean |
12:28:44 | FromDiscord | <Stuffe> the struct definition needs a type |
12:28:47 | FromDiscord | <Yardanico> sorry for asking so much, but i'm just confused |
12:28:51 | FromDiscord | <Yardanico> In reply to @Stuffe "the struct definition needs": that is a type |
12:28:53 | FromDiscord | <Yardanico> from httpcore |
12:29:01 | FromDiscord | <Stuffe> ok let me try |
12:29:15 | FromDiscord | <Yardanico> and jester even exports httpcore so you already have access to `HttpHeaders` if you use jester |
12:31:57 | FromDiscord | <Stuffe> how do I assign values to this data type? |
12:32:01 | * | rockcavera joined #nim |
12:32:02 | * | rockcavera quit (Changing host) |
12:32:02 | * | rockcavera joined #nim |
12:32:05 | FromDiscord | <Stuffe> I tried req.headers["Content-Disposition"] = @["attachment"] |
12:32:11 | FromDiscord | <Stuffe> (edit) "req.headers["Content-Disposition"]" => "`req.headers ["Content-Disposition"]" | "@["attachment"]" => "@["attachment"]`" |
12:32:30 | FromDiscord | <Yardanico> yes that should work |
12:32:35 | FromDiscord | <Yardanico> https://nim-lang.org/docs/httpcore.html#%5B%5D%3D%2CHttpHeaders%2Cstring%2Cseq%5Bstring%5D |
12:32:51 | FromDiscord | <Stuffe> well it gives me an error |
12:32:58 | FromDiscord | <Yardanico> what error? |
12:33:20 | FromDiscord | <Stuffe> ah ok after importing httpcore it worked |
12:33:33 | FromDiscord | <Stuffe> thanks |
12:36:55 | FromDiscord | <Stuffe> actually it doesn't work in this case |
12:37:04 | FromDiscord | <Stuffe> https://media.discordapp.net/attachments/371759389889003532/974289104692985866/Screen_Shot_2022-05-12_at_19.37.00.png |
12:39:17 | FromDiscord | <Stuffe> it makes me a bit of a sad panda that argument types descriptions don't match with identifier declaration type descriptions |
12:39:33 | FromDiscord | <Stuffe> would make things easier for a lot of people i am sure |
12:39:36 | FromDiscord | <Yardanico> In reply to @Stuffe "": oh well, that's why I asked the usecase :) |
12:39:44 | FromDiscord | <Yardanico> In reply to @Stuffe "would make things easier": structural equivalence would be quite bad for normal tuples IMO |
12:39:47 | FromDiscord | <Yardanico> nim already has it for tuples |
12:39:54 | FromDiscord | <Zoom> Can you pass more than one code block to a template? I need a macro If I want to access them by names, right? |
12:40:00 | FromDiscord | <Yardanico> so yeah, in this case if you need it for `resp`, just store it as a seq[tuple[key, val: string]] |
12:40:17 | FromDiscord | <Stuffe> but thats the whole issue the whole time |
12:40:21 | FromDiscord | <Stuffe> that I need the type for that |
12:41:03 | FromDiscord | <Stuffe> I want to put this in a struct so I need the exact type |
12:41:26 | FromDiscord | <Stuffe> what is the type that works was my question the whole time |
12:41:28 | FromDiscord | <demotomohiro> @Zoom https://internet-of-tomohiro.netlify.app/nim/faq.en.html#template-how-to-pass-multiple-code-blocks-to-a-templateqmark |
12:41:38 | FromDiscord | <Yardanico> In reply to @Stuffe "I want to put": again |
12:41:40 | FromDiscord | <Yardanico> `seq[tuple[key, val: string]]` |
12:41:42 | FromDiscord | <Yardanico> is the exact type |
12:41:46 | FromDiscord | <Yardanico> :D |
12:42:00 | FromDiscord | <Yardanico> sequence of tuples consisting of two fields - key and val, both being strings |
12:42:13 | FromDiscord | <Yardanico> `openArray` accepts both arrays and sequences of the underlying type |
12:42:18 | FromDiscord | <Stuffe> In reply to @Stuffe "": but I tried that and it doesn't work |
12:42:24 | FromDiscord | <Stuffe> i tried that before asking here |
12:42:32 | FromDiscord | <Stuffe> i understand how`openArray works |
12:42:38 | FromDiscord | <Stuffe> (edit) "how`openArray" => "how openArray" |
12:43:14 | FromDiscord | <Zoom> Thanks, the trouble with that is that branches are unnamed on the call site \:(↵(@demotomohiro) |
12:43:26 | FromDiscord | <Stuffe> sorry my screenshot didn't show the full error message |
12:43:48 | FromDiscord | <ambient> @mratsim looks like pocketFFT is only 2x fast as my pure Nim implementation, and only 1.5x fast if set to imprecise https://gist.github.com/amb/4f70bcbea897024452d683b40d18be1f |
12:46:20 | FromDiscord | <Yardanico> @Stuffe maybe you didn't check the proc signature for that `resp` overload? |
12:46:23 | FromDiscord | <Yardanico> it's supposed to be used like this: |
12:46:29 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XAu |
12:46:46 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/974291544825806848/unknown.png |
12:46:47 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/974291548659404890/unknown.png |
12:47:39 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/974291766419271710/unknown.png |
12:47:46 | * | noeontheend joined #nim |
12:48:15 | FromDiscord | <Yardanico> or if you want to reorder it or specify argument names: `resp(content = "body", code = Http200, headers = x.headers)` |
12:49:40 | FromDiscord | <Yardanico> jester doesn't have any other `resp` overloads with `headers` so you must always provide a response code for this one |
12:51:57 | NimEventer | New thread by Mildred: Interoperable stream type, see https://forum.nim-lang.org/t/9153 |
12:52:08 | * | noeontheend quit (Ping timeout: 260 seconds) |
12:55:00 | FromDiscord | <mratsim> sent a long message, see http://ix.io/3XAx |
12:58:19 | NimEventer | New Nimble package! supranim - A fast Hyper Server & Web Framework, see https://github.com/supranim/supranim |
12:58:54 | FromDiscord | <ambient> sent a code paste, see https://play.nim-lang.org/#ix=3XAy |
12:59:19 | FromDiscord | <mratsim> Though I was too busy to continue it, these day I'm doing BigInt FFT (https://github.com/mratsim/constantine/blob/master/research/kzg_poly_commit/fft_fr.nim) and Elliptic Curve FFT (https://github.com/mratsim/constantine/blob/master/research/kzg_poly_commit/fft_g1.nim) |
13:15:27 | * | duuude quit (Ping timeout: 260 seconds) |
13:32:16 | * | duuude joined #nim |
13:41:39 | * | rockcavera quit (Remote host closed the connection) |
13:44:58 | thadeudepaula | quit |
13:45:04 | * | thadeudepaula quit (Quit: WeeChat 3.4) |
13:54:51 | FromDiscord | <Yardanico> enter |
13:58:04 | PMunch | join |
14:00:39 | * | PMunch quit (Quit: Leaving) |
14:03:14 | * | rejt8 joined #nim |
14:04:50 | * | rejt8 quit (Quit: WeeChat 3.4) |
14:07:05 | * | rejt8 joined #nim |
14:18:42 | FromDiscord | <mratsim> select |
14:20:33 | FromDiscord | <Zoom> DROP TABLE |
14:24:34 | * | rejt8 is now known as voidg8 |
14:24:49 | * | voidg8 quit (Quit: WeeChat 3.4) |
14:27:11 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
14:30:08 | * | hellstabber joined #nim |
14:31:01 | * | vicfred quit (Quit: Leaving) |
14:38:42 | FromDiscord | <Alea> bobby tables is such a good boy :EmotiPleased: |
14:43:12 | FromDiscord | <tandy> `var lShuffled = l` is this a deep copy for a `seq[int]`? |
14:43:58 | FromDiscord | <Rika> Sequences are copied yes |
14:45:36 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3XAT |
14:45:51 | * | arkurious joined #nim |
14:48:19 | FromDiscord | <Rika> Are tensors deep copied? I am not sure |
14:48:25 | * | hellstabber quit (Quit: Textual IRC Client: www.textualapp.com) |
14:50:11 | FromDiscord | <huantian> Ig it depends on if they’re ref objects somewhere internally? |
14:54:41 | * | hellstabber joined #nim |
14:55:31 | * | hellstabber quit (Client Quit) |
14:55:41 | * | hellstabber joined #nim |
14:58:15 | FromDiscord | <Bubblie> In reply to @Elegantbeef "`../` is not parsed": Hey beef should I possibly try to make a fix for this import issue in a pr? |
15:02:05 | FromDiscord | <Bubblie> I dont think it would be too hard to fix, hopefully |
15:07:45 | FromDiscord | <Bubblie> Where are imports and paths handled in nim? |
15:13:16 | FromDiscord | <tandy> clone is a deep copy i think↵(@Rika) |
15:19:53 | FromDiscord | <mratsim> In reply to @tandy "any clue as to": `lShuffled[i] = l[idx]`↵↵This is suspect since they use the same buffer |
15:20:17 | FromDiscord | <mratsim> `lShuffled = l` |
15:31:49 | FromDiscord | <spoon> anyone with nimlsp working on coc.nvim? |
15:45:00 | FromDiscord | <Prestige> I am @spoon |
15:46:05 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=3XBg |
15:47:04 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix=3XBh |
15:47:19 | FromDiscord | <Prestige> I have nimlsp built locally so I just point to the binary |
15:47:29 | FromDiscord | <Prestige> the verbose isn't actually needed unless you're debugging |
15:48:26 | FromDiscord | <spoon> what's the command to get the output again? |
15:48:29 | FromDiscord | <Prestige> Then I have `autocmd BufNewFile,BufRead .nim, set filetype=nim` in my `init.vim` |
15:48:47 | FromDiscord | <spoon> ah |
15:48:50 | FromDiscord | <Prestige> You mean `CocInfo` ? |
15:48:56 | FromDiscord | <Prestige> (edit) "`CocInfo`" => "`:CocInfo`" |
15:49:24 | FromDiscord | <spoon> there was some command i used that had some error launching the server |
15:49:30 | FromDiscord | <spoon> i'll try modifying my init.vim |
15:50:10 | FromDiscord | <spoon> `[coc.nvim] Server languageserver.nim failed to start: Launching server "languageserver.nim" using command nimlsp failed.` |
15:50:15 | FromDiscord | <spoon> that's the error |
15:50:25 | FromDiscord | <spoon> nimlsp is on my path |
15:50:56 | FromDiscord | <spoon> (also this is on my windows pc if that means anything) |
15:51:20 | FromDiscord | <Prestige> Maybe look at https://github.com/neoclide/coc.nvim/wiki/Debug-language-server |
15:54:15 | FromDiscord | <Prestige> It looks like CI failed for windows builds, 3 days ago. I wonder if that's related. What nimlsp version are you on? |
15:54:59 | FromDiscord | <spoon> `[Error - 10:52:40 AM] spawn nimlsp ENOENT` |
15:55:01 | FromDiscord | <spoon> hm |
15:55:19 | FromDiscord | <spoon> should be on the latest release branch |
15:55:36 | FromDiscord | <Prestige> https://github.com/PMunch/nimlsp/issues/121 |
15:55:41 | FromDiscord | <Prestige> This may be the problem |
15:55:46 | FromDiscord | <spoon> nimlsp was working with kate |
15:56:09 | FromDiscord | <Prestige> oh? Interesting.. |
16:14:21 | FromDiscord | <Prestige> Is there a way for a macro to take a static varargs[typedesc] or something similar? |
16:18:12 | FromDiscord | <tandy> i think you are right, i tried this and it seems to work ` lShuffled, shuffledIndices = toSeq(0..l.shape[0]-1)`↵(@mratsim) |
16:22:33 | NimEventer | New Nimble package! smoothing - Smoothing functions for Regression and Density Estimation, see https://github.com/paulnorrie/smoothing |
16:22:33 | NimEventer | New Nimble package! leopard - Nim wrapper for Leopard-RS: a fast library for Reed-Solomon erasure correction coding, see https://github.com/status-im/nim-leopard |
16:37:34 | FromDiscord | <root> Hello! |
16:37:55 | FromDiscord | <Rika> Hello |
16:38:15 | FromDiscord | <root> This is a really random question, but does nim happen to support python libraries? |
16:38:25 | * | vicfred joined #nim |
16:42:46 | FromDiscord | <Rika> Making or using? |
16:42:50 | FromDiscord | <Rika> I believe not using? |
16:42:57 | FromDiscord | <Rika> “Nimpy” for making |
16:42:58 | FromDiscord | <demotomohiro> https://github.com/yglukhov/nimpy |
16:43:15 | FromDiscord | <Rika> Oh it can use |
16:43:18 | FromDiscord | <Rika> Cool |
16:43:24 | * | slowButPresent joined #nim |
16:45:18 | * | slowButPresent quit (Client Quit) |
16:46:13 | FromDiscord | <demotomohiro> There are Nim libraries to use Nim module from Python:↵https://github.com/Pebaz/nimporter↵https://github.com/treeform/genny |
16:47:02 | FromDiscord | <Yardanico> In reply to @demotomohiro "There are Nim": nimporter isn't really relevant, it's just a wrapper over nimpy to automate building nim extensions |
16:47:31 | FromDiscord | <Yardanico> genny is relevant, yes, but it's more for generating bindings for existing projects |
16:52:50 | FromDiscord | <root> Thank you for the help! |
17:12:12 | * | pch quit (Ping timeout: 240 seconds) |
17:14:39 | * | pch joined #nim |
17:16:27 | * | noeontheend joined #nim |
17:17:34 | * | slowButPresent joined #nim |
17:17:45 | * | slowButPresent quit (Changing host) |
17:17:45 | * | slowButPresent joined #nim |
17:19:26 | * | arkt8 joined #nim |
17:20:51 | arkt8 | buffer |
17:21:03 | * | arkt8 quit (Quit: WeeChat 3.4) |
17:21:49 | FromDiscord | <Yardanico> overflow |
17:22:26 | * | rejt8 joined #nim |
17:22:46 | * | rejt8 left #nim (#nim) |
17:23:39 | * | pro joined #nim |
17:24:23 | * | jjido joined #nim |
17:27:32 | FromDiscord | <ambient> what kind of alignment guarantees should I expect from Tensor[Complex[float]]? can I just cast it to a float64 array with 4 times the length and manipulate it directly or are there some things I should be aware of? also should I manually set the alignment with {.align(32).} if I want to use AVX instructions on Tensors? |
17:28:01 | FromDiscord | <ambient> is the internal memory representation of 1D Tensor[T] the same as seq[T]? |
17:28:36 | FromDiscord | <ambient> 🤯 |
17:31:20 | * | pro quit (Quit: pro) |
17:33:35 | reversem3[m] | trying to create docs for karax using nim doc , now I can use a for loop and create all the docs but is there a tool which will create in index page first ? |
17:34:04 | * | arkt8 joined #nim |
17:34:06 | reversem3[m] | Otherwise I have lots of html pages but no starting point to reference |
17:36:12 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
17:38:01 | * | arkt8 quit (Client Quit) |
17:39:37 | FromDiscord | <geekrelief> How can I find out version of C++ does nim generate with cpp? |
17:39:57 | FromDiscord | <ambient> answering to myself https://scinim.github.io/getting-started/basics/common_datatypes.html seems to indicate that seq and Tensor indeed have the same internal memory representation |
17:41:39 | FromDiscord | <Yardanico> In reply to @ambient "answering to myself https://scinim.github.io/gettin": doesn't look like it - "Under the hood the data is stored as a pointer + length pair for types that can be copied using copyMem (Nim's memcpy). Otherwise it contains a seq[T] for the data." |
17:41:50 | FromDiscord | <Yardanico> seqs have a bit of different layout if we were to talk about actual internal representation |
17:42:10 | FromDiscord | <ambient> I'm mainly talking about 1D Tensor vs seq, multidimensionals are obviously different indexing scheme |
17:42:32 | FromDiscord | <Yardanico> i mean if you just do .addr then it'll work |
17:42:37 | FromDiscord | <Yardanico> but just casting the seq itself won't work |
17:42:46 | FromDiscord | <Yardanico> like `elem[0].addr` I mean |
17:42:52 | FromDiscord | <ambient> I'm not sure I understand the difference |
17:42:54 | FromDiscord | <Yardanico> that will work, but `elem.addr` won't work the way you want |
17:43:00 | FromDiscord | <Yardanico> In reply to @ambient "I'm not sure I": nim seqs have an internal structure |
17:43:08 | FromDiscord | <Yardanico> of len, cap, and pointer to data |
17:43:13 | FromDiscord | <Yardanico> it also differs a bit between refc and arc |
17:43:20 | FromDiscord | <Yardanico> cap = capacity |
17:43:43 | FromDiscord | <ambient> yeah the capacity is not the same as the items most of the time |
17:44:07 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XBD |
17:45:19 | FromDiscord | <Yardanico> and for refc it's a pointer to object of len, cap and data |
17:45:23 | FromDiscord | <root> This language is sick |
17:45:28 | FromDiscord | <Yardanico> you can easily see that if you do `sizeof` with both refc and arc |
17:45:31 | FromDiscord | <root> Why is it not more popular? |
17:45:31 | * | duuude quit (Ping timeout: 252 seconds) |
17:45:48 | FromDiscord | <ambient> nerds like to code, instead of talk |
17:45:57 | FromDiscord | <root> Wym |
17:46:06 | FromDiscord | <ambient> (i have no clue) |
17:46:18 | FromDiscord | <root> Ok |
17:46:28 | FromDiscord | <root> And it compiles to C, c++, and js??? |
17:46:39 | FromDiscord | <root> It should be an industry standard tbh |
17:47:34 | FromDiscord | <demotomohiro> There are C standard and C++ standard. |
17:47:36 | * | duuude joined #nim |
17:47:50 | FromDiscord | <ambient> well from my perspective, the first I heard of Rust, I was frontloaded with all kinds of evangelism talking points. With Nim it's just "It's kind of like Python, but compiles into C" |
17:48:09 | FromDiscord | <root> True |
17:48:35 | FromDiscord | <demotomohiro> This is why Nim generates C code: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#language-design-why-nim-transepile-to-cqmark |
17:49:30 | FromDiscord | <root> Are there any easy libraries for making gui in nim? |
17:49:56 | FromDiscord | <root> I mainly make desktop tools |
17:50:02 | FromDiscord | <ambient> I think there are no easy libraries for making GUI in any language, unless you fire up Godot engine |
17:50:12 | FromDiscord | <root> Ok |
17:50:28 | FromDiscord | <root> How do I specify which Lang I want nim to compile to? |
17:50:36 | FromDiscord | <resumin> sent a long message, see http://ix.io/3XBF |
17:50:53 | FromDiscord | <Yardanico> In reply to @root "How do I specify": `c` actually means both "compile" and "compile to c" at the same time |
17:50:56 | FromDiscord | <federico3> @demotomohiro\: you might want to improve https://github.com/nim-lang/Nim/wiki/Unofficial-FAQ |
17:51:03 | FromDiscord | <Yardanico> so you traditionally can just do `nim cpp` or `nim js` to compile to others |
17:51:14 | FromDiscord | <ambient> https://github.com/marcomq/nimview looks pretty neat, hopefully will have time at some point to look into |
17:51:17 | FromDiscord | <Yardanico> there's also a new way (although I personally don't use it), like `nim c --backend:cpp` |
17:51:38 | FromDiscord | <Yardanico> but yeah, there are a lot of GUI options, webviews, native ones (even fully written in Nim), imgui, tons of bindings |
17:51:54 | FromDiscord | <Yardanico> but there's no 1 "flagship" UI library that everyone will say "yeah, you should use this specifically for Nim" |
17:52:04 | FromDiscord | <Yardanico> all have their own advantages and disadvantages |
17:52:09 | FromDiscord | <root> Ok |
17:53:07 | FromDiscord | <root> How hard is nim/c programs to crack? |
17:53:12 | * | arkt8 joined #nim |
17:53:25 | FromDiscord | <Yardanico> define "crack" |
17:53:29 | FromDiscord | <Yardanico> and "hard" compared to what? |
17:53:31 | FromDiscord | <root> Unpack |
17:53:34 | FromDiscord | <Yardanico> ?? |
17:53:38 | FromDiscord | <ambient> well there's no sprintf unless you absolutely want to have it |
17:53:40 | FromDiscord | <Yardanico> you can't "unpack" them, they're native code |
17:53:41 | FromDiscord | <root> In reply to @Yardanico "and "hard" compared to": Compared to python |
17:53:48 | FromDiscord | <Yardanico> In reply to @root "Compared to python": much more harder |
17:53:59 | FromDiscord | <root> Ok |
17:54:15 | FromDiscord | <Yardanico> because for nim/c/etc you actually have to reverse engineer the binary by disassembling, and for python you can easily turn the bytecode back into the source close to the original |
17:54:28 | FromDiscord | <root> Ok |
17:54:33 | FromDiscord | <root> Thanks for the help |
17:54:39 | FromDiscord | <Yardanico> In reply to @root "Ok": btw, it'd be a bit nicer if you can react to messages with thumbs up or something instead of saying "ok" every time to not fill the chat :) |
17:55:10 | * | rockcavera joined #nim |
17:55:11 | * | rockcavera quit (Changing host) |
17:55:11 | * | rockcavera joined #nim |
17:55:30 | FromDiscord | <ambient> I don't even know how to syntax highlight stuff in Discord |
17:55:43 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix= |
17:56:04 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix=3XBI |
17:56:11 | FromDiscord | <Yardanico> yeah, just markdown code blocks |
17:59:02 | * | arkt8 left #nim (#nim) |
18:03:12 | * | Zectbumo joined #nim |
18:08:50 | * | kenran joined #nim |
18:16:44 | * | slowButPresent quit (Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)) |
18:17:43 | * | arkt8 joined #nim |
18:33:24 | * | stkrdknmibalz joined #nim |
18:34:59 | FromDiscord | <exelotl> @reversem3 the following worked for me: `nim doc --project --index:on --git.url:https://github.com/exelotl/natu --git.commit:devel --outdir:docs natu/docs.nim` |
18:35:44 | FromDiscord | <exelotl> where docs.nim is a file that imports every module I want to document |
18:58:16 | * | noeontheend quit (Ping timeout: 246 seconds) |
19:00:37 | * | Zectbumo quit (Read error: Connection reset by peer) |
19:11:32 | * | duuude quit (Ping timeout: 260 seconds) |
19:15:12 | reversem3[m] | I have been looking into `nim doc` and trying to explain in a human way this very simple proc and what it means |
19:15:15 | reversem3[m] | https://play.nim-lang.org/#ix=3XC1 |
19:15:46 | * | reversem3[m] uploaded an image: (240KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/BnShvZeKpVFINuvyprccXwme/image.png > |
19:15:49 | reversem3[m] | Here is a screenshot of what it looks like : |
19:16:57 | reversem3[m] | I think nim doc is an excellent tool , but the wording and examples have to be clear |
19:17:45 | reversem3[m] | Can anyone see what this could explain better ? |
19:20:11 | reversem3[m] | * Can anyone see , how this could be explained better? |
19:26:49 | * | duuude joined #nim |
19:34:24 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in - Stopping for maintenance... Leave messages at my XMPP ([email protected]), or my Discord (Gustavo6046#9009), or possibly my Mastodon [email protected]), or email ([email protected]).) |
19:47:23 | * | wallabra joined #nim |
19:52:44 | FromDiscord | <Toromino> Why does sqlite raise that error upon creating a table? https://media.discordapp.net/attachments/371759389889003532/974398739395543100/unknown.png |
19:54:40 | * | noeontheend joined #nim |
19:58:23 | FromDiscord | <Prestige> That's a funny error message |
19:58:26 | FromDiscord | <Prestige> Can you show the code? |
19:58:50 | * | noeontheend quit (Ping timeout: 240 seconds) |
19:59:30 | FromDiscord | <Toromino> sent a code paste, see https://play.nim-lang.org/#ix=3XCe |
20:00:42 | FromDiscord | <Toromino> (edit) "https://play.nim-lang.org/#ix=3XCe" => "https://play.nim-lang.org/#ix=3XCh" |
20:00:53 | FromDiscord | <Toromino> In reply to @Avahe "That's a funny error": Even weirder is that it only crashes upon creating the database. After it is created I can interact with it just fine. |
20:01:17 | FromDiscord | <Toromino> (edit) "In reply to @Avahe "That's a funny error": Even weirder is that it only crashes upon creating the database. After it is created I can ... interactthe" added "start the program again and" | "it" => "the database" |
20:12:36 | * | kayabaNerve quit (Ping timeout: 276 seconds) |
20:20:22 | * | slowButPresent joined #nim |
20:27:54 | * | kayabaNerve joined #nim |
20:36:27 | * | kayabaNerve quit (Ping timeout: 260 seconds) |
20:40:35 | FromDiscord | <!Patitotective> In reply to @root "Are there any easy": https://github.com/nimgl/imgui 😎 |
20:40:56 | FromDiscord | <!Patitotective> and for an example https://github.com/Patitotective/ImTemplate |
20:41:18 | FromDiscord | <!Patitotective> In reply to @demotomohiro "This is why Nim": damn raw html |
20:52:52 | FromDiscord | <ambient> @!Patitotective nice job. Good, more complex examples than hello world for Nim GUI dev is sorely needed |
20:53:38 | FromDiscord | <!Patitotective> im currently working on the 7GUIs tasks for ImTemplate v2.0↵https://eugenkiss.github.io/7guis/tasks |
20:55:47 | reversem3[m] | how do you convert a string to a float |
20:56:07 | FromDiscord | <!Patitotective> https://nim-lang.org/docs/strutils.html#parseFloat%2Cstring ? |
21:00:05 | reversem3[m] | perfect thanks |
21:01:10 | * | kayabaNerve joined #nim |
21:01:17 | * | vicecea quit (Remote host closed the connection) |
21:01:34 | * | kayabaNerve quit (Remote host closed the connection) |
21:01:47 | * | vicecea joined #nim |
21:12:11 | reversem3[m] | How do I make this work with strings echo("Your temperature is: ", degree_in_fahrenheit in Fahrenheit and FahToCel(x).floor, "in Celsius") |
21:12:57 | reversem3[m] | It should say "Your temperature is: 100 in fahrenheit and -13.0 in celcius |
21:14:00 | reversem3[m] | nm I got it now |
21:18:34 | FromDiscord | <Elegantbeef> Yea it's not great, might need an RFC or similar to get some progress on that. |
21:26:02 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3XCE |
21:26:41 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3XCE" => "https://play.nim-lang.org/#ix=3XCF" |
21:27:02 | FromDiscord | <!Patitotective> (edit) "https://paste.rs/yib" => "https://play.nim-lang.org/#ix=3XCG" |
21:27:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XCH |
21:27:58 | FromDiscord | <!Patitotective> wouldnt it be cooler to support `a, b = 2`? |
21:28:08 | FromDiscord | <!Patitotective> or is there some conflict |
21:28:09 | FromDiscord | <!Patitotective> (edit) "conflict" => "conflict?" |
21:28:23 | FromDiscord | <Elegantbeef> Personally i think joined assignment is dumb |
21:28:41 | FromDiscord | <!Patitotective> but for lazy persons |
21:29:04 | FromDiscord | <Elegantbeef> If you're going to write code lazily dont let me see it |
21:29:29 | FromDiscord | <!Patitotective> :[ |
21:30:00 | Amun-Ra | a, b = 2 looks like tuple unpacking went bad |
21:30:21 | FromDiscord | <!Patitotective> they're not even tuples, are they? |
21:30:42 | Amun-Ra | 2 for sure isn't ;> |
21:30:55 | FromDiscord | <Elegantbeef> Well `(a, b) =` makes a L-value tuple |
21:31:27 | FromDiscord | <!Patitotective> what proc is called when `(a, b) = (1, 2)` |
21:31:29 | FromDiscord | <!Patitotective> (edit) "2)`" => "2)`?" |
21:31:47 | FromDiscord | <Elegantbeef> No proc is called |
21:32:06 | FromDiscord | <Elegantbeef> It's an assignment of an L-value tuple to the right hand |
21:32:24 | FromDiscord | <!Patitotective> sad |
21:35:30 | Amun-Ra | nah |
21:40:46 | FromDiscord | <luteva> sent a long message, see http://ix.io/3XCL |
21:41:07 | FromDiscord | <Elegantbeef> leftout `proc` |
21:42:10 | FromDiscord | <luteva> is "proc" necessary, here? |
21:42:17 | FromDiscord | <Elegantbeef> Yes |
21:42:33 | FromDiscord | <Elegantbeef> I didnt say it for giggles 😛 |
21:42:50 | * | kenran quit (Quit: WeeChat info:version) |
21:43:28 | FromDiscord | <luteva> so i can either write proc ... or use the concept x ..... notation? but cannot use concept without x and without proc? |
21:43:42 | FromDiscord | <Elegantbeef> Exactly new concepts are lacking features |
21:43:55 | FromDiscord | <luteva> ok thanks! |
21:44:01 | FromDiscord | <Zoom> @sekao\: Hey Zach, what are your goals with the illwill fork? |
21:44:01 | reversem3[m] | Is it possible to readLine multiple strings , 1 at a time? and then process them ? |
21:44:29 | FromDiscord | <Rika> In reply to @reversem3 "Is it possible to": What does that mean? As in each string is a “line”? |
21:44:32 | reversem3[m] | for instance I was to get the dimensions of a box but I want the user to input three values |
21:45:18 | FromDiscord | <Rika> Oh you mean to “intake” three or whatever amount of lines at a time in a loop? |
21:45:28 | reversem3[m] | then take the three values and then calculate them , or do I need to read in 1 value per time |
21:45:49 | reversem3[m] | yeah I supposed it would have to be a while loop then huh ? |
21:45:57 | FromDiscord | <Rika> With read line and if your values are per line then you have to do it one at a time |
21:46:21 | FromDiscord | <Rika> If you put the three values in the same line then it’s no problem |
21:47:02 | reversem3[m] | would that be a seq then ? |
21:47:29 | FromDiscord | <Rika> No it would just be a single string, you’d still have to parse the values out somehow |
21:48:05 | reversem3[m] | ok so either way it would have to be one string at a time |
22:02:12 | * | tk quit (Quit: Well, this is unexpected.) |
22:03:15 | FromDiscord | <federico3> what's the best way to parse a nim file and extract proc definitions? |
22:04:11 | FromDiscord | <Elegantbeef> Depends where you are |
22:04:40 | FromDiscord | <Elegantbeef> If you're in compilation you can load the file into memory and usue `parseStmt`/`parseExpr` |
22:04:41 | FromDiscord | <Elegantbeef> Otherwise you may want to look at the NimVm and use it to parse for you so you can expand macros and the like |
22:04:57 | * | tk joined #nim |
22:06:25 | FromDiscord | <federico3> thanks. I was looking for parse-\ but parseExpr is not listed in https://nim-lang.github.io/fusion/theindex.html |
22:06:28 | * | caliente22 quit (Ping timeout: 248 seconds) |
22:08:06 | FromDiscord | <j-james> concepts pretty much eclipse range types, right? |
22:08:23 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=3XCU |
22:08:37 | FromDiscord | <Rika> One is simpler and probably less bug free due to that |
22:09:39 | FromDiscord | <Recruit_main707> but ideally yes |
22:10:25 | FromDiscord | <sekao> In reply to @Zoom "<@610133894120865803>\: Hey Zach, what": i added truecolor support and currently working on a feature to allow working with subsets of a terminal buffer (called "slices" for now) using relative coords. important for making reusable TUI components. |
22:10:25 | FromDiscord | <Rika> In an ideal world lol |
22:11:16 | FromDiscord | <Elegantbeef> Well concepts are statically reasoned so you cannot use a concept to represent runtime logic |
22:11:47 | FromDiscord | <Elegantbeef> Range types inject range checking so you cannot make it equivlent |
22:12:19 | FromDiscord | <Zoom> I like illwill but I'm a bit worried about the amount of global vars and overall structure. Do you plan any general refactoring?↵(@sekao) |
22:12:33 | FromDiscord | <Zoom> The first thing which comes to mind is to separate keyboard handling part |
22:12:42 | FromDiscord | <Elegantbeef> TIL Zach responds to pings here |
22:12:49 | FromDiscord | <Rika> Who |
22:12:58 | * | jjido joined #nim |
22:13:08 | FromDiscord | <Elegantbeef> The author of paravim and the like |
22:13:17 | FromDiscord | <Zoom> Even better to make it a separate lib, I think. Wdyt? |
22:13:17 | FromDiscord | <Elegantbeef> I mean vimcubed the most important human invention |
22:13:21 | FromDiscord | <Rika> Scary, why do you know his first name |
22:13:32 | FromDiscord | <Elegantbeef> Cause he's made many videos about his stuffs |
22:13:45 | FromDiscord | <Elegantbeef> and zach is easier to write then sekao |
22:13:49 | FromDiscord | <Rika> Okay |
22:13:56 | FromDiscord | <sekao> In reply to @Zoom "I like illwill but": yeah i already removed some globals |
22:14:12 | FromDiscord | <Zoom> There's such a thing as NimConf for starters...↵(@Rika) |
22:14:49 | FromDiscord | <sekao> In reply to @Elegantbeef "*TIL Zach responds to": that was my first message on here 😛 i didnt realize this place existed |
22:15:20 | FromDiscord | <Elegantbeef> Lol welcome |
22:15:28 | FromDiscord | <exelotl> In reply to @federico3 "what's the best way": I'm working on a dumb python script that does this, to use with Sphinx. I hope to have it finished next week sometime |
22:15:29 | FromDiscord | <Elegantbeef> This is where i write all my inane rambling |
22:15:30 | FromDiscord | <Zoom> How come I just tab-completed you then? \:D |
22:15:43 | FromDiscord | <Elegantbeef> Exelotl doing more work |
22:16:06 | FromDiscord | <exelotl> xP |
22:16:08 | FromDiscord | <Rika> Beef what do you think about wrapping registers in pico lib? |
22:16:29 | FromDiscord | <Elegantbeef> Rika i have like -10 iq when it comes to that |
22:16:31 | FromDiscord | <Rika> I just got in a situation where I need to anyway so I will, but I wanna see if you’d like it |
22:16:38 | FromDiscord | <Rika> Okay I’ll look into it |
22:16:42 | FromDiscord | <Elegantbeef> Well when it comes to most things |
22:16:55 | FromDiscord | <Elegantbeef> I'm like the worst person to be the maintainer of picostdlib |
22:17:17 | FromDiscord | <Rika> Because you ain’t interested in embedded programming or because you just don’t know? |
22:17:26 | FromDiscord | <Rika> Or is it a time thing I don’t know |
22:17:32 | FromDiscord | <Elegantbeef> I'm interested but dont have much hard ware to actually play with it |
22:17:44 | FromDiscord | <Elegantbeef> So i dont actually learn anything about it |
22:17:45 | FromDiscord | <Elegantbeef> Or write any code in the space |
22:18:01 | FromDiscord | <Rika> Is it that hard to find a pico where you’re at? Or am I wrong in what I’m thinking about |
22:18:21 | FromDiscord | <Elegantbeef> I have a pico, i just dont have any of the other hardware like screens or i2c stuff |
22:18:28 | FromDiscord | <Rika> Oh okay |
22:18:46 | FromDiscord | <Rika> Then I’ll do some stuff since I have screens and LED matrices and whatnot |
22:18:49 | FromDiscord | <Elegantbeef> So when someone says X works i trust them, like martinx with the i2c stuff |
22:19:27 | FromDiscord | <ambient> i have like 100 stm32, someone just would have to solder them to pcbs |
22:19:40 | FromDiscord | <huantian> Where do you get that many lol |
22:19:45 | FromDiscord | <ambient> aliexpress |
22:19:53 | FromDiscord | <Rika> Damn did you do a production run of some product or something to have that many? |
22:20:15 | FromDiscord | <ambient> well they come in a roll and take very little space so i thought why not, there's always something I can put them in |
22:20:15 | FromDiscord | <exelotl> In reply to @Elegantbeef "Exelotl doing more work": I previously had some success extracting doc comments in nimscript using a typed macro that you invoke like `getDocs: include "foo.nim"`↵But you still have to do traversal logic and resort to manual parsing in some cases, and it only works with a subset of Nim code (even though the code doesn't run, it still has to be valid nimscript) |
22:20:32 | FromDiscord | <Rika> In reply to @ambient "well they come in": I see |
22:20:32 | FromDiscord | <exelotl> So I figured just parsing the files manually is better |
22:20:39 | FromDiscord | <ambient> but these days JLCPCB does assembly so it's kind of relic of the past |
22:20:42 | FromDiscord | <Rika> Let me see if I can get a role of pico chips hahaha |
22:20:46 | FromDiscord | <Rika> Roll |
22:20:48 | FromDiscord | <Rika> I can English |
22:21:21 | FromDiscord | <huantian> I wanna try using a pico on my next keeb but it’s gonna be a split and idk if they have firmware for it |
22:21:42 | FromDiscord | <Rika> Lol coincidentally I am writing keyboard firmware |
22:21:44 | FromDiscord | <ambient> keyboard firmware is super simple to write, as long as you already have a usb stack |
22:21:55 | FromDiscord | <Rika> I think PMunch has some already made but not for the pico |
22:22:11 | FromDiscord | <Rika> In reply to @ambient "keyboard firmware is super": Not if you’re being ambitious hahaha |
22:22:12 | FromDiscord | <ambient> bit banging USB is for the adventurous types |
22:22:13 | FromDiscord | <huantian> But then I have to account for likeee demultiplexers and oleds and stuff |
22:22:18 | FromDiscord | <Rika> But for the most part it’s simple yes |
22:22:45 | FromDiscord | <Rika> In reply to @ambient "bit banging USB is": Really easy on the pico since there are two coprocessors that can handle arbitrary IO protocols |
22:22:45 | FromDiscord | <Elegantbeef> Dont have to use nimscript |
22:22:46 | FromDiscord | <Elegantbeef> Yea i mean i you might be able to use other APIs to parse nim code, i could be wrong↵(@exelotl) |
22:23:08 | FromDiscord | <Rika> In reply to @huantian "But then I have": What’s the demux for? |
22:23:09 | FromDiscord | <Elegantbeef> Anyway dogs want to walk, so i guess ping rika if you're missing my sass |
22:23:16 | FromDiscord | <Rika> OLED screens are often just SPI no? |
22:23:22 | FromDiscord | <huantian> In reply to @Rika "What’s the demux for?": Yeah true |
22:23:26 | FromDiscord | <huantian> Wups |
22:23:26 | FromDiscord | <Rika> Rather the ones used on keyboard |
22:23:42 | FromDiscord | <huantian> It’s just for getting more pins for other stuff |
22:23:48 | FromDiscord | <huantian> Like the rotary encoder |
22:23:48 | FromDiscord | <ambient> most OLEDs I have are both SPI and i2c iirc |
22:24:19 | FromDiscord | <Rika> Ideally I’d use I2C since it’s less pins used lol not like a keyboard needs to display 60 fps content |
22:24:48 | FromDiscord | <Rika> In reply to @huantian "It’s just for getting": Demultiplexer for that? Don’t you just use either a shift register or an IO expander? |
22:25:11 | FromDiscord | <Rika> You can put the whole keyboard matrix on two shift registers and save a lot of pins that way hahaha |
22:25:27 | FromDiscord | <huantian> Huh ig you could |
22:25:39 | FromDiscord | <Rika> effectively two; they’d have to have enough bits to do all rows/columns |
22:25:50 | FromDiscord | <Rika> You can chain them anyway so yeah |
22:31:52 | FromDiscord | <ambient> I was sure there was some FPGA tools for Nim like nMigen but I must have been dreaming |
22:33:57 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:34:38 | FromDiscord | <luteva> sent a long message, see http://ix.io/3XCW |
22:35:16 | FromDiscord | <Prestige> I have a type want to essentially duplicate, but add more properties to it. Is the right thing to do just use `type Foo = object of Bar` or does that set up some other weird inheritance stuff along with it? |
22:39:02 | * | noeontheend joined #nim |
22:41:30 | FromDiscord | <Bubblie> Do any of you know where nim handles imports and import modules? |
22:41:34 | FromDiscord | <Bubblie> In the nim-lang repo |
22:57:53 | * | noeontheend quit (Ping timeout: 256 seconds) |
22:58:00 | FromDiscord | <Elegantbeef> @Prestige\: you can use inheritance and if you dont want type information do `type Foo {.pure, inheritable.} = object` |
22:58:28 | FromDiscord | <Elegantbeef> Or use concepts like a human |
22:58:52 | FromDiscord | <Elegantbeef> Concepts cannot be recursive↵(@luteva) |
23:01:06 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in - Stopping for maintenance... Leave messages at my XMPP ([email protected]), or my Discord (Gustavo6046#9009), or possibly my Mastodon [email protected]), or email ([email protected]).) |
23:01:48 | FromDiscord | <luteva> In reply to @Elegantbeef "Concepts cannot be recursive": why not?↵I mean with the proc notation it works just fine! (that's what i just discovered and what a ) |
23:02:07 | FromDiscord | <luteva> (edit) "a )" => "i am surprised about)" |
23:02:14 | FromDiscord | <Elegantbeef> The original concepts are done with compile statements so it's a recursive check that isnt logical |
23:02:25 | FromDiscord | <luteva> ok |
23:02:54 | FromDiscord | <Elegantbeef> Actually it might work |
23:03:32 | FromDiscord | <Elegantbeef> Never mind it's recursive 😄 |
23:03:42 | FromDiscord | <luteva> so i have to use the 'proc' notation when i want to check for a proc that returns the type of a concept. |
23:03:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XD0 |
23:04:08 | FromDiscord | <Elegantbeef> Personally i dont really see the point in the returning the concept |
23:07:32 | * | wallabra joined #nim |
23:12:55 | FromDiscord | <!Patitotective> hmm, im having issues with new lines on windows, it seems they use `\x0D\x0A` instead of `\n` (?)↵so i was wondering if i should do `newLine <- '\n' | "\x0D\x0A"`?? |
23:13:34 | FromDiscord | <Elegantbeef> Welcome to the world of line endings |
23:14:19 | FromDiscord | <Elegantbeef> Yes you should do `'\n'` and `\p` |
23:14:21 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals |
23:16:16 | FromDiscord | <Prestige> Yeah I basically just wanted the same members of a type, plus some more |
23:16:25 | FromDiscord | <Prestige> I could just not be lazy and duplicate the code I suppose |
23:16:42 | FromDiscord | <Elegantbeef> Yea just use inheritance with pure |
23:16:47 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Yes you should do": nice and thanks :] |
23:16:48 | FromDiscord | <Elegantbeef> Sorry it's not `\p` |
23:17:00 | FromDiscord | <Elegantbeef> `\c\n` or `\n` |
23:19:40 | FromDiscord | <!Patitotective> shouldnt i just do `\p`? since its platform specific 🤔 |
23:19:43 | FromDiscord | <!Patitotective> (edit) "🤔" => "🤨" |
23:21:51 | FromDiscord | <!Patitotective> actually `\p` or `\n` because people could use \n on windows |
23:23:21 | FromDiscord | <spoon> windows terminal |
23:25:02 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "`\c\n` or `\n`": actually youve got reason↵its easier to just say that hehe |
23:33:32 | FromDiscord | <theangryepicbanana> is there a fast way to pop multiple items from a seq at once? |
23:33:56 | FromDiscord | <Elegantbeef> You want to make a new sequence with X number of elements? |
23:34:22 | FromDiscord | <theangryepicbanana> kinda, I'd like to pop the last N values of a seq and add it to another seq |
23:35:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XD5 |
23:35:17 | FromDiscord | <Elegantbeef> actually i think that'd be `(start, lengthOfSlice)` |
23:35:44 | FromDiscord | <theangryepicbanana> yeah I also have to wonder if there's a length-based slice operation as opposed to range-based |
23:36:07 | FromDiscord | <theangryepicbanana> but I suppose that could work for now |
23:36:28 | FromDiscord | <Elegantbeef> Well you can do `[a..b]` but that makes a new sequence |
23:36:36 | FromDiscord | <Elegantbeef> `toOpenArray` is the fastest slice operator |
23:36:45 | FromDiscord | <theangryepicbanana> hmm ok |
23:40:56 | FromDiscord | <luteva> sent a long message, see https://paste.rs/YtS |
23:41:31 | FromDiscord | <Elegantbeef> Why does `save(p)` return `p` |
23:42:09 | FromDiscord | <Elegantbeef> `save` should probably be like `proc saveTo(target: var SomeTarget, myType: T)` |
23:42:36 | FromDiscord | <luteva> because the object can be updated and maybe i have to use the new version of the object. |
23:43:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XD8 |
23:43:48 | FromDiscord | <Elegantbeef> `type P` is the bound type of the concept being checked |
23:44:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/43l |
23:45:28 | FromDiscord | <luteva> oh yes! that may help! thanks! I'llo try that. |
23:45:40 | FromDiscord | <luteva> (edit) "I'llo" => "I'll" |
23:45:47 | FromDiscord | <Elegantbeef> If the new concepts work for you you should use them |
23:45:53 | FromDiscord | <Elegantbeef> Otherwise go to the old ones |
23:46:01 | FromDiscord | <Elegantbeef> Though i personally default to the old ones since they're presently more capable |
23:47:07 | FromDiscord | <luteva> yes. i just also wanted to try out and understand how it would work in the older version... just learning 🙂 |
23:47:16 | FromDiscord | <Elegantbeef> Ah ok |
23:48:47 | FromDiscord | <luteva> so, in the end, it was just the typeof(..) i was missing. |
23:49:02 | FromDiscord | <Elegantbeef> yes `a is b` needs the right hand to be a typedesc |
23:49:07 | FromDiscord | <Elegantbeef> the left hand works with a value or type |
23:49:45 | FromDiscord | <luteva> 👍 |
23:51:39 | FromDiscord | <⎝⪩﹏⪨⎠> I managed to get just the compiler to work on Pop!_OS 22.04 |
23:52:00 | FromDiscord | <Elegantbeef> Congrats! |
23:52:00 | FromDiscord | <⎝⪩﹏⪨⎠> And tried to install a VS Code extension for Nim. |
23:52:04 | FromDiscord | <⎝⪩﹏⪨⎠> But... |
23:52:18 | FromDiscord | <⎝⪩﹏⪨⎠> But I'm having some troubles. |
23:52:57 | FromDiscord | <⎝⪩﹏⪨⎠> I want to go and see the code I don't understand about Nim (like `echo` or `log2`), but the extension can't find the definitions. |
23:53:04 | FromDiscord | <⎝⪩﹏⪨⎠> And it used to work fine before. |
23:53:14 | FromDiscord | <Elegantbeef> Do you have nimsuggest in your path |
23:53:16 | FromDiscord | <⎝⪩﹏⪨⎠> Even in Windwos. |
23:53:23 | FromDiscord | <⎝⪩﹏⪨⎠> In reply to @Elegantbeef "Do you have nimsuggest": What's that? |
23:53:40 | FromDiscord | <⎝⪩﹏⪨⎠> More extra steps? Well, I can try them. |
23:53:53 | FromDiscord | <⎝⪩﹏⪨⎠> But I only have the compiler, nothing else. |
23:53:58 | FromDiscord | <Elegantbeef> does `nimsuggest` work? |
23:53:58 | FromDiscord | <⎝⪩﹏⪨⎠> No nimble or choosenim. |
23:54:16 | FromDiscord | <Elegantbeef> Well if you dont have nimsuggest then tooling will not work |
23:54:19 | FromDiscord | <⎝⪩﹏⪨⎠> Because choosenim buggy in Ubuntu 22.04-based distros. |
23:54:47 | FromDiscord | <Elegantbeef> You could try http://gitnim.com/ instead of choosenim |
23:55:00 | FromDiscord | <Elegantbeef> It's not commonly used but works well ime |