<< 16-12-2020 >>

00:15:09FromDiscord<KingDarBoja> Does OrderedTable.sort works for values different than primitives?
00:15:26FromDiscord<KingDarBoja> Something like OrderedTable[string, SomeType]`
00:15:30FromDiscord<KingDarBoja> (edit) "OrderedTable[string," => "`OrderedTable[string,"
00:16:11mipri.sort takes a cmp
00:17:15FromDiscord<KingDarBoja> Yes but, does it work with complex table values? I just want to sort the OrderedTable by alphabetic order of keys
00:17:18FromDiscord<Rika> Provide it a cmp function that isn't the default in system
00:17:29FromDiscord<Rika> Why wouldn't it if you're making your own cmp function
00:17:45FromDiscord<KingDarBoja> Ah, so I must provide a custom one... 🤔
00:18:01mipriif system.cmp doesn't do what you want, sure
00:19:01miprithe answer anyway is yes: it works for non-primitive types.
00:19:05FromDiscord<KingDarBoja> Ah, okay, sorted it out at the end 😄
00:19:21FromDiscord<KingDarBoja> `result.sort(proc (x,y: (string, MyType)): int = result = cmp(x[0], y[0]))`
00:42:59FromDiscord<shadow.> use sugarr
00:43:34FromDiscord<shadow.> `result.sort((x, y) => (cmp(x[0], y[0]))` iirc
00:43:52FromDiscord<shadow.> (edit) "y[0]))`" => "y[0])))`"
00:53:25FromDiscord<Rika> Type is unspecified, might result in undesirable proc
00:53:39FromDiscord<Rika> Rather I don't know if that works at all
00:57:48miprihttps://play.nim-lang.org/#ix=2Iev
01:01:09*aHaquer joined #nim
01:01:58FromDiscord<19> hi guys, a little help here? https://play.nim-lang.org/#ix=2Iez
01:04:08FromDiscord<19> is that a function pointer?
01:07:52mipriyeah, that's a function pointer
01:09:21FromDiscord<19> are you sure because in here he doesn't mention this function https://ericscrivner.me/2017/10/getting-circular-sdl-audio/
01:10:00mipriyes, I'm sure
01:10:26FromDiscord<19> cool!
01:10:35mipricdecl.org isn't as good of a site as I thought it was, since it can't handle the way that's written
01:10:37FromDiscord<WalrusNoj> hey is there any way to compile nim to browser JS that interacts with elements and stuff?
01:10:41mipribut https://cdecl.org/?q=int+%28*GetSample%29%28int*%29 it close, just changing some of the types to int
01:11:28FromDiscord<19> lol what an epic site!
01:11:39miprihttps://nim-lang.org/docs/backends.html#backends-the-javascript-target - like so, just don't pass -d:nodejs
01:11:51FromDiscord<19> thanks mipri
01:11:54mipriand follow the link to JS mods
01:12:29FromDiscord<WalrusNoj> okk thanks!
01:14:32*Tanger joined #nim
01:27:01FromDiscord<bark> i realize -8 div 8 is 1
01:27:13FromDiscord<bark> then i realized i had been using nim 1.0.0 all along 😭
01:30:47FromDiscord<19> <mipri> https://play.nim-lang.org/#ix=2IeK does this look right to you?
01:33:17mipriyou're using platform_audio_settings twice, but passing it where a _buffer and a _config are expected, respectively
01:33:44mipriother than that, sure. I haven't used the FFI to this extent though, so I'd test with a little self-contained library.
01:40:23*opal quit (Remote host closed the connection)
01:40:44*opal joined #nim
01:40:56FromDiscord<19> nice!
01:41:32FromDiscord<19> is there a way to omit the function pointer's param name? not very important but just curious
01:41:48FromDiscord<19> yes im testing in a self contained little space
01:41:59FromDiscord<19> learned that the hard way :p
01:42:36miprino, I don't know if the name's omittable. Nim cares more about that because it allows named parameters at the call site.
01:43:37FromDiscord<19> cool! thanks so much
01:59:52*krux02 quit (Remote host closed the connection)
02:38:44*reversem3 quit (Ping timeout: 268 seconds)
02:38:44*leorize[m] quit (Ping timeout: 268 seconds)
02:39:03*BitPuffin quit (Ping timeout: 260 seconds)
02:39:21*nikki93[m] quit (Ping timeout: 268 seconds)
02:39:21*VijayMarupudi[m] quit (Ping timeout: 268 seconds)
02:39:21*L[m] quit (Ping timeout: 268 seconds)
02:39:49*L[m] joined #nim
02:39:56*nikki93[m] joined #nim
02:40:15*reversem3 joined #nim
02:40:20*BitPuffin joined #nim
02:40:59*VijayMarupudi[m] joined #nim
02:42:17*leorize[m] joined #nim
02:52:28*vicfred quit (Quit: Leaving)
02:53:32*lritter joined #nim
02:53:34*Fish-Face quit (Read error: Connection reset by peer)
02:54:50*Fish-Face joined #nim
03:08:51*aHaquer left #nim (#nim)
03:09:12*leorize joined #nim
03:19:20leorizedom96: does nimble support monorepo (repo with multiple packages)?
03:22:56leorizeah, found the ?subdir thingy
03:29:53FromDiscord<flywind> It is supported. See https://github.com/nim-lang/graveyard
03:53:18*regreg joined #nim
04:06:01*supakeen quit (Quit: WeeChat 2.9)
04:06:35*supakeen joined #nim
04:13:04*lritter quit (Ping timeout: 272 seconds)
04:13:17*muffindrake joined #nim
04:13:17*lritter joined #nim
04:32:19*narimiran joined #nim
04:49:03*regreg quit (Ping timeout: 272 seconds)
04:58:38*rockcavera quit (Remote host closed the connection)
04:59:20*spiderstew_ joined #nim
05:00:21*spiderstew quit (Ping timeout: 258 seconds)
05:16:36*leorize[m] quit (Ping timeout: 268 seconds)
05:16:48*leorize[m] joined #nim
05:37:44*waleee-cl quit (Quit: Connection closed for inactivity)
06:47:17FromDiscord<mratsim> I have found my new blog article for Nim "Multithreading flavors: choosing the right tool for the right job".
06:51:16leorizeI'm eagarly waiting for the great mratsim to explain how to do multithreading in nim :D
07:02:00*habamax joined #nim
07:09:58FromDiscord<D3F0LT> Hi
07:10:09FromDiscord<ElegantBeef> Hello
07:16:25FromDiscord<mratsim> sent a long message, see http://ix.io/2Ig8
07:17:19Zevvexcellent
07:17:55supakeengoedemorgen
07:19:55Zevvgoedemorgen
07:20:38FromDiscord<mratsim> It's mostly because I see a confusion over and over on what to people try to use Weave on.
07:20:54Zevveven ar4q, which kind of surprised me
07:22:49FromDiscord<mratsim> Ah, I should had to "scheduler": optimizing for latency: a budget system to ensure fairness and optimizing for throughput: using data hot in cache (last in first out)
07:22:59FromDiscord<ElegantBeef> And then there is me, someone that rarely touches multithreading/async due to the nature of what i make
07:26:04FromDiscord<kenran> what are you doing mainly?
07:26:27FromDiscord<ElegantBeef> Typically hanging around game dev
07:36:52FromDiscord<mratsim> ah yes, it's not evident but I will also write about multithreading without scheduler, just spinning thread dedicated to providing one "service", say one for animation, one for computing physics, one for AI, one for UI/control/networking.
07:37:10FromDiscord<mratsim> and communicating in a producer/consumer manner.
07:46:31FromDiscord<haxscramper> How I can wrap `enum class` in order to be able to use it in built-in sets. It is not implicitly convertible to integer, so codegen fails compilation when trying to `echo` set of resulting enums
07:47:47FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2Igh
07:48:59FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2Igi
07:52:19FromDiscord<lqdev> gosh, enum class is such a shitty design
07:54:04FromDiscord<haxscramper> Well, this is still better than getting destroyed by implicit conversions
07:54:32FromDiscord<haxscramper> Though in this case I'd prefer that `enum class` wasn't a thing
07:54:56FromDiscord<ElegantBeef> The fuck is an enum class?
07:55:05FromDiscord<ElegantBeef> Is it just making it what nim considers "pure"?
07:55:12FromDiscord<lqdev> i mean removing implicit conversions is a valid reason, it's just that enum class's ideas are good but the execution is poor
07:55:22FromDiscord<lqdev> @ElegantBeef kind of
07:55:23FromDiscord<haxscramper> 'typesafe' enum from C++ that does not allow implicit conversions to integers
07:55:29FromDiscord<mratsim> I have a macro for that
07:55:49FromDiscord<ElegantBeef> Wait they're implictly converted?
07:55:54FromDiscord<ElegantBeef> The fuck
07:56:18FromDiscord<mratsim> https://github.com/status-im/nimbus-eth1/blob/master/nimbus/vm/interpreter/opcode_values.nim#L10
07:56:46FromDiscord<mratsim> I think @haxscramper meant integer promotion instead of implicit conversion.
07:57:26FromDiscord<mratsim> https://github.com/status-im/nimbus-eth1/blob/master/nimbus/vm/interpreter/utils/macros_gen_opcodes.nim#L25-L83↵↵the fill_enum_holes macro transfrom an enum with holes into a full enum, that can be used in a set
07:58:19FromDiscord<mratsim> (edit) https://github.com/status-im/nimbus-eth1/blob/master/nimbus/vm/interpreter/opcode_values.nim#L10
07:58:20*FromDiscord quit (Remote host closed the connection)
07:58:37*FromDiscord joined #nim
07:58:56FromDiscord<haxscramper> This is not a problem of enum with holes, I have issues on codegen stage
07:59:06FromDiscord<haxscramper> Let me clean up the example from `=2` `=3`
08:01:22FromDiscord<haxscramper> Oh, actlually
08:02:35FromDiscord<haxscramper> Yeah, now no errors in codegen, but previously it was related to `echo`, not sets. I could create set with this enum without errors
08:05:45FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2Igr
08:08:58FromDiscord<haxscramper> But this creates invalid `valFixup0` that can be used in nim code, but don't correspond to anything in wrapped backend.
08:11:37leorizehmm, not sure if enums with holes should even be supported by bitsets
08:12:17FromDiscord<mratsim> They aren't, or they were not when I wrote my macro
08:14:14FromDiscord<mratsim> by the way @Zevv Apparently from the C++Con talk: at 40:00 https://youtu.be/tF-Nz4aRWAM?t=2395↵C++ coroutines are using Continuation-passing Style underneath
08:16:45*Cthalupa quit (Ping timeout: 240 seconds)
08:17:39*Cthalupa joined #nim
08:27:01*mbomba joined #nim
08:41:20*nikki93[m] quit (Ping timeout: 268 seconds)
08:41:28*nikki93[m] joined #nim
08:44:52*Tanger quit (Remote host closed the connection)
08:46:12*PMunch joined #nim
09:02:07*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:05:44Zevvsure what else
09:06:13Zevvit's either that or you need a full stack and context switching magic glue
09:06:48*abm joined #nim
09:12:13FromDiscord<mratsim> TBH All those stackfull coroutines, stackless coroutines, fibers and context switching mechanics still elude me
09:12:49Zevv"coroutines is how people are going to do async programming in the future"
09:12:50Zevvreally
09:13:01ZevvI have doing my async IO in lua in coroutines in the last 15 years
09:13:55FromDiscord<mratsim> And then you read discussions like this and you're like mmmh: https://www.reddit.com/r/rust/comments/83tak7/implementing_kotlinstyle_continuations_on_top_of
09:16:09Zevvwhat part of that thread makes you go 'mmmhh'
09:19:23*mbomba quit (Quit: WeeChat 3.0)
09:19:51FromDiscord<mratsim> The tradeoffs, impact on implementation and user API.
09:20:34FromDiscord<mratsim> For example, Rust zero cost is about futures being fully stack allocated and just a pointer to a kernel "file" which can be as simple as a socket
09:20:49FromDiscord<mratsim> Apparently this works perfectly in the readiness model like epoll
09:21:04FromDiscord<mratsim> but not greatly with completion model like IOCP
09:21:50FromDiscord<mratsim> well fine. But as an implementation "detail", it's good because everything is on the stack which significantly simplifies threading since you can track ownership and you don' need heap allocation
09:22:27FromDiscord<mratsim> the alternative is a future owning some buffer, for example a channel, to receive the result and there is a sender, the task spawned that fills it (promise:future, ...)
09:23:11FromDiscord<mratsim> this has a couple of disadvantage: heap allocation and so refcounting because there are 2 users, need for synchronization
09:23:53FromDiscord<mratsim> In Weave, you can drop the heap allocation and refcounting, if and only if a future cannot escape its spawning scope.
09:24:22FromDiscord<mratsim> by using alloca in that case, but the compiler doesn't expose tool for that.
09:25:09FromDiscord<mratsim> but people expect to be able to have a future and carry it everywhere.
09:25:26FromDiscord<mratsim> in Nim you now have sink to ensure single ownership so it's solved.
09:25:43*leorize quit (Ping timeout: 240 seconds)
09:25:44FromDiscord<mratsim> but as you begin to see, there is a lot of interactions at play
09:26:04FromDiscord<mratsim> just from a user perpective, API and the implementation chosen
09:27:17FromDiscord<mratsim> And I'm not talking at all about the scheduler because depending on the model you choose, the scheduler will either sleep and wait for a kernel signal or poll the kernel.
09:27:53FromDiscord<mratsim> at least for IO, because for CPU, I think I reviewed all the scheduling techniques when implementing Weave and carefully analyzed the tradeoffs.
09:29:04*leorize joined #nim
09:30:24FromDiscord<mratsim> And then you need to think about cancellation and apparently in Rust it's a major pain point: https://gist.github.com/Matthias247/ffc0f189742abf6aa41a226fe07398a8
09:32:11FromDiscord<mratsim> Anyway on another note. I keep having the nagging feeling that Weave is actually using continuation passing style internally. Especially the parallelFor loop transformation, so i need to understand the CPS transformation more deeply.
09:33:16supakeenI am still confused by that CPS term.
09:33:27supakeenNowadays it means passing a state holding object right?
09:33:53supakeenOr is still passing a callback function?
09:36:27FromDiscord<Deleted User 5bd78114> Really, i don't know how to start, because i have found a way to use Raylib, but now i want to also use `Physac` (an addon-type thing) for Raylib, it adds Physics but i can't figure out how i could use it
09:36:35FromDiscord<kenran> Do you have any idea how I can debug `could not load): libfreetype-6.dylib` on macOS? I have freetype installed, and it doesn't work inside or outside of a nix-shell. There doesn't seem to be a file with this exact name either, only `libfreetype.6.dylib`.
09:36:54FromDiscord<kenran> (I'm using the `freetype` package from nimble)
09:40:23*krux02 joined #nim
09:44:04miprithere's not really anything to debug. the constant doesn't suit the library path you have.
09:44:50miprithe simplest way to resolve it should be 'nimble develop freetype', and patching your own copy to have a path that works for you.
09:45:21miprithe package can also be smarter about what paths to use and mkaing an issue or a pr is a step to making it smarter
09:46:13miprif.e. the macOS libpcre string is "libpcre(.3|.1|).dylib", exactly like that.
09:50:32FromDiscord<kenran> mipri ty!
09:50:35FromDiscord<haxscramper> Discord replies are not relayed to irc yet, so you should probably ping directly
09:50:59FromDiscord<kenran> now I'm getting all sorts of other issues, but those are at least in my code 🙂
10:10:45*narimiran quit (Ping timeout: 240 seconds)
10:11:50*NimBot joined #nim
10:12:02*narimiran joined #nim
10:18:53narimiranquestion: i can create a bit set like this: `let s = {a..b, c..d}` where a, b, c, d are some ints, and then `typeof(s)` is `set[0..65535]`
10:19:13FromDiscord<mratsim> @supakeen As far as I understood, continuation passing style is instead of calling a function and then resuming where you were once that calls end, you call the function and tell it to handle/take over resuming itself.
10:19:30narimiranso if i want a Table having a bitset for its values, i need to do `var t: Table[string, set[0..65535]]`? no way around this uglyness?
10:19:50supakeenack
10:21:36miprithat's equivalent to set[uint16], although you'd actually need cast[] to change it between them it seems
10:24:36mipri!eval echo (typeof {1..2u16,3}, typeof {1u16..2, 3})
10:24:38NimBot(set[range 0..65535(int)], set[uint16])
10:31:10narimiranmipri: yeah, if i define it as `set[uint16]`, i cannot just do `{a..b, c..d}` like before
10:32:51narimiranand `{a.uint16..b.uint16, c.uint16..d.uint16}` is much uglier
10:33:47miprionly the first one is needed though
10:35:02*fanta1 joined #nim
10:37:22mipriit's disappointing that set[uint16]({1..2, 3..4}) isn't enough. That would permit something like {1..2, 3..4}.MyType
10:38:45narimiranmipri: i tried with only first one. nope.
10:40:02mipriwith literals it works. if you have a,b,c,d, you do need the others
10:42:13mipri!eval import tables; echo typeof({"r1":{1..2, 3..4}}.toTable)
10:42:15NimBotTable[system.string, set[range 0..65535(int)]]
10:43:24miprioh, this works: https://play.nim-lang.org/#ix=2Ihh
10:45:37mipriyou can carry that even into functions over the table
10:46:03narimiranungh
10:47:43miprimore palatably, you can type SetType = r1.type
10:47:48mipriand then refer to that when wanted
11:02:37*Q-Master quit (Ping timeout: 264 seconds)
11:33:57FromGitter<gogolxdong> Is there anyway to cast seq[byte] to string?
11:35:14miprijust cast[string]() AFAIK
11:35:57*Q-Master joined #nim
11:41:24*Q-Master quit (Ping timeout: 268 seconds)
11:47:47FromDiscord<mratsim> no
11:47:50FromDiscord<mratsim> don't do that
11:48:15mipriis it no longer guaranteed to be the same?
11:48:23FromDiscord<mratsim> use a proc foo[T: byte|char](input: openarray[T]) proc instead to be compatible with both
11:48:47FromDiscord<mratsim> it's guaranteed to not have a terminating \0 byte and cause issue in FFI
11:49:48FromDiscord<mratsim> also if you need to assign to a variable, there is a copy needed anyway so do a copy like this: https://github.com/status-im/nim-http-utils/pull/9/files
11:49:49disbotNull terminate public strings
11:51:04FromDiscord<dom96> @mratsim perhaps you'd be up for writing a quick article about dealing with byte data in Nim? Sounds like this knowledge is very important to be shared widely
11:52:13mipritype conversions, how much they cost, how much they check. There was a SO answer for the idiomatic Rust translations that I read about 50 times a week when I used that language.
11:52:42FromDiscord<mratsim> @dom96 with the view types I have to refresh my knowledge :/
12:06:02*supakeen quit (Quit: WeeChat 2.9)
12:06:32*supakeen joined #nim
12:15:59*Q-Master joined #nim
12:34:01*rockcavera joined #nim
12:50:23Zevvdisruptek: does youtube work for you
12:50:37*Q-Master quit (Ping timeout: 264 seconds)
12:57:36FromDiscord<kenran> I'd second that. I will soon have to go down that rabbit hole I thing because I have to receive byte data from an FD and was already wondering how I should do the conversion.
12:59:40FromDiscord<kenran> (edit) I'd second that. I will soon have to go down that rabbit hole I think because I have to receive byte data from an FD and was already wondering how I should do the conversion.
13:04:06FromDiscord<shadow.> zevv how did you say you could debug npeg?
13:04:12FromDiscord<shadow.> to see where it was failing assertion etc
13:06:39Zevvshadow.: I'd be glad to answer you
13:07:03Zevvbut up to now, all questions you aksed have answers clearly stated in the manual :)
13:07:18Zevvfor example, did you read the section "TRacing and debugging"
13:07:34FromDiscord<shadow.> fair enough
13:07:37FromDiscord<shadow.> thanks
13:07:37Zevv-d:npegTrace
13:07:43Zevvis the go-to first thing
13:08:06Zevvat compile time it'll show a representation of the generated parser, which you might or might not find useful
13:08:39Zevvat run time it will print a line for every FSM state and current instruction, together with the subject stream at the current position
13:08:49Zevvit will show for each try if it matches or not, and what it is trying at any time
13:08:52FromDiscord<shadow.> ahh i see interesting thanks
13:10:45Zevvmratsim: What I miss in this cppcon talk is how the CPSing is done, and what happens with the lifed locals. how is that memory managed, owned, etc
13:11:32FromDiscord<exelotl> I just use strings whenever dealing with byte data lol
13:12:35FromDiscord<exelotl> would gladly read an article on how to do it better x)
13:13:19FromDiscord<exelotl> it's only tripped me up once tbh, when writeFile broke on Windows 🙃
13:15:12Zevvexelotl: for a lot of use cases, using strings for byte data can work just fine
13:15:37Zevvyou can also seq[uint8] of signedness is problematic
13:15:38FromDiscord<shadow.> the correct way of matching up to something is like `+1 ...` right?
13:15:50Zevvwhat do you mean with "matching up" ?
13:15:54FromDiscord<shadow.> well rather
13:15:57FromDiscord<shadow.> consuming until something
13:16:11Zevvthat'll go past the finish line. PEG is greedy by default
13:16:16FromDiscord<shadow.> oh damn ok
13:16:20Zevvso +1 will eat everything
13:16:25FromDiscord<shadow.> i see
13:16:30FromDiscord<shadow.> i have to split it into a dif rule then?
13:16:32Zevvif you want to skip until p, you can do a shortcut @p
13:16:35FromDiscord<shadow.> wait nvm
13:16:36FromDiscord<shadow.> ohhh
13:16:38Zevvwhich means "search for p"
13:16:39FromDiscord<shadow.> that is very useful thanks
13:16:54FromDiscord<shadow.> and is there a way to capture with something like that or no
13:17:09PMunch@shadow. are you working on todays AoC?
13:17:12Zevvthe manual says no, there is not. If you want to do that, you need to do it manually
13:17:23Zevvyou can do >(*(1-p)) * p
13:17:41Zevvwhich means "capture a sequence of zero or more things not matching p, and then match p"
13:17:50FromDiscord<shadow.> fair fair thanks
13:22:56*ForumUpdaterBot quit (Remote host closed the connection)
13:23:04*ForumUpdaterBot joined #nim
13:29:23*Vladar joined #nim
13:31:14*narimiran quit (Ping timeout: 256 seconds)
13:32:38*narimiran joined #nim
13:44:30FromDiscord<mratsim> @Zevv, will try to find some info under the hood of C++ coroutines
13:44:45FromDiscord<mratsim> but I guess I should start with your CPS PoC first
13:45:05Zevvif true stackless coroutines are coming to C++, I'd expect a bit more noise about
13:45:14Zevvbecaus that would be a Big Deal, IMHO
13:46:02Zevvwith "stackless" I mean "without complete stack frames". Not the silly useless boost-kind of coroutines
13:47:18planetis[m]Who wants to read a lengthy technical article about ecs? https://gist.github.com/planetis-m/3bcfa093ca0ad3859e6078c956311472
13:47:30planetis[m]comments welcome
13:48:10Zevvcomment: start your very first paragraph with a consise description of what ECS actually *is*
13:48:21ZevvI'm at par 3 and still don't know
13:49:20FromDiscord<sealmove> @PMunch sorry to bother again. Can you take a quick glimpse of new README.rst and tell me if you like it now? I polished the ideas.
13:49:22planetis[m]im doing that with examples do you read the code
13:49:52Zevvplanetis[m]: sure, but if I don't know what an article is about after reading the first few lines, I lose motivation to spend the time to read it
13:50:08Zevvstart with "what is it, and what does it solve"
13:50:44planetis[m]ok i will try to improve but seems strange to me bc i already wrote a paragraph called "what is an ecs"
13:50:46Zevvand you might consider at least explaining what the acronym stands for :)
13:50:52FromDiscord<sealmove> just look at Strings section https://github.com/sealmove/binaryparse#strings and perhaps Substreams.
13:52:27Zevvapart from that, looks good, good examples
13:55:16planetis[m]i added the acronym missed that
13:55:30planetis[m]thanks, Zevv
13:57:36*krux02 quit (Remote host closed the connection)
13:58:58PMunch@sealmove, README looks fine, still not sold on the whole concept of sub-streams though..
14:01:37FromDiscord<mratsim> @Zevv, I think Rust futures are stackless, it's a design tradeoff.
14:05:23*Amun_Ra quit (Quit: Gdyby mi się chciało tak jak mi się nie chce…)
14:05:41FromDiscord<sealmove> @PMunch the main advantage is that reading strings is made transparent. In reality they are always read as null-terminated (except when using assertion or magic sequence).
14:05:58*Amun_Ra joined #nim
14:07:24FromDiscord<sealmove> `'\0'` also means "end of stream", so I think it's neat
14:09:14FromDiscord<mratsim> @planetis↵> I chose an ecommerce store as an example, mainly because everyone has solved math problems with selling goods↵I thought programming problems at school involved employee class and salary property?
14:10:01FromDiscord<sealmove> though it does mean that if you do `s: x(5)` and the substream has a null byte at index 2, the string will terminate earlier
14:10:04FromDiscord<mratsim> also hide that password: array[128, char] :/ field
14:10:52planetis[m]lol okay
14:11:22FromDiscord<sealmove> hmm, why is designing a DSL so hard to make coherent and convenient at the same time? >_<
14:12:25FromDiscord<mratsim> also you need at the end in the summary, a "why so complex" or why so unnatural summary
14:12:42FromDiscord<mratsim> maybe with a remainder of the constraint of 1/60 frame?
14:13:09FromDiscord<sealmove> well, in the case above case, one would use `u8: x[5]`. since assertion works with strings (`s: x = "MAGIC"), I think it's fine.
14:13:27FromDiscord<mratsim> @sealmove, because you need to address domain experts that might have very differing need or impose serious constraints relative to the underlying implementation
14:14:05FromDiscord<mratsim> and if you aren't a domain expert yourself, you will miss some cases that aren't covered
14:14:13planetis[m]we didn't go to the same school unfortunetly (for me)
14:14:29FromDiscord<sealmove> yes, I fell pray to this and PMunch corrected me many times, which is nice
14:14:36FromDiscord<mratsim> for example the neural network DSL for Arraymancer had a glaring hole I realized when implementing one example.
14:15:41FromDiscord<mratsim> also you might want to have a read into the section "Developping extensible shallow embeddings (functions in host lang) on top of deep embeddings (fixed AST/IR): " of my issue https://github.com/mratsim/Arraymancer/issues/347#issuecomment-461009747
14:15:42disbotdiscussion: porting Halide to nim ; snippet at 12https://play.nim-lang.org/#ix=2lSX
14:16:32FromDiscord<mratsim> Basically I was exploring a DSL for array/matrix/tensor computation to cleanly describe A[i, j] matrix operations without polluting your code with for loop
14:16:56FromDiscord<mratsim> and optimizations without polluting the code with vectorization, parallelism and what not.
14:17:29FromDiscord<mratsim> otherwise excellent article, it's much clearer to me @planetis
14:17:58planetis[m]thank :)
14:23:35*L[m] quit (Ping timeout: 268 seconds)
14:23:44*L[m] joined #nim
14:35:45*waleee-cl joined #nim
14:46:24*Q-Master joined #nim
14:49:49FromDiscord<inv> Hello, nimble question: requires "https://github.com/status-im/nim-decimal#master"↵↵But in .nimble\pkgs\Decimal-#master directory I just see two files: decimal.nimble and nimblemeta.json . But I expected code to be there - what is wrong ?
14:50:13FromDiscord<inv> (edit) "Hello, nimble question: requires "https://github.com/status-im/nim-decimal#master"↵↵But in .nimble\pkgs\Decimal-#master directory I just see two files: decimal.nimble and nimblemeta.json . But I expected code to be there ... -" added "also"
14:52:18Zevvmratsim: with 'stackless' you mean 'no locals allowed', right?
14:53:11Zevvwhat's the proper terminology here? There's "one stack per coro", there is "no stack at all" and there is "lifting the stack to the heap" (which is what our CPS) does.
14:53:22Zevv#1 is heavy and requires small stacks or a lot of memory
14:53:34Zevv#2 has usability issues but a trivial implementation
14:53:44Zevv#3 is the most user friendly IMHO, with the tradeoff of memory management
14:54:03ZevvIf you don't want to pay for that, you can choose to use it as in #2 by simply not using any local variables
14:54:03FromDiscord<shadow.> https://play.nim-lang.org/#ix=2Ij1 for anyone doing part two of today's aoc, is there an issue with finding the order of the rules in this logic?
14:56:22PMunchGetting ready to stream my attempt at day 2 :)
14:56:28PMunchday 16*
14:57:05Zevvdid you solve'm all in your sessions?
14:58:22FromDiscord<shadow.> i think he didnt do 13 iirc
14:58:25FromDiscord<shadow.> or maybe it was 10?
14:58:35PMunchI have two part 2's that I haven't solved on stream, but that's been because I've had to go do other stuff and finish them later in the daf
14:58:37PMunchday*
14:58:42FromDiscord<shadow.> ah ye
14:59:00PMunchWell, apart from day 10 when I cheated and looked at narimirans solution :P
15:02:01Zevvdude
15:05:24*habamax quit (Ping timeout: 272 seconds)
15:06:15PMunchZevv, dude?
15:07:20Zevvcheating and stealing
15:09:41FromDiscord<shadow.> wow
15:09:56FromDiscord<shadow.> i can't figure out why my current solution isn't working feelsbadman
15:10:43PMunchStream is ready: https://www.youtube.com/watch?v=TrxyCNdI0bw https://www.twitch.tv/pmunche
15:10:50PMunchZevv, it's open source!
15:11:03Zevvoh yeah, does it have a LICENSE
15:11:24PMunchBut yeah, I had been drinking sparkling wine and watching Norway win and handball, so I wasn't really up for solving puzzles :P
15:12:13FromDiscord<sealmove> the documentation for `genSym` states: "The symbol needs to occur in a declaration context". What exactly does this mean?
15:12:22PMunchnarimiran, stream is up if you want to watch today
15:12:35narimiranPMunch: thanks, i will
15:12:47FromDiscord<sealmove> me too
15:16:06FromDiscord<sealmove> I keep getting this annoying error "Error: internal error: environment misses: :tmp"
15:16:28FromDiscord<sealmove> Someone people teach me how symbols work, lol
15:17:23FromDiscord<sealmove> I am doing some kind of aliasing. I have code with `quote do` which I want to use different symbol depending on conditions
15:20:44*vicfred joined #nim
15:20:50FromDiscord<shadow.> pmunch you checkin twitch chat this time round lol?
15:21:33*Q-Master quit (Ping timeout: 268 seconds)
15:29:08FromDiscord<inv> off: what wm @PMunch uses? looks like dwm, but some icons are there
15:29:27PMunchI'm using i3
15:29:35PMunchWith i3bar
15:29:40PMunchAnd a lot of custom scripts
15:29:42FromDiscord<inv> thx
15:30:03*leorize quit (Ping timeout: 240 seconds)
15:37:43*MarderIII joined #nim
15:41:28*Vladar quit (Quit: Leaving)
15:47:38*leorize joined #nim
15:48:16*fputs joined #nim
15:48:24*aHaquer joined #nim
15:49:13*fputs quit (Client Quit)
15:50:54*fputs joined #nim
15:51:18*Q-Master joined #nim
15:51:27FromDiscord<dom96> Check out the .nimble file: https://github.com/status-im/nim-decimal/blob/master/decimal.nimble↵↵It has `srcDir` set to "src", but the repo has no "src" dir
15:52:05FromDiscord<dom96> @mratsim can you fix the above package?
15:52:06FromDiscord<inv> Yep + I found fork of the package with fix
15:52:21FromDiscord<inv> here it is https://github.com/cerk/nim-decimal/tree/nimbleForNim1.0
15:53:53FromDiscord<inv> isn't @PMunch sound volume too low? checked everything on PC - everything is on max, but stream volume is very low
15:54:10FromDiscord<inv> (edit) "PC" => "PC, music is ok"
15:54:35FromDiscord<inv> Yep, a bit better. thx
15:56:03*fputs quit (Quit: WeeChat 2.9)
15:56:20*fputs joined #nim
16:04:57FromDiscord<mratsim> @dom96 should be fixed now. I used to use "src" but it caused issues due to the src dir disappearing on users installation
16:20:45*leorize[m] quit (Ping timeout: 268 seconds)
16:20:57*leorize[m] joined #nim
16:24:24FromDiscord<inv> Are you about nim-decimal ?
16:24:47FromDiscord<inv> (edit) "Are you about nim-decimal ? ... " added "Because I am using the fork I mentioned, maybe I can switch then"
16:28:52FromDiscord<mratsim> yeah
16:29:15FromDiscord<mratsim> actually if you want to maintain the fork I can update the readme to point to yours, and archive it.
16:29:58FromDiscord<inv> @mratsim nope, I just found there is a PR which do everything
16:30:16FromDiscord<inv> (edit) "everything" => "everything, I mean - probably it would be ok just to merge it"
16:30:31FromDiscord<inv> ah, it is not fork
16:30:39FromDiscord<inv> (edit) "ah, it is not ... fork" added "my"
16:32:10FromDiscord<inv> sent a code paste, see https://play.nim-lang.org/#ix=2Ijv
16:34:06FromDiscord<inv> Yep, just checked in separate package. Is it nim-bug (I think so) or module's one?
16:34:34FromDiscord<shadow.> @PMunch: we're getting 8-15 inches of snow lol so i should probably get a fire setup too
16:34:43FromDiscord<mratsim> pretty sure that's new
16:35:03PMunch@shadow. the annoying part is that I haven't had a fireplace for a while
16:35:11PMunchOr it has been sitting there in the corner, mocking me
16:36:18PMunchBecause the fire marshal said the chimney wasn't up to standard, so had to get that replaced for about €4.6k. Then the guy who installed the new chimney wasn't sure if the wall behind my fireplace was good enough, so he didn't want to connect it
16:36:30FromDiscord<shadow.> damnnn
16:36:33FromDiscord<shadow.> that is quite rough
16:36:41PMunchContacted the fire marshal, they came and looked at it and agreed that it probably wasn't fine
16:37:36PMunchSo after a bunch of back and forth between me and the guy I bought it from, the guy who originally installed the fireplace, and trying to get in touch with the guy who did the chimney I cut through the wall to figure out what it was made out of and what was behind it
16:37:58PMunchTurns out it was all just non-flammable stuff after all, so the fire marshal came by today for a second look and approved it
16:38:09PMunchSo now I just need to mortar it all up and I'm good to go
16:38:21PMunchJust about a year and half without my fireplace..
16:40:11PMunchSo yeah, I'm off to do that now
16:40:14*PMunch quit (Quit: leaving)
16:40:38FromDiscord<inv> beep: https://github.com/nim-lang/Nim/issues/16373
16:40:40disbotgc:arc raises "type bound operation X can be defined only in the same module with its type Y" ; snippet at 12https://play.nim-lang.org/#ix=2Ijz
16:43:49FromDiscord<inv> But, hm ... sorry, I think it is probably the lib problem
16:44:04FromDiscord<inv> (edit) removed "think it is probably the lib problem"
16:53:31*kenran joined #nim
16:53:36*habamax joined #nim
16:55:10*klaufir joined #nim
16:56:47*lritter quit (Quit: Leaving)
16:57:08*L[m] quit (Ping timeout: 268 seconds)
16:57:20*L[m] joined #nim
17:00:00*aHaquer left #nim (#nim)
17:22:26FromDiscord<Clyybber> disruptek: So I tracked it down now
17:24:44FromDiscord<Clyybber> And have two fixes
17:24:58FromDiscord<Clyybber> Araq: Hey, are you there?
17:25:07disruptekclyybber: oh yeah?
17:25:10FromDiscord<shadow.> @PMunch: fixed my day 16 finally lol, switching methods worked
17:25:28FromDiscord<Clyybber> disruptek: The compiler doesn't resem operands if they already have a type
17:26:00FromDiscord<Clyybber> so you can either change that; and it fixes it
17:26:12FromDiscord<Clyybber> or you strip the output of macros of its types
17:26:30FromDiscord<Clyybber> I'm not sure which is better yet.
17:26:37disruptekhmm, maybe that makes more sense.
17:26:58FromDiscord<Clyybber> disruptek: That also explains why fib(x - 1) exhibits the issue but fib(x) doesn't
17:26:58disruptekand maybe we can afford that more easily now due to ic.
17:27:23FromDiscord<Clyybber> Because in fib(x) you overwrite the operand with your ident node which doesn't have a type
17:28:08FromDiscord<Clyybber> disruptek: I can't think of a case where we'd want macros to type our stuff
17:28:13FromDiscord<Clyybber> other than to confuse the compiler :D
17:28:33FromDiscord<Clyybber> typing seems like it should be the compilers job
17:28:47disruptekwell, what i hear you saying is that we just cannot afford to trust macros, which i agree with.
17:28:56FromDiscord<Clyybber> yeah
17:30:37disruptekso would we resym everything, always?
17:31:03disruptekbecause that sounds bad. 😁
17:31:48disruptekmaybe it makes the most sense though, from the "what i see in my editor is what i want" perspective.
17:33:24FromDiscord<Clyybber> disruptek: macro results already get all their nfSem stripped
17:33:43FromDiscord<Clyybber> so the intention to always resem their output is already there
17:35:48disruptekthen so we don't need the resym pass in macro code.
17:36:55FromDiscord<Clyybber> wdym?
17:37:24disruptekwe have this sym->ident pattern in macro code now but it shouldn't exist.
17:37:49FromDiscord<Clyybber> no thats not the issue
17:38:04FromDiscord<Clyybber> the underlying issue is more general
17:38:16disrupteki know, but this is something that helps ergonomics.
17:38:22FromDiscord<Clyybber> the compiler trusts .typ fields in a lot of places
17:38:46FromDiscord<Clyybber> but we can't trust them for macro output
17:40:55disrupteklet me ask you this: is macro output untyped? is it typed?
17:41:05disrupteklike, in your ideal world.
17:44:48FromDiscord<Clyybber> disruptek: Are you not in telegram anymore?
17:47:01FromDiscord<Daniel> discord is the easiest, its on web(in browser), on android, on iphone, on desktop...everyhwere
17:47:12*haxscramper joined #nim
17:47:21haxscramperOn C++ enum again - do you have any suggestions for wrapping enums with holes so that they could be used in bitsets? It is quite common to see patterns like `enum Flags { flag1 = (1 << 0), flag2 = (1 << 1), ... flagn = (1 << n) };` which would be really nice to also automatically wrap in a way that would be usable for `set[T]` types.
17:47:36FromDiscord<Clyybber> @Daniel and so is telegram :p
17:48:09haxscramperI found out you can automatically fill holes for wrapped enums to use in `set[enum]`, but for cases like `(1 << 12)` this is not a feasible solution
17:48:23leorizehaxscramper: set[T] only supports ordinals and enums with holes are not ordinals :P
17:48:28haxscramperI know it
17:48:37haxscrampersay it to C++ shit that doesn't knwo
17:49:04haxscramperI mean I need to somehow meld these two together, so people using C wrapers won't have to do bitshits all the time
17:49:13haxscramperbitshift*
17:49:26haxscramperThis is the problem actually
17:49:53leorizehaxscramper: for (1 << x) enums, if they're sequential and non-duplicating, just map them into a normal enum :P
17:50:04leorizelike enum without any value whatsoever
17:50:14leorizethen add `{.size: sizeof(cint).}`
17:50:16FromDiscord<Clyybber> leorize: Regarding your reply on telegram; this is not about the spec of typed ast itself, but more about wether to trust macro output or not
17:50:46leorizethe sets coming from them should be the same as or-ing the flags
17:50:46FromDiscord<Clyybber> (replying here because I don't want to drown the telegram channel)
17:50:57haxscramperleorize: and this would allow to use them in sets, or some additional workarounds are necessary?
17:50:57disrupteki have nothing to contribute to telegram.
17:51:17FromDiscord<Avatarfighter> :disruptek:
17:51:52FromDiscord<Clyybber> disruptek: its much easier to discuss important things there
17:52:15disruptekhow?
17:52:20FromDiscord<Clyybber> because people actually read it
17:52:21leorizehaxscramper: see https://nim-lang.org/docs/manual.html#set-type-bit-fields
17:53:10FromDiscord<Clyybber> disruptek: Only you are here currently; on telegram everyone will see it eventually
17:53:11disruptekmake an issue in compilerdev; then it's less noisy.
17:53:11leorizeI would consider using a wrapping enum tbh, less surprising to the user
17:54:18haxscramperYou mean declare proxy enum that would be converted to underlying C one only on interfacing, and duplicate all API to work with proxy?
17:55:26leorizeyea, something like that
17:56:15haxscramperYes, I could probably take this apporach in the end, for cases where authors went completely crazy and had mixed `<<` enums and regular values
17:57:11haxscramperThough `sizeof(cint)`/filling holes should cover majority of the edge cases
17:57:33leorizefilling holes is kinda dangerous
17:57:57haxscramperYes, it can create invalid values if you mean that
17:58:07haxscramperI'm thinking about how to work around this
17:58:16*lritter joined #nim
17:59:24leorizemaybe take a look at timothee enummap?
18:01:02leorizehttps://github.com/nim-lang/fusion/pull/23
18:01:04disbotAdd `enummaps` module to attach metadata to enums; as a special case, it replaces enum with holes
18:02:11*^Q-Master^ joined #nim
18:02:57*Q-Master quit (Read error: Connection reset by peer)
18:03:51FromDiscord<Daniel> @Clyybber not the same, telegram requires phone number
18:04:34*hnOsmium0001 joined #nim
18:08:12*regreg joined #nim
18:18:41haxscramperleorize: Yes, it does look pretty good, I should probably use this approach for wrappers. Wrap C enum as-is - with holes and everything, and introduce proxy that would be used in the actual API. Make overloads for all for all procs that either (1) accept enum directly, or (2) have argument marked as `bitset-on-enum`. For first type just map nim enum to corresponding C one via mapping table and pass it to implementation. For second it
18:18:41haxscramperwould additionally do bitor on values before passing them
18:19:51haxscramperThis would provide nim-style interface for enum without holes. If someone needs to use underlying value I can introduce helper functions for mapping to integers etc.
18:21:04haxscramperAnd duplicate C enum values would be mapped to `const enDuplicate = enOriginal` to make case matching work as expected.
18:29:54leorize[m]stringification would be weird for them but is an acceptable tradeoff
18:33:10haxscramperNim enum will have regular stringification, and for C I could use namespaced value? Like `struct S { enum E { Val }; };` is stringified as `S::E::Val`.
18:33:52haxscramperThough stringification for C should probably be implemented as `toString` *proc* so one could roll own implementation if needed
18:34:07haxscramperFor cases where original C library also provides stringification (like libclang does for example)
18:34:44disruptekeh `$` vs. toString.
18:34:58haxscramperYes, it is explictly verbose
18:35:14disruptekexplicitly noisy.
18:35:21haxscramper*if* you want you can do ``proc `$`(e: Enum): string = toString(e)``
18:35:44disruptekwhy would i want that?
18:36:01disruptektoString will produce the C++ version?
18:36:02haxscramperOn the other hand - locally defined procs shadow declaration from imported modules AFAIK, so I can probably do `$` by default them
18:36:15haxscramperdisruptek: yes, `toString` will produce C++ version
18:36:53disruptekit won't hurt to impl toString but i will always want `$` to do the obvious thing.
18:37:11haxscramperOh, actually this is all rubbish, because I get `$` for enum anyway by default, so implementing overload for `$`
18:37:24haxscramperIs what one should do by default
18:37:28disruptekyes.
18:37:32leorize[m]it's rather trivial to replace a `$` proc
19:05:19*regreg quit (Ping timeout: 272 seconds)
19:27:34*hmmm joined #nim
19:30:09hmmmdudes whats the idea of memoizing a recursive algorithm
19:30:47hmmmI mean the idea is to do less calculations by storing results?
19:34:23ozyes
19:34:42hmmmhmmm
19:42:37disruptekusername checks out.
19:43:07ozyes
19:43:55hmmmdudes I hate frigging recursion my head is exploding
19:46:47FromGitter<timotheecour> @leorize @haxscramper ⏎ ⏎ > filling holes is kinda dangerous ⏎ > Yes, it can create invalid values if you mean that; I'm thinking about how to work around this ⏎ ... [https://gitter.im/nim-lang/Nim?at=5fda64276c2aad27540ab79a]
19:47:22leorizeyes, I already linked your enummaps to them right after
19:48:09leorizeplease make it into a nimble package
19:49:26FromGitter<timotheecour> I can; the main downside is preventing its use in stdlib/compiler code, which could benefit from it in many places
19:50:02leorize"perfect is the enemy of good" -- 4raq
19:50:33hmmm"recursion is the evil of the world" -- hmmm
19:51:24FromGitter<timotheecour> `s/I can /I will/` and hopefully can be moved to stdlib in future
19:52:28FromDiscord<dom96> TIL Araq is Voltaire
19:55:16leorizeI heard it from him first so I just quote it like that :P
19:55:23FromGitter<haxscramper> @timotheecour proxy enum for C++ wrappers is probably the best approach. Might be a bit fragile, but if peopl don't touch `_IMPL_DONT_TOUCH` things it shoudl be fine
19:55:55hmmmwat, python has an inbuild decorator thingy to automemoize stuff
19:56:05hmmmdo we have something like that?
19:57:22FromDiscord<haxscramper> Just remember all your function calls, and then hide inside the computer
19:57:28FromDiscord<haxscramper> And return answers
19:57:36hmmm:O
19:57:44FromDiscord<haxscramper> On the more serious size - no we don't have this in stdlib/fustion AFAIK
19:58:11hmmmdisruptek build it and ship it to stdlib
19:58:16hmmmyou have 5 minutes
19:58:23FromDiscord<haxscramper> But you could probably implement this even without macros or procs, just with higher-order function that does memoization
19:58:37FromDiscord<haxscramper> Like this `aux` thing
19:58:51hmmmye actually doing it auto defeats the purpose since it's educational stuff anyway
20:03:42*hmmm quit (Ping timeout: 272 seconds)
20:03:50*hmmm joined #nim
20:04:20FromDiscord<shadow.> hmm why do you hate recursion?
20:04:25FromDiscord<shadow.> what are you workin on
20:04:38*leorize quit (Quit: WeeChat 2.9)
20:04:50FromDiscord<haxscramper> ~recursion
20:04:51disbotno footnotes for `recursion`. 🙁
20:05:02FromDiscord<shadow.> lol
20:05:13FromDiscord<haxscramper> I want to add `"recursion is the evil of the world" -- hmmm` quote
20:05:28FromDiscord<shadow.> eh recursion isn't that bad
20:05:32FromDiscord<haxscramper> Probably shouldn't do this though
20:05:40FromDiscord<shadow.> i typically prefer a breadth-first approach but yk
20:05:40FromDiscord<shadow.> ymmv
20:07:11FromDiscord<haxscramper> Yeah, but then you get trees everywhere and stracktrace reports exception in 20th layer of nested calls on missing subnode, and you are starting to wonder if you made correct life choices and maybe it was a better idea to try gamedev
20:08:18FromDiscord<nikki> ~recursion is see ~recursion
20:08:18disbotrecursion: 11see ~recursion
20:08:41hmmmI can't wrap my stupid head around the memoizating stuff. Recurstion starts at the end and goes to the base case so wtf am I storing since I have to calculate all the stuff till the base case :O
20:09:23FromDiscord<nikki> hmmm it's if u reuse some result again in a different branch
20:09:23FromDiscord<haxscramper> Actually memoization is not directly related to recursion
20:09:53FromDiscord<nikki> but yeah recursion is just recursion, you don't need to memoize to recurse
20:10:10hmmmyea but it's slow as my grandpa while memoizing stuff make it fast right?
20:10:14FromDiscord<haxscramper> This is basically `var cache: Table[ArgType, ResType]` and `proc impl(a: ArgType): ResType ... if a in cache: return cache[a]`
20:10:16FromDiscord<nikki> recursion is a good succinct description of an algo in many cases for shallow trees
20:10:36FromDiscord<haxscramper> Otherwise do `cache[a] = <expensive computations>` + `return cache[a]`
20:10:40FromDiscord<nikki> i usually do recursion with a visited map, and no it's a dfs and just linear time then
20:11:13FromDiscord<nikki> reverse postorder dfs is topsort which is v useful
20:11:49*leorize joined #nim
20:11:54FromDiscord<pietroppeter> @hmmmm there is in fact a package for memoization (with a pragma similar to python decorator): https://github.com/andreaferretti/memo
20:12:02FromDiscord<dom96> hmmm: depends what you're doing, memoization and recursion doesn't always go together
20:12:41FromDiscord<nikki> recursion is just the calling of a function from itself, including transitively
20:19:32*tane joined #nim
20:20:01*narimiran quit (Ping timeout: 268 seconds)
20:29:39*mbomba joined #nim
20:32:27FromDiscord<bark> if I wanted to have the same function body, but 2 different parameter kinds based on a const, how would I do that in nim?
20:33:10leorizeeither generics or templates I suppose?
20:33:29FromDiscord<lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2IkZ
20:33:30leorizean example of what you're trying to do would help though
20:34:06*fanta1 quit (Remote host closed the connection)
20:34:15FromDiscord<bark> sent a code paste, see https://play.nim-lang.org/#ix=2Il0
20:34:31FromDiscord<lqdev> do what i did
20:34:36FromDiscord<bark> yeah and add placeholder type
20:34:36FromDiscord<lqdev> you can make your type `void`
20:34:50FromDiscord<bark> I don't have to pass void?
20:34:54FromDiscord<lqdev> yeah
20:34:57FromDiscord<bark> nice
20:34:58FromDiscord<bark> thanks
20:34:58FromDiscord<lqdev> it acts as if it weren't there
20:35:10leorizeif it doesn't have argument then just make it an overload?
20:35:43FromDiscord<bark> I want to keep the same body
20:36:12leorizewell the x parameter won't go away, right?
20:37:06leorize`proc a() = a(some predefined x?)`
20:37:18leorizebut without seeing some actual code I can't advise too much
20:40:49hmmmnikki u frigging genius
20:40:55hmmmI just understood the branch part
20:41:11hmmm<3
20:41:59hmmmit's actually very clever
20:45:49*habamax quit (Ping timeout: 264 seconds)
20:49:04FromDiscord<bloatoo> sent a long message, see http://ix.io/2Il8
20:53:41hmmmhmm 13yo is a bit early to consider the business perspective my bro, in your shoes I would consider just having fun with python and see where it leads u :>
20:54:03FromDiscord<kenran> or having fun with nim
20:54:03FromDiscord<InventorMatt> nim is a wonderful language that is growing in popularity currently and there are jobs already that exist that require nim and it is likely that there will be more within the next decade or so when you'll get need a full time job. but outside of learning nim it will help you to learn other languages better so if you do need to learn another language it should be significantly easier
20:54:30hmmmor having fun with nim like me :3
20:54:32leorizeyea, 13yo is basically the "have fun" period
20:54:48FromDiscord<mratsim> Also what you learn with Nim is applicable to C, C++, Rust directly and also will teach you more about the low-level details which might help you deal with slowness with higher level language.
20:54:55leorizeand once you got the basics down picking up other languages is really easy
20:55:04leorizemost of them are pretty much the same thing
20:55:16FromDiscord<haxscramper> C++ in production is very depressing language imo, and "as a language" it also not really good
20:55:25FromDiscord<mratsim> Have fun and be sure that whatever happens, the knowledge transfers
20:55:40FromDiscord<haxscramper> Certainly not for starting language
20:56:05FromDiscord<haxscramper> Nim is a very good language to try out all different concepts - FP, OOP etc.
20:56:51FromDiscord<exelotl> C++ was my first language, and every language I've tried since, I've enjoyed more (including C)
20:56:53FromDiscord<mratsim> FP not so much, the closure iterators are a bit clunky, the function callbacks are noisy with {.gcsafe.} annotation and the inline iterators don't chain.
20:57:18FromDiscord<haxscramper> In whatever proportions you feel is interesting and then decide if particular programming paradigm suits you or not. C++/rust have very strong ideology about what should and should not be used (in C++ is it more blurred though)
20:57:23FromDiscord<mratsim> I did enjoy haskell as my first language butmaybe it's because I enjoy mindsplosion
20:58:02FromDiscord<haxscramper> Well, to me this is actually that perfect amount of FP when you still have your brains intact without worrying about recursion-as-loops
20:59:14FromDiscord<haxscramper> But can still enjoy maps/folds/options etc. Though I'm just callback-crazy, not really FP person
20:59:45leorizeI found dabbling a bit into Haskell is a nice way to learn all the crazy FP stuff
21:00:06leorizeyou should definitely not do everything the Haskell way but pick the right tool for the job :P
21:00:18FromDiscord<haxscramper> Every time I tried to do something with haskell I got destroyed by `cabal hell` out of nowhere. Ocaml is nice
21:00:24FromDiscord<kenran> recursion-as-loops is in your blood after a short while IME, and nowadays I enjoy the abstraction mechnisms haskell gives me with higher-kinded types and the like, and I already start missing them in other languages. but I still don't know anything about low-level stuff and algorithmic performance
21:00:40FromDiscord<kenran> in haskell, that's just a totally different beast with laziness
21:01:50FromDiscord<haxscramper> Well, like ... yes ..., but I'd prefer to be able to fallback to imperative algorithms when needed. But again - majority of the FP-ness that make your daily life easier is already present in nim or can be implemented in theory
21:01:55FromDiscord<mratsim> I didn't need cabal or packages when i started, I just played around with prelude
21:02:13FromDiscord<kenran> the cabal `v2-` commands (that are now the default) make it much better nowadays. we use `nix` at work to manage the haskell deps, and while it's still a hassle sometimes, it's been a long while since I've been in cabal hell 😄
21:02:32FromDiscord<haxscramper> Maybe I should try haskell again
21:02:37FromDiscord<kenran> yeah, I'm just not yet sure how to test my low-level code in nim 🙂
21:02:50FromDiscord<mratsim> I don't know how to read my Haskell code anymore xD
21:03:02*nyd joined #nim
21:03:44FromDiscord<haxscramper> The one thing I really don't like is type global type inference
21:03:52*MarderIII quit (Ping timeout: 260 seconds)
21:04:00FromDiscord<kenran> right now I love learning Nim (and common lisp), since I haven't studied CS at all but now work with FP. I studied maths, so FP came more naturally I guess, and even though Nim is not C++, it's still a challenge to learn the concepts 🙂
21:04:08FromDiscord<haxscramper> and people omitting type annotations
21:04:35FromDiscord<mratsim> One thing that is fun with Haskell is code obfuscation.↵Watch unobfuscated: https://github.com/mratsim/haskell-numbertheory/blob/master/expmod_2.hs#L6-L12↵obfuscated: https://github.com/mratsim/haskell-numbertheory/blob/master/expmod_1.hs#L7-L11
21:04:40FromDiscord<kenran> that put me off OCaml first. in production haskell at least it's standard now to use them thankfully
21:04:42FromDiscord<haxscramper> Because we are now basically in python-level of code readability now
21:05:37FromDiscord<kenran> haha, great stuff 😄
21:06:09FromDiscord<kenran> a colleague of mine writes all his code this way (point-free style and no let-bindings) and there it gets kind of annoying quickly
21:06:35FromDiscord<Zeus> after working on a lot of clojure, it feels more natural to read the second one rather than the first
21:07:04FromDiscord<haxscramper> I wanted to write lisp -> nim ast transpiler once
21:07:08leorize@kenran we can abstract away low-level computer stuff but in the end they are still important for achieving good performance
21:07:57FromDiscord<mratsim> Yeah, I did a lot of prime sieves optimization in Haskell, but a simple bitset in Nim brought me 2x speed when I tried Nim the first time
21:09:20FromDiscord<kenran> we had a space leak at some point that cost us weeks to debug in Haskell. you'd send 10 MB of json, then throw a heavy data pipeline algorithm at it, and it would blow up the memory to 1.6 GB. in the end, it was the json parsing paired with laziness instead of the algorithm itself. but it was just so hard to find
21:09:48FromDiscord<kenran> (edit) "pipeline" => "transformation"
21:10:03FromDiscord<bloatoo> sent a long message, see http://ix.io/2Ili
21:11:22leorizeyou can't predict the future in computer science
21:11:25FromDiscord<shadow.> as someone around the same age (14), id say try learning nim
21:11:35FromDiscord<shadow.> it really didn't take me very long to get it down well (around a month) and i love using it
21:11:41FromDiscord<shadow.> great for low level and high level programming
21:12:09FromDiscord<shadow.> it really has no downfalls in my opinion, and it's a great tool to have in the future
21:12:34FromDiscord<mratsim> > it really has no downfalls in my opinion↵You're in nim channel so you'll get rose colored views 😉
21:12:40FromDiscord<shadow.> that is quite true
21:12:51FromDiscord<shadow.> i mean if you want the otherside you could go to the rst server but i don't recommend it
21:12:52FromDiscord<shadow.> lmfao
21:12:55FromDiscord<Quibono> No goroutines.
21:12:57FromDiscord<shadow.> (edit) "otherside" => "other side"
21:12:59FromDiscord<Quibono> That’s the biggest issue
21:13:01FromDiscord<mratsim> the real issue with Nim is the library ecosystem, so if you want to achieve something you might have no support and have to do it all yourself.
21:13:07FromDiscord<shadow.> yeah that's true
21:13:07FromDiscord<Quibono> That too
21:13:11FromDiscord<shadow.> depends what kinda stuff you do
21:13:14FromDiscord<haxscramper> Well, if we take pure potential then I'd say nim absolutely destroys everything else. The ecosystem might not seem that big, but sheer flexibility of the language makes it usable for anything
21:13:29FromDiscord<shadow.> i do mostly algorithms for stuff like codewars, leetcode, etc and the stl handles that stuff very well
21:13:31FromDiscord<mratsim> sometimes it may feel like you're the only one dealing with some problems.
21:13:42FromDiscord<shadow.> but for some other stuff the eco is probably lacking, yes
21:13:44FromDiscord<haxscramper> And byt anything I mean really anything modulo some things that I've never touched
21:13:49FromDiscord<shadow.> true
21:14:04FromDiscord<mratsim> but it's also a chance to solve something were people will not ask "why don't you contribute your code yo library x y z"
21:14:06FromDiscord<shadow.> also if you haven't tried metaprogramming before, nim is really good for getting you in that mindset
21:14:20FromDiscord<bloatoo> why isn't nim used widely? i could assume it's probably that it's a really new, immature language
21:14:33leorizefun fact: nim is older than go and rust
21:14:36FromDiscord<mratsim> new, and not backed by a known big corporation.
21:14:39FromDiscord<Quibono> It’s really new and people are creatures of habit.
21:14:49FromDiscord<haxscramper> And nim is probably the only language that can take EEE approach on C++
21:14:55FromDiscord<mratsim> People use and learn by imitation 😉
21:14:56FromDiscord<haxscramper> Instead of trying to replace it with everyhting
21:14:59FromDiscord<Quibono> Yeah like I feel like the only person currently working on financial stuff in Nim
21:15:24FromDiscord<mratsim> not quite, there is qqdev who is a HK trader that has nim libraries
21:15:28FromDiscord<kenran> it's probably just not on many radars (due to the things mentioned above)
21:15:29FromDiscord<bloatoo> it really has potential to become my scripting language of choice
21:15:35FromDiscord<mratsim> and one of the Nim core contributor is an energy trader.
21:15:36FromDiscord<bloatoo> (edit) "it" => "nim"
21:15:54FromDiscord<bloatoo> and then i could use rust for in specific lower level development
21:15:59FromDiscord<haxscramper> Well, at least I'm really hoping that whatewher I'm currently doing will lead to this eventually
21:16:09FromDiscord<mratsim> I would love to build more financial stuff in Nim but I have my hands full with cryptography, multithreading and machine learning already.
21:16:13FromDiscord<Quibono> Bloatoo why use rust for something Nim can do better?
21:16:31FromDiscord<shadow.> if you need inspiration for how easy and elegant nim is then take a look at any aoc repo. it's almost always most concise in nim or python
21:16:35FromDiscord<shadow.> and i'll let you guess which one is faster 😉
21:16:43FromDiscord<shadow.> lol
21:17:20FromDiscord<shadow.> and honestly yeah i agree with the scripting thing. it's pretty hard to think of another language that is so versatile it can be used for systems programming and scripting both just as easily
21:17:42leorizenim ecosystem is horrible for making use of operating system services atm (ie. subprocess, piping, etc.) due to the lack of high-level abstractions for those
21:17:48FromDiscord<kenran> probably common lisp can as well, given enough experience. it's just even more obscure 😄
21:17:59FromDiscord<inv> Looks like I missed Rust-discussion 😦
21:18:02leorizeI'm planning to solve that one but I lost all of my work recently...
21:18:20FromDiscord<shadow.> ah damn that sucks
21:18:39FromDiscord<kenran> leorize coming from Haskell, I am really missing some high-level abstractions, yes. sorry you lost your stuff
21:19:07FromDiscord<mratsim> for system, it would be nice if --gc:arc DLLs don't need that "NimMain()" call at start.
21:19:10FromDiscord<bloatoo> i look at a language from a wider view. i think nim as a language outdoes rust in most ways, but there's that small bit of businessman in me that always asks me "what is this language? why have i not heard of it before?" rust doesn't seem to be used that widely in companies either but it's another language that truly has potential of being used.
21:19:30FromDiscord<shadow.> well
21:19:35FromDiscord<shadow.> you're 13, you have time to learn both
21:19:38FromDiscord<mratsim> @kenran, if you want Monads and friends use concepts: https://github.com/unicredit/emmy#algebraic-structures
21:19:49FromDiscord<shadow.> it's not going to ruin your life to try nim for a month or so to see if you like it
21:20:10leorize@mratsim they don't, but we still have to put initializers (of other modules) somewhere. maybe write an rfc for renaming `NimMain()`?
21:20:13FromDiscord<mratsim> and you can even have dependent types
21:20:20FromDiscord<shadow.> is there a way to do `lines(string)` with js backend (node)? i'm getting `fopen` not defined (for obvious reasons lmao)
21:20:28leorizean option to rename NimMain()*
21:20:33FromDiscord<kenran> whaaaaaaaat
21:20:58FromDiscord<bloatoo> true that. perhaps i'll give nim a try at first, see if i like it, and if so, go further at learning it. after i've become fluent at it i'd start learning rust.
21:21:02FromDiscord<inv> Ah, answer is easy for me because I have a big project on rust for ~2 years. It is better to know both. Rust provides good conception, if you do not care about time and care too much about gc - use rust, else - use Nim
21:21:13FromDiscord<bloatoo> i'll do that. thanks for your input guys.
21:21:20FromDiscord<shadow.> course
21:21:46FromDiscord<mratsim> use AOC for learning, that should give you a good view of Nim
21:21:51FromDiscord<mratsim> and plenty of help in the forum
21:21:55FromDiscord<inv> Probably I can add: what I did in rust for ~1year, I rewrote in Nim for ~2-3 weeks
21:22:09FromDiscord<inv> (edit) "what" => "that"
21:22:18FromDiscord<inv> (edit) "~1year," => "~1year period,"
21:22:47FromDiscord<inv> (edit) "weeks" => "weeks. Funny fact - some parts are even faster in Nim"
21:22:55FromDiscord<inv> (edit) "Funny" => "Fun"
21:22:58FromDiscord<shadow.> yup, aoc is very fun lol
21:23:14FromDiscord<shadow.> i didnt know about scanf or npeg before, so i've at least learned a good bit abt parsing
21:23:33FromDiscord<kenran> why does that link to `concepts` not lead anywhere in the manual? I didn't learn much of Nim's language features yet, but I cannot find that in the manual
21:23:44leorizeit's in the experimental module
21:23:48leorizemanual*
21:23:54leorizean is pending a rewrite
21:23:57leorizeand*
21:24:33FromDiscord<kenran> but is it "bound to stay"?
21:24:50FromDiscord<kenran> that bumps up my willingness to learn more in Nim by a whole lot 😄
21:25:23leorizeyes, concepts will eventually evolve into stable
21:25:44leorizejust that the main dev @zah is no longer active in the compiler
21:25:50FromDiscord<inv> (edit) Probably I can add: that I did in rust for ~1year period, I rewrote on Nim in ~2-3 weeks. Fun fact - some parts are even faster in Nim
21:25:54leorizeso 4raq now has to work on it
21:26:02leorizeand he's busy with other stuff
21:27:40FromDiscord<shadow.> can you do io with the js backend in node mode? (sry haven't used it before)
21:27:43FromDiscord<shadow.> file io
21:28:33leorizenope, we don't officially support node as a target
21:28:41FromDiscord<shadow.> damn
21:28:46FromDiscord<shadow.> is there any way to read from local files?
21:28:52leorizeimport jsffi
21:28:55leorizeit has `requires()`
21:28:59leorizethen you can use node stuff
21:29:03FromDiscord<shadow.> ohh bet
21:29:50FromDiscord<shadow.> hmm
21:30:07FromDiscord<shadow.> so i'd need a way to read file using node functions with ffi and get that as a string in my nim code?
21:30:36FromDiscord<mratsim> @kenran, as an example of dependent types, I parametrize elliptic curves by an enum name, and I also parse and compute their value at compile-time: https://github.com/mratsim/constantine/blob/master/constantine/config/curves_declaration.nim#L45-L68
21:31:17FromDiscord<mratsim> https://github.com/mratsim/constantine/blob/master/constantine/elliptic/ec_shortweierstrass_affine.nim#L23-L33
21:31:19leorizeshadow.: `let fs = requires("fs"); let content = fs.readFileSync().to(cstring)`
21:31:26leorizenative js string is mapped to cstring
21:31:54FromDiscord<shadow.> oh thanks
21:32:31FromDiscord<mratsim> I actually think there is no language that come close to Nim to work on big integer, finite fields, elliptic curve and cryptography
21:33:07FromDiscord<mratsim> as a bonus you can also use unicode variable name to annoy the hell out of potential contributors: https://github.com/mratsim/constantine/blob/master/constantine/tower_field_extensions/tower_instantiation.nim#L27-L32
21:34:21*leorize quit (Remote host closed the connection)
21:34:35FromDiscord<shadow.> `TypeError: c_1475079.charCodeAt is not a function`
21:34:36FromDiscord<shadow.> rip
21:35:02FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Ilr
21:35:07*leorize joined #nim
21:35:10FromDiscord<kenran> seeing this, I can believe it!
21:35:20FromDiscord<kenran> this looks awesome, though I understand very little
21:36:02FromDiscord<shadow.> nvm got it to work
21:37:44FromDiscord<mratsim> Basically I'm implementing complex number but for big ints.
21:37:50FromDiscord<mratsim> so a + ib
21:38:11FromDiscord<mratsim> and modulo a prime.
21:38:33FromDiscord<mratsim> between 254 bits and the recent I added was 761
21:39:06FromDiscord<mratsim> sometimes i is not sqrt(-1), but sqrt(-2) or sqrt(-5), so genericity helps as well i can't specialize too much.
21:39:40FromDiscord<mratsim> So Nim helps me translate high-level might concepts. But also special-case some things for efficiency
21:40:29FromDiscord<kenran> yeah, you could probably do the first part in the high-abstraction languages like idris or haskell (with types), but the second part would be hard to impossible
21:40:38FromDiscord<mratsim> and when I need raw performance I can drop down to assembly: https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/assembly/limbs_asm_x86.nim#L140-L149↵That will be compiled in the same step and type checked.
21:41:23*leorize quit (Ping timeout: 240 seconds)
21:42:05FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Ilv
21:42:13FromDiscord<shadow.> what part would be problematic?
21:43:01FromDiscord<mratsim> and you can have corecursive concepts: https://github.com/mratsim/constantine/blob/master/constantine/tower_field_extensions/tower_common.nim#L26-L39↵↵complex is an quadratic (degree 2) extension of real numbers. In modular arithmetic you can build degree 3 extensions a + jb + j²c (cubic) and you can stack them doing quadratic of cubic of quadratic. Which is used in cryptography.
21:43:29FromDiscord<mratsim> In C, C++, Rust and Go the other libraries need to write the code for each
21:43:50FromDiscord<mratsim> but some proposition needs to stack 10 times.
21:44:04FromDiscord<mratsim> In Nim everything is autogenerated from the concept implementation.
21:57:03*leorize joined #nim
22:02:08*hmmm quit ()
22:07:00*haxscramper quit (Remote host closed the connection)
22:12:38FromDiscord<Recruit_main707> why arent strings just `seq[char]`? that would make things easier wouldnt it?
22:14:37leorizestrings has a nul at the end for c interfacing, and a "statically allocated" state which differs them from seq[char] atm
22:15:34*mbomba quit (Quit: WeeChat 3.0)
22:19:08*kenran quit (Quit: leaving)
22:19:26FromDiscord<Recruit_main707> ok, interesting
22:19:35FromDiscord<shadow.> can i not use `algorithm` sort with js backend?
22:19:49FromDiscord<shadow.> > throw new Error(cbuf_1440201);↵> Error: Error: unhandled exception: key not found: g [KeyError]
22:19:59FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IlN
22:20:58FromDiscord<shadow.> nvm i figured out the issue
22:59:52*tane quit (Quit: Leaving)
23:00:44*vsantana joined #nim
23:10:02Zoom[m]How can I convert a set of 1 into a value?
23:10:22FromDiscord<Quibono> So we have data frames yet?
23:10:25FromDiscord<Quibono> do
23:11:34disrupteksure.
23:13:20FromDiscord<Avatarfighter> @mratsim your snippet where you have assembly is really cool
23:13:48FromDiscord<Quibono> Lol sure is very helpful.
23:14:47FromDiscord<Avatarfighter> @Quibono thats disruptek for ya
23:14:50FromDiscord<Avatarfighter> :disruptek:
23:14:54FromDiscord<Quibono> Lol
23:15:45mipriZoom[m]: for x in it: return x
23:16:14FromDiscord<InventorMatt> ggplotnim has dataframes as well as nimdata and probably others as well
23:18:34FromDiscord<Quibono> Cool
23:22:20Zoom[m]Huh, thanks mipri. Makes sense that it works.
23:23:01FromGitter<deech> Mistakenly naming some module in your library the same as a stdlib one is a fun bug hunt
23:24:33mipriwith new modules that can't be imported without a std/ prefix, like std/enumerate, there's some nudging away from that
23:32:28disrupteklazy questions beget lazy answers.
23:33:40*casaca quit (Remote host closed the connection)
23:34:54*nyd quit (Ping timeout: 256 seconds)
23:57:25*casaca joined #nim