00:02:07 | disruptek | quibono: did you look at openapi? |
00:02:11 | disruptek | !repo openapi |
00:02:12 | disbot | https://github.com/disruptek/openapi -- 9openapi: 11OpenAPI Code Generator for Nim 15 35β 2π΄ 7& 5 more... |
00:02:57 | FromDiscord | <Quibono> No I didnβt. |
00:05:47 | disruptek | i'm taking donations for a xmas gift for our bdfl. |
00:06:58 | FromDiscord | <Beckingham> yeah so that document tag is hardcoded into the htmlparser package |
00:07:02 | FromDiscord | <Rebel> bdfl? |
00:07:09 | FromDiscord | <Beckingham> benevolent dictator for life |
00:07:34 | FromDiscord | <Rebel> oh |
00:07:46 | FromDiscord | <Rebel> you would probably share the same fate as Mussolini π
|
00:08:04 | FromDiscord | <Beckingham> @Araq I hope you're reading this ^ |
00:08:05 | FromDiscord | <Beckingham> Haha |
00:08:30 | FromDiscord | <Beckingham> yeah so how are you supposed to use that htmlparser library if it sticks <document> into everything it parses? |
00:09:35 | FromDiscord | <Rebel> huh |
00:09:37 | FromDiscord | <Rebel> that's a yikes |
00:09:41 | FromDiscord | <Rebel> could always go for plan B |
00:09:44 | FromDiscord | <Rebel> and use fancy regex |
00:10:16 | disruptek | i dunno, that tropico guy has been around for years. |
00:10:29 | disruptek | some people can make it work. others are trumps. |
00:11:51 | FromDiscord | <Beckingham> I am a trump then |
00:38:33 | * | Jesin quit (Quit: Leaving) |
00:40:11 | * | Jesin joined #nim |
00:44:01 | * | Jjp137_ quit (Read error: Connection reset by peer) |
00:46:20 | FromDiscord | <19> is it possible to call a function defined in module A from module B without importing A into B? |
00:46:30 | * | leorize quit (Remote host closed the connection) |
00:47:13 | * | leorize joined #nim |
00:47:20 | FromDiscord | <Revenant> yo |
00:48:03 | FromDiscord | <Quibono> Lo? |
00:48:05 | FromDiscord | <Revenant> i've been searching for a json library this morning that can serialize/deserialize arbitraty objects with the possibility of defining your own custom serializers for certain types |
00:48:25 | FromDiscord | <Revenant> but couldn't really find any, any suggestions? |
00:48:35 | FromDiscord | <Revenant> this came close, but it cannot deserialize... |
00:48:36 | FromDiscord | <Revenant> https://github.com/disruptek/jason |
00:49:33 | disruptek | use planetis[m]'s library; it should absorb jason eventually (or vice-versa if he's too lazy). |
00:50:21 | disruptek | !repo neminim |
00:50:21 | disruptek | !repo niminem |
00:50:22 | disbot | no results π’ |
00:50:22 | disbot | no results π’ |
00:50:40 | FromDiscord | <Revenant> cheers, having a look |
00:51:02 | FromDiscord | <Revenant> i'm just used to the abundance of json libraries in JVM land, there's literally shitloads of them... |
00:51:07 | disruptek | something like that. |
00:51:13 | * | Jjp137 joined #nim |
00:51:16 | disruptek | there are too many, here, too. |
00:51:38 | disruptek | treeform made one recently, too. |
00:51:46 | FromDiscord | <Revenant> well yeah, just most seemed abandoned or not fit for purpose π |
00:52:51 | disruptek | jason is really just for use in an openapi rest shim. it was a proof-of-concept for frosty. |
00:53:02 | disruptek | and it'll be improved once concepts are sorted. |
00:53:57 | FromDiscord | <Revenant> eminim looks okay, i'll give it a go |
00:54:28 | disruptek | it should be pretty decent. let me know what the performance is like. |
00:54:34 | FromDiscord | <Revenant> i wrote something with cfgparse + some custom macros that does the job... then i realised, this is actually a solved problem to encode/decode from objects graphs with some custom type mappers... |
00:55:01 | FromDiscord | <Revenant> performance will be a non issue, i'm just using this thing to store configs for a desktop app |
00:55:24 | FromDiscord | <Revenant> few hundred lines at most, loaded at startup |
00:55:40 | disruptek | ah, then why use json? you need it to work with other stuff? |
00:56:26 | FromDiscord | <Revenant> well, because json is hierarchical, i don't want use binary for configs either |
00:56:32 | FromDiscord | <Revenant> at least people can edit by hand, you can diff them, etc |
00:57:03 | disruptek | i mean, they're not great for that. |
00:57:08 | FromDiscord | <Revenant> like what else is there: json, ini, yaml, or your custom format which is pointless |
00:57:12 | FromDiscord | <ElegantBeef> Toml |
00:57:26 | FromDiscord | <j-james> toml is very nice |
00:58:03 | FromDiscord | <Revenant> yeah that looks nice, wasn't aware of it |
00:58:13 | FromDiscord | <Revenant> nice is i don't have to write an encoder/decoder myself π |
00:58:18 | FromDiscord | <Revenant> (edit) "is" => "if" |
00:58:20 | disruptek | yeah, we have a few other formats i would choose first. |
00:58:20 | disruptek | nim's cfg or nimscript would be a consideration, too. |
00:58:54 | disruptek | i plan to impl nestedtexts eventually. |
00:59:01 | FromDiscord | <Revenant> i'll show you a snippet |
00:59:34 | FromDiscord | <j-james> you could also go the "suckless" route |
00:59:48 | disruptek | i couldn't make toml work for nimph, for some reason. but others here say it works well for them. |
00:59:48 | FromDiscord | <Revenant> this works, but it's a bit primitive |
00:59:48 | FromDiscord | <j-james> define some consts and make everyone recompile |
00:59:57 | FromDiscord | <Revenant> sent a code paste, see https://play.nim-lang.org/#ix=2HMh |
01:00:13 | FromDiscord | <Revenant> see, colors are encoded as strings, but probably i'd do it the same way with json, just store them in a string |
01:00:24 | FromDiscord | <ElegantBeef> Well with nimscript you can store them as colours π |
01:00:24 | FromDiscord | <Revenant> but we could use some extra nesting levels, which is not possible in ini |
01:01:34 | FromDiscord | <Revenant> @j-james i'm not expecting the users of this app to be programmers π |
01:02:07 | FromDiscord | <Revenant> yeah i'll look into nimscript, never used it before so it wasn't even a consideration |
01:02:14 | FromDiscord | <Revenant> good tip |
01:02:42 | FromDiscord | <Revenant> yeah so it only has to work with my app, that's it |
01:02:44 | FromDiscord | <ElegantBeef> https://github.com/beef331/moe if you want to see how it works |
01:03:01 | FromDiscord | <ElegantBeef> That relies on my nimscripter library |
01:03:35 | FromDiscord | <j-james> i know, i was joking π |
01:03:43 | FromDiscord | <j-james> !repo toml_serialization |
01:03:44 | disbot | https://github.com/status-im/nim-toml-serialization -- 9nim-toml-serialization: 11Flexible TOML serialization [not] relying on run-time type information. 15 7β 0π΄ |
01:03:59 | FromDiscord | <j-james> that's one toml library i'm aware of |
01:07:07 | FromDiscord | <Revenant> it's not quite clear to me whether that supports custom types |
01:07:36 | FromDiscord | <Revenant> i think not |
01:08:16 | FromDiscord | <ElegantBeef> Nimscript supports all nim types π |
01:09:03 | FromDiscord | <Revenant> hmm, maybe it does |
01:09:03 | FromDiscord | <Revenant> https://github.com/status-im/nim-toml-serialization/blob/master/tests/test_decoder.nim#L45-L55 |
01:20:15 | * | krux02 quit (Remote host closed the connection) |
01:27:32 | FromGitter | <awr1> hello all |
01:31:09 | FromGitter | <awr1> was talking about rust and zero cost FP-ish things with some friends of mine, I guess my general issue is that the nim stdlib copies way too much |
01:33:36 | FromGitter | <awr1> zero-functional provides some nice utilities if you're looking for using higher orders because sequtils just copies for everything |
01:33:59 | FromDiscord | <ElegantBeef> Hey i've got a iterator that uses lent π |
01:34:03 | FromDiscord | <ElegantBeef> It's only a pr though |
01:34:48 | FromGitter | <awr1> strutils, though...strutils copies for p much everything |
01:49:16 | mipri | it gives you strings back, yeah, which are value types, so they have to be copies. The experimental section of the manual lays out view types, which still have serious bugs but are somehigh high priority. The experimental viewtypes are important for making it first class, but for limited uses you can still .toOpenArray to get Rust's &str |
01:49:56 | mipri | casual, non-addictive use of Rust still has a huge effect on the brain's concern for copying, though. |
01:51:35 | FromGitter | <awr1> Yes, copying sometimes is not categorically *bad* in itself. But I think a lot of people dive into Nim using strutils without quite being aware of what's going on |
01:52:00 | * | xet7_ is now known as xet7 |
01:53:04 | mipri | I think that's definitely the case. Nim works like C++ while having the ergonomics of a scripting language. Rather than surprising behavior (why is this getting mutated?! ... oh, I need to use deepcopy), you can get surprising performance (why isn't this faster?! oh, if I pass this arg directly instead of let'ing it, it skips the copy) |
01:53:15 | * | xet7 quit (Quit: Leaving) |
01:53:40 | * | xet7 joined #nim |
01:54:13 | mipri | I don't think trading strutils in wholesale for the surprising behavior option would be an upgrade. Though I'm still looking forward to viewtypes. |
01:54:35 | FromGitter | <awr1> right now, if anything takes in a seq[T] or string or w/e, and returns one in some FP-ish manner for the sake of purity, I'm typically like "yup, that's a copy" which, y'know, I'd like to have to think about that less |
01:55:08 | mipri | see, that's the casual use of Rust |
01:55:11 | FromDiscord | <Revenant> using mutation should be an optimisation step, default should be the current behaviour |
01:55:18 | FromDiscord | <Revenant> most of the time you just don't care |
01:55:48 | FromGitter | <awr1> actually more my C++ brain, I don't use Rust that often, but yes |
02:05:05 | FromDiscord | <Rebel> packedjson vs jason? Thinking of replacing default module for a fun modular codebase that will have working threading in it one day |
02:05:06 | mipri | heh, the very next conversation I walk into is someone not liking Julia because it also copies all the time when slicing arrays. This as the default behavior is hated even though Julia already has views as an option. |
02:06:03 | mipri | from an APL perspective it's y'all reference semantic array languages that are weird, though... |
02:08:48 | mipri | in Nim though would I would expect is an initial borrow to get the view, and then the remainder of the code looks like normal sequtils stuff but it's all non-copying now because of the types involved. It sounds like Julia has view ops rather than types, so slicing a view the normal way will give you a copy. |
02:09:15 | * | jxy quit (Quit: leaving) |
02:09:35 | * | jxy joined #nim |
02:11:54 | FromDiscord | <ElegantBeef> Yea i was thinking something like `^[0..1]` would return a openArray instead of a new seq |
02:12:01 | FromDiscord | <ElegantBeef> `^` indicating it's a "pointer" |
02:12:38 | FromDiscord | <Hel> hey guys |
02:12:52 | FromDiscord | <Hel> so i found this random weird thread on the nim forum |
02:12:55 | FromDiscord | <Hel> https://forum.nim-lang.org/t/7200 |
02:13:08 | FromDiscord | <Hel> what is this |
02:13:30 | FromDiscord | <Hel> some bot posting weird stuff and thread got deleted? |
02:14:51 | mipri | that's just a convenient .toOpenArray, but after that [0..1] on the openArray will give you another openArray, which I think is preferable to it giving you a copy because you "should have used ^[0..1]" |
02:14:58 | mipri | yeah it's spam that got deleted. |
02:15:03 | FromDiscord | <Rika> Not deleted, not accepted to be shown |
02:15:16 | FromDiscord | <Hel> ah |
02:15:19 | mipri | says under the title, Moderated, not visible. |
02:15:22 | FromDiscord | <Rika> I mean it isn't deleted, it's not... |
02:15:44 | FromDiscord | <Hel> nim team covering up drug trafficking |
02:15:55 | FromDiscord | <Rika> All posts start moderated |
02:16:13 | mipri | if you found that from a search engine hit, it'd be a good thing to actually delete anyway. |
02:16:50 | mipri | the idea might've been to not delete it so that spammers are slower to learn the system and find an effective way to spam |
02:16:54 | FromDiscord | <Hel> nah i just changed a valid thread's number to a random (aka this one) |
02:17:18 | mipri | well now that you've linked it in a logged channel it way show up in search engines :/ |
02:17:25 | FromDiscord | <Hel> oh |
02:17:29 | FromDiscord | <Hel> sorry |
02:17:59 | mipri | nah, it's funny. anyway the "2.0 in "web 2.0" stands for the administrative cost multiplier to running a website. |
02:18:22 | mipri | if you put up anything users can modify and don't pay the administrative cost, it just turns into spam like this. |
02:19:08 | mipri | I guess it would've been bad marketing to be clear about this but you should expect it :) |
02:19:58 | FromDiscord | <Hel> ah |
02:23:34 | FromDiscord | <ElegantBeef> Yea mipri i agree that for the most part views should be used |
02:26:56 | FromDiscord | <ElegantBeef> But like i said before something as simple `refSlice(1..2)` or similar for an iterator would be nice |
02:27:58 | FromDiscord | <ElegantBeef> Hence this shitty PR π |
02:28:00 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/Nim/pull/16327 |
02:28:01 | disbot | β₯ Added `refSlice` and `mRefSlice` which sensibly iterates openArray slices. |
02:29:19 | mipri | what I'm saying is that you should get a view and then the rest of your code doesn't copy, rather than have lots of non-copying operations, because in the latter case your code is polluted with them and you have to write multiple versions to get/avoid copying, and in this case the library default of copying means that avoiding copies is still a huge hassle. |
02:32:11 | FromDiscord | <ElegantBeef> Yea, and the current methods are less than descriptive |
02:32:22 | FromDiscord | <ElegantBeef> `toOpenArray` is very obscure imo |
02:32:26 | mipri | so, somearray.view[1..5].items rather than somearray.refSlice(1, 5) |
02:33:38 | FromDiscord | <ElegantBeef> Yea that's clearly better |
02:33:40 | mipri | there are still a lot of bugs in view types, and a lot of limitations if you try to use openArrays without turning on the experimental feature |
02:34:08 | mipri | but after they're solid maybe something like .view would work better |
02:34:20 | mipri | which is just .toOpenArray(0, somearray.len) |
02:38:14 | FromDiscord | <Revenant> hmm, so nim-toml-serialization is not bad, but it insists on encoding enums with their ordinal value, which sucks for readability. sadly there's no option to persist them with their displayable names as strings... |
02:52:56 | FromDiscord | <ElegantBeef> @Revenant for what you want i do highly suggesting checking out this part of that moe fork https://github.com/beef331/moe/blob/develop/src/moepkg/settings.nim#L1936 |
02:53:37 | FromDiscord | <ElegantBeef> Those macros are just to automate the settings generation since there are some issues from dependancies |
02:54:01 | FromDiscord | <Revenant> checking |
02:54:16 | FromDiscord | <ElegantBeef> Rather the way they do `colour` makes it pretty much impossible to interop easily afaik |
02:55:21 | FromDiscord | <ElegantBeef> The end result is this bottom is the nimscript file https://media.discordapp.net/attachments/371759389889003532/787512958388797450/98611805-edd96280-22af-11eb-8d5b-47e5ad16c3eb.png |
02:57:31 | FromDiscord | <ElegantBeef> you could probably even have `proc 'property='` |
02:57:37 | FromDiscord | <Revenant> yeah that's cool but still a lot of custom code |
02:57:41 | FromDiscord | <ElegantBeef> It's really not |
02:57:56 | FromDiscord | <ElegantBeef> The only reason those macros exist is cause of the way they do colours |
02:58:25 | FromDiscord | <ElegantBeef> for a normal enum it's just as simple as having a wrapped `setColor` and exposing your enums |
02:58:40 | FromDiscord | <Revenant> i mean my ini based solution works, i just had to write some macros. so i thought i'd ditch the whole thing and just something like a json library or whatever. i guess i'm not interested in non-drop in solutions, i'll just keep what i have then and that's it. |
02:58:42 | FromDiscord | <Revenant> btw this is what i have |
02:58:44 | FromDiscord | <ElegantBeef> Exposing an enum is as simple as `exportCode:` π |
02:59:06 | FromDiscord | <Revenant> this is the definition of the theme strucure |
02:59:07 | FromDiscord | <Revenant> https://github.com/johnnovak/gridmonger/blob/master/src/theme.nim |
02:59:15 | FromDiscord | <Revenant> (edit) "https://github.com/johnnovak/gridmonger/blob/master/src/theme.nim" => "https://github.com/johnnovak/gridmonger/blob/master/src/themedef.nim" |
02:59:56 | FromDiscord | <Revenant> these are the macros |
02:59:57 | FromDiscord | <Revenant> https://github.com/johnnovak/gridmonger/blob/master/src/theme.nim |
03:00:17 | FromDiscord | <Revenant> then some config helpers for parsecfg |
03:00:18 | FromDiscord | <Revenant> https://github.com/johnnovak/gridmonger/blob/master/src/cfghelper.nim |
03:00:25 | FromDiscord | <Revenant> hmm, actually it's a lot of code too π but it works |
03:09:02 | FromDiscord | <Revenant> ah you're actually using parsetoml, not the status one... |
03:36:30 | disruptek | jason doesn't have deserialization yet, but it will probably use eminem or whatever if the performance is okay. |
03:37:08 | disruptek | i would use json for your application. |
03:37:28 | disruptek | doesn't seem like there's a good reason to worry about performance. |
03:39:22 | FromDiscord | <acek7> disruptek |
03:45:01 | * | vicfred quit (Quit: Leaving) |
03:51:11 | disruptek | wut |
03:57:41 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:02:27 | FromDiscord | <m0nsta> disruptek |
04:04:33 | * | spiderstew_ joined #nim |
04:04:42 | FromDiscord | <Rika> disruptek |
04:05:08 | * | spiderstew quit (Ping timeout: 260 seconds) |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:33 | * | supakeen joined #nim |
04:16:21 | * | thomasross quit (Ping timeout: 256 seconds) |
04:31:27 | FromDiscord | <ElegantBeef> @Revenant who is you? |
04:31:38 | FromDiscord | <ElegantBeef> That moe fork is just an implementation of nimscript on moe |
04:31:41 | FromDiscord | <Rebel> disruptek? π |
04:32:06 | FromDiscord | <Rebel> is it time to put an end to this senseless suffering? π€ |
04:32:25 | FromDiscord | <Revenant> what do you mean? π |
04:32:57 | FromDiscord | <ElegantBeef> I didnt make Moe, i just forked it and added nimscript configuration, it uses parse toml, i didnt do anything with it |
04:33:25 | FromDiscord | <Revenant> yeah i get that, i was confused about the "who is you" part π |
04:33:36 | FromDiscord | <ElegantBeef> "ah you're actually using parsetoml, not the status one..." |
04:49:27 | * | narimiran joined #nim |
05:25:15 | FromGitter | <awr1> I still havent played around with view types yet |
05:30:53 | * | pbb_ joined #nim |
05:33:25 | * | pbb quit (Ping timeout: 272 seconds) |
05:36:21 | FromDiscord | <ElegantBeef> They're fun |
05:55:42 | * | astronavt quit (Quit: ...) |
05:56:16 | * | MightyJoe joined #nim |
05:58:08 | * | cyraxjoe quit (Ping timeout: 256 seconds) |
06:06:38 | * | Tanger quit (Quit: Leaving) |
06:14:49 | * | a_chou joined #nim |
06:15:26 | lain | what's the simplest / most idiomatic way to convert between a string and an enum in nim? (both ways) |
06:15:42 | mipri | $enum, parseEnum[Enum](str) |
06:16:22 | lain | oh I somehow missed parseEnum[](), thanks! :3 |
06:22:43 | * | Cthalupa quit (Ping timeout: 256 seconds) |
06:24:44 | * | Cthalupa joined #nim |
06:25:05 | * | a_chou quit (Remote host closed the connection) |
06:31:04 | * | habamax joined #nim |
06:35:06 | FromDiscord | <sealmove> guys, is `bitand` from `bitops` module more performance than system's `and` operator? |
06:35:56 | FromDiscord | <sealmove> should be exactly the same, right? |
06:40:29 | mipri | they're not exactly the same, but they map to the same magic of BitandI |
06:40:48 | mipri | bitops uses a func and proc uses a proc with noSideEffect |
06:41:01 | mipri | *and system uses |
06:41:18 | mipri | compare lib/system/arithmetics.nim and lib/pure/bitops.nim |
06:44:13 | FromGitter | <awr1> bitand should use the bitwise and instruction |
06:45:05 | FromGitter | <awr1> in terms of impl, I added a thing a while back that enabled varargs support for bitand, bitor, and bitxor |
06:45:51 | FromGitter | <awr1> but in all reality this difference should be almost meaningless once the C compiler does its thing |
06:53:03 | FromDiscord | <impbox> hmm using `if x is Foo:` when you should be using `if x of Foo:` should probably raise an error/warning, when x is a variable and Foo is a type, does `x is Foo` ever make sense? |
06:54:32 | mipri | I've put it in asserts. |
06:55:19 | leorize | probably issue a misuse warning in runtime context |
06:55:27 | FromDiscord | <ElegantBeef> isnt `when a is B` common? |
06:55:37 | leorize | we already have those for other stuff I think, so adding this shouldn't be hard |
06:56:35 | FromDiscord | <ElegantBeef> I missed the `if` |
06:56:43 | * | Cthalupa quit (Ping timeout: 256 seconds) |
06:56:44 | FromDiscord | <ElegantBeef> I'm not bad at reading, you are |
06:57:14 | FromDiscord | <impbox> alternatively, maybe `is` should act as `of` in this case |
06:57:57 | mipri | making the language more complex because you made a mistake is just going to result in more mistakes. |
06:59:45 | FromDiscord | <impbox> indeed |
07:00:42 | * | Cthalupa joined #nim |
07:46:31 | * | nyaayaya quit (Remote host closed the connection) |
07:52:16 | FromDiscord | <acek7> is disruptek around i keep getting busy and missing him lol |
07:53:55 | FromDiscord | <ElegantBeef> He's back |
07:55:59 | FromDiscord | <acek7> he mentioned helping with web design |
07:56:04 | FromDiscord | <acek7> for the nim sites |
07:56:09 | FromDiscord | <acek7> or something |
07:58:59 | * | mika_ joined #nim |
08:03:26 | * | mika_ quit (Ping timeout: 256 seconds) |
08:21:41 | * | mbomba joined #nim |
08:28:45 | * | Vladar joined #nim |
08:29:50 | Zevv | damn i lack crucial insight |
08:30:00 | Zevv | story of my life i guess |
08:30:04 | FromDiscord | <sealmove> hex float literals are not supported right? |
08:30:39 | mipri | they are supported |
08:30:43 | Zevv | well, they exist |
08:30:47 | Zevv | but who is supporting them |
08:30:55 | mipri | >Floating-point literals may also be in binary, octal or hexadecimal notation |
08:31:13 | mipri | !eval 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 |
08:31:15 | NimBot | Compile failed: /usercode/in.nim(1, 1) Error: expression '0b0100011101000000101001000111101011101111111011000101001101001001'f64' is of type 'float64' and has to be used (or discarded) |
08:31:30 | mipri | !eval echo 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 |
08:31:32 | NimBot | 1.7282561e+35 |
08:31:33 | FromDiscord | <sealmove> oh sweat! does this mean equality will work? |
08:31:50 | FromDiscord | <sealmove> !eval echo 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 == 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 |
08:31:52 | NimBot | true |
08:32:23 | FromDiscord | <sealmove> neat way to avoid "almost equal" |
08:32:51 | mipri | how the notation change how == works? |
08:34:32 | FromDiscord | <sealmove> you specify the exact bytes, precision is lost because of notation, no? |
08:35:00 | FromDiscord | <sealmove> i think I am right, am I right? lol |
08:35:41 | FromDiscord | <ElegantBeef> Well you're telling it what it is, so |
08:40:56 | * | Cthalupa quit (Ping timeout: 240 seconds) |
08:44:21 | * | Cthalupa joined #nim |
08:50:32 | FromDiscord | <Rika> Precision isn't lost, it's more like exact value is estimated from the literal |
08:56:57 | FromDiscord | <sealmove> does writing a null-terminating string into a StringStream make sense? |
08:57:43 | FromDiscord | <ElegantBeef> It's going to cause an error if you have more data after it |
08:58:03 | mipri | I would expect that to not be the case. it's a string stream, not a cstring stream |
08:58:05 | FromDiscord | <sealmove> ouch. so if i use a FileStream it's ok? |
08:58:44 | FromDiscord | <ElegantBeef> Ah nvm yea |
08:58:46 | FromDiscord | <ElegantBeef> I'm dumb |
08:59:35 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
08:59:41 | mipri | !eval import streams; echo newStringStream("a\0b").readStr(3) == "a\0b" |
08:59:43 | NimBot | true |
08:59:48 | * | mbomba quit (Quit: WeeChat 3.0) |
09:00:02 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2HOn |
09:00:13 | FromDiscord | <sealmove> I am doing this |
09:00:40 | FromDiscord | <ElegantBeef> How are you reading? |
09:02:34 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2HOr |
09:02:55 | FromDiscord | <ElegantBeef> Do you `setposition(0)`? |
09:03:13 | FromDiscord | <sealmove> but I don't want to do this, I have other data before and after |
09:03:27 | FromDiscord | <ElegantBeef> Well do you move it back the few chars? |
09:04:08 | mipri | !eval import streams; var s = newStringStream(); s.write("ABC"); s.write('\0'); s.setPosition(0); echo s.readStr(4) == "ABC\0" |
09:04:10 | NimBot | true |
09:04:12 | FromDiscord | <sealmove> oh sorry of course I set possition to 0 yes |
09:04:44 | FromDiscord | <sealmove> but mipri I don't use readStr() |
09:04:54 | FromDiscord | <sealmove> because it's null-terminated |
09:05:19 | mipri | ... ? |
09:05:41 | FromDiscord | <sealmove> i don't know the length of string i am reading |
09:05:59 | mipri | and? |
09:06:14 | mipri | I can't type !eval all day |
09:06:15 | FromDiscord | <sealmove> and I can't use readStr because it takes the length of bytes to read as argument |
09:06:35 | mipri | !eval import streams; var s = newStringStream(); s.write("ABC"); s.write('\0'); s.setPosition(0); echo [s.readChar, s.readChar, s.readChar, s.readChar] |
09:06:38 | NimBot | ['A', 'B', 'C', '\x00'] |
09:08:40 | FromDiscord | <sealmove> yeah well, that's what I am doing |
09:09:00 | mipri | https://play.nim-lang.org/#ix=2HOx |
09:10:10 | FromDiscord | <sealmove> I suspect it's a flush problem or something |
09:10:55 | mipri | hmm a minor problem with that link is that if you readCStr before the \0 is written, you'll still be able to read a string instead of getting an error. |
09:11:44 | mipri | what you might want to do instead if you have control over bends of this stream, is send the length of the string first and then read that many chars |
09:15:49 | FromDiscord | <sealmove> ok here is the situation |
09:17:02 | FromDiscord | <sealmove> I am reading from stream #1 to an object, then I am writing this object to stream #2, then i set position of #2 to 0, and read another object out of it. then I compare objects. |
09:17:37 | FromDiscord | <sealmove> data are read correctly the first time, written correctly to stream #2, but a null terminated string at the end of the stream is not written the 2nd time. |
09:19:07 | mipri | ah that's not a minor problem actually, '\0' is defined as EOF for readChar and friends |
09:20:02 | mipri | s.readInt8.char avoids that |
09:23:04 | FromDiscord | <sealmove> hmm |
09:25:05 | FromDiscord | <sealmove> s.readInt8.char doesn't seem to avoid it |
09:25:26 | mipri | I'm talking about the minor problem I mentioned above |
09:25:54 | * | spiderstew_ quit (Quit: ZNC 1.7.2+deb3 - https://znc.in) |
09:26:08 | * | spiderstew joined #nim |
09:30:29 | FromDiscord | <sealmove> oh ok I found out the issue |
09:30:48 | mipri | what was it? |
09:32:40 | FromDiscord | <sealmove> I am writing a non-null-terminated string before the null-terminated one. Docs say write(someString) doesn't put null termintated byte, so I assumed there won't be one in between them. Hmm, is this a bug though? |
09:33:26 | mipri | aren't you just reading the first one as a cstring, and thereby reading both? |
09:33:45 | FromDiscord | <sealmove> eh, it's a bug in my code, I always write a null byte before calling streams.write(someString) |
09:34:01 | FromDiscord | <sealmove> no, I use readStr(len) for 1st one |
09:36:59 | FromDiscord | <sealmove> I need 2 procs, `writeNullTerminatedString` and `writeString` |
09:37:28 | FromDiscord | <sealmove> because I always write already parsed strings, which are nevel null-terminated |
09:37:43 | FromDiscord | <sealmove> this asymmetry bite me L:| |
09:43:30 | FromDiscord | <sealmove> btw guess, do you know if unaligned strings are seen in the wild? |
09:43:36 | FromDiscord | <sealmove> btw guys |
09:49:55 | * | fredrikhr quit (Read error: Connection reset by peer) |
09:54:40 | * | habamax quit (Ping timeout: 246 seconds) |
09:57:03 | * | habamax joined #nim |
09:58:07 | planetis[m] | @Revenant toml is sh**t as others will tell you, whatever lib you use, choose json u want regret it. |
10:00:10 | FromDiscord | <mratsim> json has no comment support though, for user-friendly configuation toml seems better |
10:00:52 | FromDiscord | <mratsim> @Zevv, @disruptek, how do you deal with environment apcking and unpacking in CPS? Are you using liftLocal or any Nim provided facilities or are you rolling your own closure? |
10:02:03 | planetis[m] | Just make an about:config page for power users, problem solved |
10:03:05 | planetis[m] | use an extra explanation field |
10:03:16 | planetis[m] | Can be localized as well |
10:05:10 | FromDiscord | <XxDiCaprioxX> Can you guys help me? If I want to initialize a variable to a type that has no arguments, how do I do that? |
10:07:35 | FromDiscord | <XxDiCaprioxX> `let foo = Bar` doesn't work because vs code thinks I want to declare and `let foo = Bar()` doesn't work either because vs code complains about empty parenthesis. But as my type has no extra parameters I can't really put anything in there, can I? |
10:08:44 | FromDiscord | <mratsim> let foo = Bar() or let foo = default(Bar) should work. |
10:09:22 | FromDiscord | <mratsim> let foo = Bar() only limitation is with arrays. |
10:10:03 | FromDiscord | <XxDiCaprioxX> that may be the reason |
10:10:15 | FromDiscord | <XxDiCaprioxX> I forgot to state that my type Bar is a seq |
10:10:35 | FromDiscord | <XxDiCaprioxX> sorry for that. Is there a workaround for seqs? |
10:11:01 | * | narimiran quit (Ping timeout: 264 seconds) |
10:11:55 | planetis[m] | Is Bar a tuple by any chance? |
10:11:56 | FromDiscord | <mratsim> use default or use newSeq[T](length) |
10:12:30 | FromDiscord | <XxDiCaprioxX> no Bar is a sequence |
10:12:38 | FromDiscord | <mratsim> or use `let foo: seq[int]: @[]` |
10:12:43 | FromDiscord | <XxDiCaprioxX> thank you @mratsim I'll try that |
10:12:48 | FromDiscord | <mratsim> let foo: seq[int] = @[] |
10:18:02 | * | tane joined #nim |
10:21:03 | Zevv | mratsim: we roll our own. all continuable blocks are isolated and for each an object type is composed (which is the actual continuation) |
10:22:14 | FromDiscord | <mratsim> how do you deal with the variable number of variables to save? do you have a max number of variables saved? |
10:22:19 | * | krux02 joined #nim |
10:22:30 | Zevv | how are they variable? |
10:22:43 | Zevv | the code dictates which local vars exist in any scope |
10:23:53 | Zevv | basically we identify all locals, and rewrite the code to use the variables from there instead |
10:23:56 | FromDiscord | <mratsim> Yes, but there are a different number of local vars depending of the code |
10:24:16 | Zevv | sure, that just gets picked up, its not too hard |
10:24:37 | Zevv | the code is abit convoluted, mostly because of the logic involved in rewriting various kinds of control flow |
10:24:56 | FromDiscord | <mratsim> My question is about memory management |
10:25:16 | Zevv | im having a little hike now, ill be back in an hor or so |
10:25:22 | FromDiscord | <mratsim> are you using a seq or anything GC managed or are you using an array with max size but that is multithreading friendly |
10:25:22 | Zevv | ping me |
10:25:43 | FromDiscord | <mratsim> sure |
10:48:08 | * | mika_ joined #nim |
10:53:56 | * | idf joined #nim |
10:55:50 | Zevv | back |
10:56:11 | Zevv | basically, for each proc we dissect, we create 1 object type |
10:56:29 | Zevv | this holds all the locals that exists in the stack frame of the function |
10:56:49 | Zevv | version 1 is just 1 plain list, I have thought of optimizing this to make it work like a stack using object variants |
10:56:49 | disruptek | and anything we capture. π |
10:57:07 | Zevv | where memory used by things that leave a scope can later be reused by other things living in the same spot |
10:57:15 | Zevv | my mental image is basically just exactly the layout of the original stack |
10:57:19 | Zevv | but then made explicit in an object |
10:57:28 | Zevv | CPS does not care where the object is allocated, how or by whom |
10:57:43 | Zevv | it's just an object, consisting of a function pointer to the next continuatio proc, and the locals that apply at that point in time |
10:57:59 | Zevv | so now we allocate one object, set 'fn' to the first proc, and trampoline |
10:58:21 | Zevv | that proc get's passed one single argument, which is a var object |
10:58:33 | Zevv | the code in that function that used to work with locals now works with the data in that object |
10:58:47 | Zevv | at return time it will set the 'fn' part of the object to the next continuation proc |
10:59:08 | Zevv | so for the total life time of the original function that was cut into pieces, there is only 1 single allocation |
10:59:23 | Zevv | that ideally is exactly as large as the deepest point of the original stack frame |
10:59:27 | * | idf31 joined #nim |
10:59:48 | disruptek | well, that's not necessarily possible, but yeah. |
11:00:02 | Zevv | what disruptek calls 'fork', is basically making a copy of the object, and calling the fn for the original and the copy |
11:00:05 | Zevv | disruptek: dude |
11:00:09 | disruptek | and technically, we could use smaller objects, but they'd vary more in size. |
11:00:24 | Zevv | we talked about this a ton of times. I am right and you are wrong |
11:00:28 | disruptek | this seems worse than fewer allocs. |
11:00:47 | Zevv | the ideal case is an object variant of which the largest variant is exactly as big as the largest stack frame |
11:00:52 | Zevv | also, what time is it |
11:00:52 | disruptek | how do you make a seq inside the env, then? |
11:01:06 | Zevv | how do you make a seq on the stack? |
11:01:08 | Zevv | you dont |
11:01:10 | disruptek | uh |
11:01:18 | Zevv | the 16 byte header is on the stack. The seq itself is on the heap |
11:01:19 | Zevv | always |
11:01:31 | Zevv | no different here |
11:01:34 | disruptek | yes, so are you going to hack the seq into the heap-stack-env? |
11:01:50 | disruptek | with a cast? |
11:01:54 | Zevv | you don't, it was originally also not on the stack, was it? |
11:01:55 | disruptek | you don't usually get to pick the seq's address. |
11:02:05 | disruptek | it's in the heap, but not in the same memory block. |
11:02:10 | Zevv | right |
11:02:10 | disruptek | so it's not contiguous. |
11:02:13 | Zevv | right |
11:02:17 | Zevv | that' wont work for a seq anyway |
11:02:21 | disruptek | so there is more than one alloc. |
11:02:24 | Zevv | right |
11:02:27 | disruptek | that's my only point. |
11:02:35 | Zevv | clear |
11:02:42 | Zevv | also, what time is it |
11:02:46 | disruptek | um |
11:02:56 | disruptek | 90:9 |
11:03:01 | Zevv | such much |
11:03:19 | disruptek | okay, have a good hike. |
11:03:24 | Zevv | no i'm back |
11:03:36 | disruptek | oh. |
11:03:39 | Zevv | hike's always over arounnd 90:9 |
11:03:47 | Zevv | but now mratsim is gone |
11:07:19 | Zevv | I am still surprised about the confusion over what CPS is, and mostly, is not |
11:07:26 | Zevv | as it is almost nothing |
11:08:20 | disruptek | i know. i guess we need to focus on doing it by hand and then explain, again, that the module merely performs the rewrite for you. |
11:08:34 | Zevv | right. |
11:08:38 | Zevv | that is way I keep saying |
11:08:41 | Zevv | keep that stuff separated |
11:08:43 | disruptek | planetis[m]: chucklehead, hit me up in a few hours and we'll debate hash as it relates to ic. |
11:08:46 | Zevv | don't put your event loop thing in the same repo |
11:08:48 | Zevv | it confuses people |
11:08:56 | Zevv | CPS does not cancel, timeout, async, or whatever |
11:09:03 | Zevv | separate that stuff, really |
11:09:10 | disruptek | eh, whatever. |
11:09:12 | Zevv | don't even put your trampolines in there |
11:09:14 | disruptek | it was useful at the time. |
11:09:29 | disruptek | otherwise, we'd have had no way to truly demonstrate async code. |
11:09:32 | Zevv | true that |
11:09:38 | Zevv | no, second repo |
11:09:40 | Zevv | one repo doing CPS |
11:09:45 | Zevv | other repo doing stuff with it |
11:09:55 | disruptek | yeah, i don't care. it's whatever. |
11:10:37 | disruptek | i do hope cps can shrink a bit, though, even though it should do more. |
11:10:37 | disruptek | i guess once typed is in we'll know what we can delegate to the compiler. |
11:11:00 | disruptek | the boss wasn't super helpful wrt the carnac bug. |
11:11:25 | Zevv | willing or able |
11:11:48 | disruptek | "probably a bad nfSem", which i think i already ruled out. but i guess i can look again. |
11:11:52 | Zevv | becasue it's still just the empty room problem, right |
11:12:05 | FromGitter | <jrfondren> can sugar.collect be used without assigning a variable? the closest I've got to immediately consuming the result is https://play.nim-lang.org/#ix=2HPe |
11:12:20 | disruptek | remind me. |
11:12:54 | Zevv | if you start doing typed macro's, you feel like your just entering an empty room that no one cared to decorate yet |
11:13:01 | Zevv | no furniture, bare bulb on the ceiling |
11:13:13 | Zevv | it's not broken perse, more that no one ever comes here |
11:13:33 | disruptek | oh yeha. |
11:13:56 | disruptek | so carnac works, which is cute, but only if you take the macro output and run it. |
11:14:06 | disruptek | so that's my test, now. |
11:14:10 | Zevv | well isn't that useful |
11:14:27 | disruptek | currently, it produces idents for things like the proc name and result, which isn't ideal when you're trying to compile it to C. |
11:15:25 | disruptek | this could be a thing that people solve with multi-level macros, but that's a shitty solution, honestly. |
11:16:26 | Zevv | so, I'm not really sure how your carnac thing relates to the CPS thing we were blocked on |
11:16:29 | Zevv | explain it to me |
11:16:46 | disruptek | it's a smaller demo of a typed proc rewrite; that's it. |
11:16:54 | Zevv | ok right |
11:16:55 | disruptek | it does the resym. |
11:17:12 | Zevv | well, I do like that @mratsim seems to take interest in this |
11:17:24 | Zevv | it might help building some momentum |
11:17:26 | disruptek | you'd have to be dom96 not to. |
11:17:50 | disruptek | it's like, obviously the way forward. |
11:20:23 | * | habamax quit (Quit: leaving) |
11:20:42 | * | habamax joined #nim |
11:24:25 | FromDiscord | <Clyybber> disruptek, Zevv sup |
11:25:07 | Zevv | oy |
11:25:15 | Zevv | we had @mratsim asking good questions about CPS |
11:25:22 | Zevv | but then he ran off |
11:25:30 | disruptek | clyybber wtf. where have you been? |
11:26:47 | FromDiscord | <Clyybber> on the run |
11:27:16 | disruptek | hmmph. |
11:28:08 | FromDiscord | <Clyybber> Ill look at the carnac today |
11:29:14 | disruptek | thanks; i have to peform sex acts for money instead of coding, but maybe i'll catch you later if the police haven't nabbed you by then. |
11:30:54 | * | antranigv quit (Quit: ZNC 1.8.2 - https://znc.in) |
11:32:36 | * | antranigv joined #nim |
11:36:09 | * | mika_ quit (Quit: Lost terminal) |
12:03:44 | FromDiscord | <dom96> https://irclogs.nim-lang.org/13-12-2020.html#11:00:24 lol |
12:03:45 | FromDiscord | <m0nsta> i mean, he could be on the run from the object oriented mafia |
12:04:11 | FromDiscord | <dom96> > you'd have to be dom96 not to. |
12:04:25 | FromDiscord | <dom96> I literally was asking questions about it like two days ago |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:34 | * | supakeen joined #nim |
12:11:50 | * | hmmmm joined #nim |
12:12:02 | hmmmm | alo~ |
12:15:55 | * | antranigv quit (Quit: ZNC 1.8.2 - https://znc.in) |
12:17:30 | planetis[m] | disruptek: I m curious, but i don't think it would be related to ic at all. |
12:18:00 | * | antranigv joined #nim |
12:20:08 | FromDiscord | <mratsim> @Zevv I didn't run off, I was trying to optimize cryptographic code. square root for complex big int in particular π |
12:20:47 | ForumUpdaterBot | New thread by Lecale: StartProcess help (2), see https://forum.nim-lang.org/t/7249 |
12:20:50 | FromDiscord | <mratsim> My question stems basically from the fact that Weave task seems to be basically CPS continuation + Weave metadata |
12:21:34 | FromDiscord | <mratsim> the proc {.nimcall.} + an environment/closure representing all variables captured for the execution of the proc {.nimcall.} |
12:21:59 | FromDiscord | <mratsim> So I could have Weave be an executor for CPS |
12:22:29 | FromDiscord | <mratsim> And we could have another executor for IO/async and they would all use the same primitives. |
12:23:14 | FromDiscord | <mratsim> And maybe later we have an executor interface and people would just write code and depending on their need dispatch that to Weave for CPU-bound or an async/await executor for IO-bound. |
12:23:21 | FromDiscord | <dom96> I like how everyone is just reimplementing what the compiler already implements |
12:24:15 | FromDiscord | <mratsim> But, I absolutely need that environment to be threadsafe, and ideally bounded in size so that we can handle millions/billions/trillions of them and that needs a memory pool |
12:24:51 | FromDiscord | <mratsim> @dom96 the compiler doesn't expose local captures unfortunately, though I didn't check what liftLocals does. |
12:25:06 | FromDiscord | <mratsim> and the owner magic macro isn't sufficient. |
12:25:16 | FromDiscord | <mratsim> local variable captures |
12:25:47 | FromDiscord | <dom96> Pretty sure there is a way to get at the captured closure data, it's useful for FFI |
12:26:24 | FromDiscord | <mratsim> There is this: https://github.com/nim-lang/Nim/pull/8253 but no doc at all. |
12:26:27 | disbot | β₯ Add sym owner to macros ; snippet at 12https://play.nim-lang.org/#ix=2HPI |
12:26:49 | FromDiscord | <mratsim> and lifLocals is even more hidden |
12:26:53 | FromDiscord | <mratsim> liftLocals |
12:27:40 | FromDiscord | <dom96> I remember passing a {.closure.} to a GTK callback a while ago with its data as the callback data |
12:28:08 | FromDiscord | <mratsim> sure, you can use rawEnv: https://nim-lang.org/docs/system.html#rawEnv%2CT |
12:28:17 | FromDiscord | <dom96> yeah, that's it |
12:28:25 | FromDiscord | <mratsim> but that doesn't help when you need to build your own custom closures. |
12:29:45 | * | Cthalupa quit (Ping timeout: 240 seconds) |
12:31:30 | FromDiscord | <mratsim> to be more concrete @Zevv: this is the core task system of Weave extracted and cleaned from anything scheduler related: https://github.com/mratsim/blocksmith/blob/master/cross_service_calls.nim#L21-L127 |
12:33:20 | * | Cthalupa joined #nim |
12:43:31 | * | Q-Master quit (Ping timeout: 256 seconds) |
12:50:07 | Zevv | that looks familiar, but our "env" consists of a object or sum type of concrete stuff that is lifted |
12:50:18 | Zevv | so env size is bound and fixed at compile time |
12:50:51 | Zevv | and now I need to run off again, for some reason my family has D&D sessions every sunday afternoon and I ended up joining that somehow |
12:51:36 | Zevv | this feels compatible, as long as we don't string and seq |
12:52:10 | Zevv | also it seems like a nice fit where CPS ends & where weave begins |
12:52:22 | Zevv | CPS does not do anything about actually calling your continuations somehow |
12:52:35 | Zevv | it only produces them from plain flat nim code |
12:52:58 | FromDiscord | <dom96> Wow. Your family is epic, can I join? π |
12:53:11 | Zevv | man I loathe it, really |
12:53:17 | Zevv | but the kids seem to enjoy it a lot |
12:53:57 | Zevv | I like the game part, but the rules are really utterly brain dead needlessly complicated |
12:54:14 | Zevv | might as well spin up The Witcher |
12:54:24 | Zevv | Same stuff, but the computer does the bookkeeping |
12:55:36 | FromDiscord | <dom96> Itβs about interacting with the people, any computer involvement lessens this. β΅That said, the Alexa skill which helps play Ticket To Ride is awesome. |
12:55:57 | * | PMunch joined #nim |
12:56:01 | Zevv | i interact more then enough with my kids already, thank you |
12:56:14 | Zevv | they have a swiss uncle doing the mastering from switzerland, over zoom |
12:56:28 | Zevv | that makes it pretty hard, him being on a tiny speaker not being able to lash out or shout |
12:56:37 | Zevv | anyway, ETA 00:03:30 |
12:56:40 | Zevv | bbl |
13:02:26 | FromDiscord | <m0nsta> sent a code paste, see https://play.nim-lang.org/#ix=2HPW |
13:02:52 | FromDiscord | <m0nsta> can anyone help explain this to me ? |
13:03:57 | FromDiscord | <Vindaar> what are you not understanding? |
13:03:59 | FromDiscord | <m0nsta> i get T means it'll be a matrix of type `T`, that you'll pass. for eg `int` or `float` or `string` |
13:04:21 | FromDiscord | <m0nsta> what does those Rows and Colums in the typedef mean ? |
13:04:31 | FromDiscord | <lqdev> these are extra generic params |
13:04:44 | FromDiscord | <lqdev> imo they should also be annotated with a `static int` constraint |
13:04:46 | FromDiscord | <Vindaar> yes, but for rows and columns this should probably be `static int` |
13:04:54 | FromDiscord | <lqdev> like `Matrix[T; Rows, Columns: static int]` |
13:04:57 | FromDiscord | <Vindaar> ^ |
13:05:24 | FromDiscord | <m0nsta> alright, but what does it mean to you guys when you read that ? |
13:05:38 | FromDiscord | <lqdev> these are generic parameters for the type |
13:05:59 | FromDiscord | <Vindaar> well, to me nothing really, because as they are generic parameters of the type, but I don't see the actual fields of the type |
13:06:14 | FromDiscord | <Vindaar> can only deduce the intent |
13:06:16 | FromDiscord | <lqdev> `type matrix with generic parameters T, Rows, and Columns, which is an object` |
13:06:34 | FromDiscord | <m0nsta> like rows will be of type Rows ? but hen dafuq is a Column type doing there ? |
13:06:43 | FromDiscord | <lqdev> no |
13:06:48 | FromDiscord | <lqdev> they're generic parameters like `T` |
13:06:56 | FromDiscord | <lqdev> so they may be any type |
13:07:03 | mipri | Rows and Columns are both static ints |
13:07:03 | FromDiscord | <m0nsta> so, they dont mean shit, yet |
13:07:10 | FromDiscord | <lqdev> yet. |
13:07:32 | FromDiscord | <m0nsta> its from the manual and its really confusing to me lol |
13:07:35 | mipri | this is the same semicolon use taht you see in parameters. |
13:07:44 | FromDiscord | <m0nsta> might just name them XYZ or something |
13:08:30 | mipri | !eval import strutils; echo (proc (a, b: int; x: string): int = a + b + x.parseInt)(1, 2, "3") |
13:08:33 | NimBot | 6 |
13:08:45 | FromDiscord | <m0nsta> now then, all of those generic params could be used to define generic fields int the object definition if we chose to amirite |
13:08:54 | mipri | a and b are ints; x is a srting. above, T is completely generic; Rows and Columns are static ints |
13:11:08 | FromDiscord | <Vindaar> but `Rows` and `Columns` are _not_ static ints here? |
13:11:22 | FromDiscord | <m0nsta> doesn't seem like |
13:11:24 | * | hmmmm quit () |
13:11:35 | FromDiscord | <m0nsta> https://nim-lang.org/docs/manual.html#generics-implicit-generics |
13:11:45 | FromDiscord | <m0nsta> scroll down a little there |
13:11:49 | mipri | in what m0nsta said, no. I was replying to what lqdev said. |
13:12:08 | * | Q-Master joined #nim |
13:12:16 | FromDiscord | <Vindaar> oh haha |
13:12:35 | FromDiscord | <Vindaar> @m0nsta I had no idea one could write `Matrix.T` to match the name `T` from the type definition, wth |
13:12:43 | FromDiscord | <Vindaar> the type `T` |
13:12:46 | FromDiscord | <lqdev> @Vindaar that's legit yeah |
13:13:22 | FromDiscord | <m0nsta> @Vindaar Araq wasnt messing around when he meant generic lol |
13:13:37 | FromDiscord | <lqdev> @Vindaar https://nim-lang.org/docs/manual.html#generics-implicit-generics |
13:13:52 | FromDiscord | <lqdev> that's where this snippet is from |
13:13:57 | FromDiscord | <Vindaar> I mean it makes sense, but I simply wasn't aware of it. Imo implicit generics in most use cases are really bad style |
13:13:58 | FromDiscord | <m0nsta> YAS |
13:15:19 | FromDiscord | <m0nsta> so Rows and Colums are just names here that dont really have anything to do with row or column types right? |
13:15:58 | mipri | they're names, correct |
13:16:40 | FromDiscord | <m0nsta> got it |
13:17:08 | FromDiscord | <m0nsta> i was confused how are they specifying the row or column types here |
13:17:17 | FromDiscord | <m0nsta> or am i missing something lol |
13:17:39 | FromDiscord | <m0nsta> or wth is even a column type lol |
13:17:40 | FromDiscord | <trippleA> In this screenshot, what does the mean in these two different examples? https://media.discordapp.net/attachments/371759389889003532/787669568801210428/asterik.png |
13:17:40 | mipri | in your example, they're not |
13:17:46 | mipri | it's purely a name |
13:17:52 | FromDiscord | <m0nsta> gotcha |
13:17:57 | * | lytedev[m] quit (Ping timeout: 260 seconds) |
13:17:57 | * | BitPuffin quit (Ping timeout: 260 seconds) |
13:18:32 | * | GitterIntegratio quit (Ping timeout: 260 seconds) |
13:20:00 | * | lytedev[m] joined #nim |
13:20:04 | * | BitPuffin joined #nim |
13:24:26 | FromDiscord | <lqdev> @trippleA multiplication |
13:35:40 | PMunch | Anyone ready for day 13 of AoC? |
13:38:15 | PMunch | Stream is live! https://www.twitch.tv/pmunche https://www.youtube.com/watch?v=oFxW7MJ-7qw |
13:45:30 | Zoom[m] | My solution for P2 fails for one of the test inputs :) |
13:45:51 | PMunch | Sounds like you did something wrong :P |
13:46:32 | Zoom[m] | No shit! It works for my input, though |
13:46:54 | Zoom[m] | That's the worst kind of bug |
13:47:28 | Zoom[m] | Nope, the worst is failing for someone else's data, while passing your tests |
13:51:32 | Zoom[m] | Ha-ha, I just lost a digit while copypasting the test data |
13:52:04 | Zoom[m] | PMunch: why aren't you in the second private Leaderboard? |
13:53:08 | FromDiscord | <pietroppeter> It was shared in mega thread once the main one was full |
13:55:13 | FromDiscord | <pietroppeter> The idea of the second leaderboard was to allow for other people to be in the leaderboard when the main one was full. Also since main one has lots of people who joined in the past and are not doing this year in Nim, the new leaderboard is specific for those doing 2020 in Nim |
13:56:33 | Zoom[m] | I couldn't joint the main one since it was full but I just checked and I'm in |
13:57:44 | FromDiscord | <dom96> > but that doesn't help when you need to build your own custom closures.β΅Why do you need to build your own closures? Is it just to control how they're allocated? |
13:57:50 | Zoom[m] | Not bad, 38 place, considering I started from D4 or something like that, and I'm sleeping for the first 4-5 hours of the aocDay |
14:11:56 | FromDiscord | <sealmove> @PMunch hey! check this out! https://github.com/sealmove/binaryparse/blob/master/tests/testsuite.nim π |
14:12:40 | PMunch | @sealmove, sorry I'm streaming right now, and have to go right after. But from a quick glance it looks good .) |
14:13:51 | FromDiscord | <sealmove> np, just wanted to show that I made proper test suite |
14:14:21 | FromDiscord | <sealmove> most features are tested and work |
14:14:44 | FromDiscord | <sealmove> enjoy aoc! |
14:16:19 | FromDiscord | <pietroppeter> that's a good path you are going... |
14:16:29 | FromDiscord | <pietroppeter> what about the two highest bus number |
14:16:32 | FromDiscord | <pietroppeter> ? |
14:22:24 | FromDiscord | <mratsim> Because I need threadsafe closures for multithreading |
14:25:35 | FromDiscord | <pietroppeter> sorry if I have thrown of your path. you might want to continue own with your reasoning. one good thing though would be to put the input in better shape: you only care about buses without the x and the position is only useful to get the timedelta (your i) which you do not have to compute it every time in the loop. |
14:27:47 | FromDiscord | <pietroppeter> then what I mean about the two highest it was not even really about the two highest. it is about the fact that you were taken some steps according to your first bus. then when you find a time that goes well with two buses, what can you do to take bigger steps for the rest of the buses |
14:27:49 | FromDiscord | <pietroppeter> ? |
14:28:56 | FromDiscord | <pietroppeter> gotta go, sorry, will check later how it went π |
14:29:34 | * | antranigv quit (Quit: ZNC 1.8.2 - https://znc.in) |
14:31:12 | * | antranigv joined #nim |
14:34:31 | * | narimiran joined #nim |
14:35:02 | FromDiscord | <dom96> in other words, you want to control how they're allocated, right? |
14:36:12 | FromDiscord | <mratsim> That is a nice to have. Closures not being threadsafe is a blocker. |
14:39:17 | FromDiscord | <dom96> in what way are they not thread safe? |
14:45:41 | FromDiscord | <mratsim> They are managed by the GC |
14:46:08 | FromDiscord | <xotonic> About the actual tool that parses RST file `doc` and converts it to HTML. Is it written in Nim or Koch invokes some 3rd party utility? |
14:46:17 | FromDiscord | <xotonic> (edit) "file" => "files in" |
14:46:19 | FromDiscord | <mratsim> it's in the compiler |
14:46:55 | FromDiscord | <dom96> huh? I don't get how that's somehow different to what I said above regarding their allocation. |
14:47:12 | FromDiscord | <dom96> You want to manage how they are allocated yourself, not leave it to the GC |
14:47:22 | FromDiscord | <dom96> Because the GC puts it on a thread-local heap |
14:48:01 | FromDiscord | <mratsim> It's different because if the closures had a single owner and were done using destructors I could use them. The limitation being performance if a lot are allocated. |
14:48:17 | FromDiscord | <mratsim> so doing my own closures is just an option |
14:48:57 | PMunch | Man that was annoying.. Felt like I was getting close and now I have to run.. |
14:48:59 | * | PMunch quit (Quit: leaving) |
14:49:19 | FromDiscord | <mratsim> if the closures are managed by the GC with thread local heap and the GC-ed memory allocated in one thread is exposed to the other thread, I don't have an option, i am forced to do custom closures. |
14:49:41 | FromDiscord | <dom96> Yes, so if Nim closures allowed you to manage their allocation all would be fine |
14:49:49 | FromDiscord | <mratsim> so the difference is optional vs mandatory. |
14:50:08 | FromDiscord | <dom96> And I would argue that as a systems programming language this should be made possible |
14:50:53 | FromDiscord | <mratsim> there are a couple of solutions:β΅- some "liftLocals" that accept a var openarray as a serialization destinationβ΅- closures with an allocator parameter |
14:51:53 | Zevv | mratsim: I still have missing pieces in my mental image |
14:52:12 | FromDiscord | <dom96> Yeah, it would be awesome if we could have those solutions π |
14:52:19 | FromDiscord | <dom96> Maybe I should write an RFC hmm |
14:52:21 | Zevv | just like disruptek noted earlier: we can put our things in your var openarray, but how would that handle "native" strings and seqs |
14:52:28 | Zevv | these are still GC managed |
14:52:50 | FromDiscord | <mratsim> The thing is, I'm sure cooldome actually has that, I think he is the only user of the "owner" macro and liftLocals pragma |
14:53:31 | FromDiscord | <mratsim> but I don't know how to compose both into something for custom closures. |
14:54:11 | FromDiscord | <dom96> Perhaps what we really need is custom allocators ala Zig/Jai |
14:54:20 | FromDiscord | <mratsim> @Zevv, this is my "Isolated" remarkβ΅> I assume those are ref objects only now but in the future they will become Isolated #244 otherwise they can't be moved across threads and a continuation should be owned by a single thread anyway right? |
14:54:24 | FromDiscord | <dom96> But ugh, so many features, makes me sad. |
14:54:43 | Zevv | right, so isolated will be crucial for this, that was my assumption |
14:54:56 | FromDiscord | <mratsim> I don't think we need to go into custom allocators, just provide the tools to workaround limitations |
14:55:11 | FromDiscord | <mratsim> with destructors it's easy enough to write your own "managed" sequence. |
14:55:34 | FromDiscord | <mratsim> but lifting local variables is more involved, so a primitive for this would be helpful. |
14:55:45 | FromDiscord | <dom96> I can see this either being a parameter to newSeq or a global override |
14:55:48 | FromDiscord | <Conquestor> I meant to type in anime- And I typed in nim |
14:55:53 | FromDiscord | <dom96> Both would require a custom allocator to be specified |
14:56:14 | Zevv | mratsim: you mean lifing from nim itself, or lifting from a macro? |
14:56:15 | FromDiscord | <dom96> @Conquestor you are now duty bound to commission an anime artist to draw a Nim mascot |
14:57:15 | FromDiscord | <mratsim> We can have a "SeqInterface" template that accepts a type name and an allocator and do "instantiate(SeqInterface, seq[T], defaultAllocator). |
14:57:43 | FromDiscord | <mratsim> any if someone needs a custom allocator `instantiate(SeqInterface, MySeq[T], MyAllocator)` |
14:57:52 | * | waleee-cl joined #nim |
14:58:19 | FromDiscord | <mratsim> this doesn't pollute the default sequence with allocator parameter, allocator callback or Allocator as a static type. |
14:58:26 | FromDiscord | <mratsim> it's backward compatible. |
14:58:58 | Zevv | but it will add overhead to the type keeping track to the allocator |
14:59:04 | FromDiscord | <mratsim> However it needs the standard library to be written with an "interface"/"concept" perspective instead of catering to an implementation |
14:59:16 | Zevv | we just threw that out a year ago |
14:59:51 | FromDiscord | <mratsim> it won't, MyAllocator.malloc calls are all replaced at compile-time. |
15:00:10 | FromDiscord | <mratsim> it's not a field. |
15:00:20 | Zevv | hm, and likewise the deallocs |
15:00:24 | FromDiscord | <mratsim> it's a template that generates all the proc of something sequence-like. |
15:01:02 | Zevv | how can that work? Will the generated objects be of a distinct type? |
15:01:14 | Zevv | what if I put two things in a container that are allocated by a different allocater |
15:01:17 | Zevv | and GC the container |
15:01:24 | Zevv | how does it know how to dealloc the individial thing |
15:01:25 | Zevv | s |
15:01:26 | FromDiscord | <dom96> I don't think rewriting the stdlib with concepts everywhere is a good idea |
15:01:30 | FromDiscord | <dom96> At least not right now |
15:01:56 | FromDiscord | <mratsim> @Zevv, the use case for 2 similar types with different allocators seem strange |
15:02:06 | FromDiscord | <dom96> A much less intrusive implementation of this would just be a setAllocator() call |
15:02:07 | Zevv | but not impossible |
15:02:22 | FromDiscord | <mratsim> setAllocator is problematic with Nim DLLs |
15:02:29 | FromDiscord | <mratsim> then you need Vtable |
15:02:47 | FromDiscord | <mratsim> just like you need VTable or methods for inherited types in the same container |
15:03:07 | FromDiscord | <dom96> You need the Nim runtime as a DLL anyway, maybe you could build a Nim runtime with a custom allocator |
15:03:17 | FromDiscord | <mratsim> regarding the lifting, it's grabbing variable from the outer scope to make them available in the continuation. |
15:03:43 | FromDiscord | <exelotl> Yo can we get TysonTan to do the Nim mascot |
15:03:53 | FromDiscord | <mratsim> but in complex application you might need 1 allocator per event loop. One allocator for async, one for CPU-bound tasks. |
15:04:22 | FromDiscord | <Clyybber> disruptek: has carnac evolved from a minimal repro? |
15:04:30 | FromDiscord | <mratsim> anyway this should likely be in "#internals" |
15:04:43 | FromDiscord | <dom96> nah |
15:05:45 | FromDiscord | <dom96> Hm, I can't imagine a scenario where I'd need more than 1 allocator in my app. But seems like an edge case in any case. |
15:05:58 | FromDiscord | <dom96> If we were to provide `setAllocator` it would already go a long way |
15:06:09 | FromDiscord | <dom96> for those edge cases we could also allow a custom allocator passed to newSeq etc. |
15:09:07 | Zoom[m] | <FromDiscord "<dom96> I don't think rewriting "> From what I gathered about std this is unavoidable in the long run. ATM there's some duplicating functionality implemented in slightly different ways to work with different types. |
15:11:14 | FromDiscord | <lqdev> oh wow this is the first time in my life that `with` actually worked |
15:11:24 | FromDiscord | <lqdev> and i tried like, 5 times already |
15:12:30 | FromDiscord | <exelotl> lol glad I'm not the only one who had trouble with it |
15:12:53 | FromDiscord | <lqdev> notably it has problems with modifying arrays |
15:13:16 | FromDiscord | <lqdev> PMunch please make the playgrond's text field autofocus ._. |
15:13:27 | FromDiscord | <lqdev> (edit) "playgrond's" => "playground's" |
15:13:32 | FromDiscord | <dom96> Zoom: yeah, quite likely. But not something to focus on right now in order to get custom allocators. |
15:13:40 | FromDiscord | <zetashift> shouldn't be hard to PR to the playground right? |
15:14:10 | FromDiscord | <lqdev> a simple example like this fails miserably https://play.nim-lang.org/#ix=2HRa |
15:14:22 | FromDiscord | <lqdev> like, come on⦠|
15:17:31 | FromDiscord | <zetashift> think karax uses `setFocus` and i needs to be hooked up to `editor`? |
15:17:35 | FromDiscord | <dom96> @lqdev guess not many are using it, seems like a nice intro to fixing bugs in the compiler though |
15:17:43 | FromDiscord | <zetashift> (edit) "i" => "it" |
15:21:22 | * | kenran joined #nim |
15:47:15 | ForumUpdaterBot | New thread by Saem: Perceus: Garbage free reference counting with reuse, see https://forum.nim-lang.org/t/7250 |
15:48:00 | FromDiscord | <shadow.> can anyone look over my day 12 part two logic |
15:48:13 | FromDiscord | <shadow.> https://play.nim-lang.org/#ix=2HRw |
15:48:17 | FromDiscord | <shadow.> (for aoc) |
15:48:34 | FromDiscord | <shadow.> `type Vector = tuple[x, y: int]` |
15:50:09 | FromDiscord | <Recruit_main707> why a tuple |
15:51:31 | FromDiscord | <shadow.> idk why not |
15:52:03 | mipri | with tuples you get terse initialization but still have names for fields. |
15:52:23 | FromDiscord | <shadow.> yeah i think that's why i chose it iirc |
15:52:24 | FromDiscord | <shadow.> lmfao |
15:52:53 | FromDiscord | <pietroppeter> @shadow: from the look of it seems nice (clean and effective). Are you having issues? |
15:52:58 | FromDiscord | <shadow.> i can do `var x: array[5, Vector] = [(0, 1), (1, 0), (5, 10), (2, 12), (11, 023)]` |
15:53:01 | FromDiscord | <shadow.> well |
15:53:07 | FromDiscord | <shadow.> it works for the test given |
15:53:10 | FromDiscord | <shadow.> but on my input it says too low |
15:53:42 | FromDiscord | <pietroppeter> Usually it is an off by one error, but I would go with echo and try the test example... |
15:53:46 | mipri | at a guess, the bug isn't there, but is in the initial values of your waypoint |
15:54:05 | FromDiscord | <shadow.> hmm |
15:54:11 | FromDiscord | <shadow.> (10, 1)? |
15:54:18 | FromDiscord | <shadow.> east 10 and north 1 iirc |
15:54:34 | mipri | yep, that's right. |
15:54:57 | FromDiscord | <shadow.> hmm |
15:55:00 | FromDiscord | <shadow.> how odd |
15:55:17 | mipri | well it was a guess after all. |
15:55:42 | FromDiscord | <shadow.> and the response is the manhanttan distance of (0, 0) with the ship's position? |
15:55:54 | FromDiscord | <shadow.> diff of (0, 0) and ship pos |
15:55:58 | mipri | it's the same as with part1, yes |
15:56:03 | FromDiscord | <shadow.> weird |
15:57:03 | FromDiscord | <sealmove> guys, i am creating an object which has a variant and i assign a value to the variant after its creating. i think I am observing some weird behavior because of this. is it likely? |
15:57:12 | FromDiscord | <Bimbo> Is there any library for nim that can handle playback of music files? I want to try making a clone of cmus for fun and couldn't find anything relevant |
15:59:54 | mipri | 'nimble search music' has some modules |
16:00:59 | FromDiscord | <shadow.> even odder, my part one is screwed up now but ill figure that out later... |
16:01:04 | FromDiscord | <shadow.> still confused on why part two is wrong |
16:01:05 | FromDiscord | <pietroppeter> @shadow you sure is it parsing the complete input (do you have \n at the end)? |
16:01:10 | FromDiscord | <shadow.> yes i do |
16:01:14 | FromDiscord | <shadow.> it'd raise an assertion error tho |
16:01:18 | FromDiscord | <shadow.> if it was unparsable |
16:01:30 | FromDiscord | <shadow.> since im using npeg |
16:01:44 | FromDiscord | <pietroppeter> Again I would echo stuff out |
16:01:47 | FromDiscord | <shadow.> for instance? |
16:02:11 | FromDiscord | <pietroppeter> What is parsing, ship position and waypoint after each iteration |
16:02:17 | FromDiscord | <pietroppeter> And test on example |
16:02:33 | FromDiscord | <shadow.> example worked lol |
16:02:43 | FromDiscord | <shadow.> that's the confusing part |
16:02:43 | mipri | the last time I used npeg, it was quite a while ago, but I had to explicitly match * !1 to ensure that I parsed the entire input |
16:02:51 | FromDiscord | <shadow.> hmm |
16:02:52 | FromDiscord | <shadow.> i haven't had that issue before |
16:03:08 | FromDiscord | <shadow.> yeah that gave same answer |
16:03:30 | FromDiscord | <shadow.> pietro, if you've solved it would you mind telling me a ballpark of how far off i am on my input so i can see how to fix it? |
16:03:44 | FromDiscord | <shadow.> i can send you input if you'd like |
16:04:03 | FromDiscord | <pietroppeter> On the phone right now but you can find my solution on my advent of Nim repo |
16:04:08 | FromDiscord | <shadow.> ah ok fair enough thanks |
16:05:19 | FromDiscord | <shadow.> nvm i dont wanna see the exact answer lol |
16:05:20 | FromDiscord | <shadow.> ill figure it out |
16:06:02 | FromDiscord | <pietroppeter> Yeah you will! π let us know! |
16:07:24 | FromDiscord | <shadow.> so ive done some echos |
16:07:27 | FromDiscord | <shadow.> left rotation looks like this |
16:07:37 | FromDiscord | <shadow.> sent a long message, see http://ix.io/2HRV |
16:07:37 | FromDiscord | <shadow.> that seems correct |
16:07:53 | FromDiscord | <shadow.> 3 90-deg right rotations for a left rotation of 90 |
16:07:57 | FromDiscord | <shadow.> so i guess i can check that off lmao |
16:10:04 | * | letto quit (Quit: Konversation terminated!) |
16:10:22 | FromDiscord | <shadow.> alr N S E W L R seem to all be working |
16:10:30 | FromDiscord | <shadow.> issue must be with forward or at the beginning / end of code |
16:12:20 | FromDiscord | <Clyybber> disurptek: pong |
16:12:42 | * | NimBot joined #nim |
16:12:51 | * | letto joined #nim |
16:13:06 | Zoom[m] | @shadow. I've left 2 ways to deal with CCW rotation in my code |
16:15:06 | Zoom[m] | One is converting it to CW first (360-x), the other one is just an if and mod operation (floorDiv) |
16:15:33 | FromDiscord | <shadow.> yeah i've done that too |
16:15:44 | FromDiscord | <shadow.> i just do 360 - x |
16:15:55 | FromDiscord | <shadow.> > ship at (x: 2, y: 8) waypoint at (x: 7, y: 8)β΅> moving ship to waypoint 81 timesβ΅> ship at (x: 569, y: 656) waypoint at (x: 7, y: 8)β΅this looks correct, right? |
16:16:50 | FromDiscord | <shadow.> yeah thats correct im so confused |
16:17:21 | mipri | yeah that's correct. |
16:17:40 | FromDiscord | <shadow.> FUCK |
16:17:54 | FromDiscord | <shadow.> `abs shipPos.x + abs shipPos.y` -> `abs(shipPos.x) + abs(shipPos.y)` |
16:17:56 | FromDiscord | <shadow.> that was the issue |
16:17:58 | FromDiscord | <shadow.> of course it was |
16:18:25 | FromDiscord | <shadow.> LMAO |
16:18:28 | mipri | ah yeah, command syntax. |
16:18:43 | FromDiscord | <dom96> ouch |
16:18:52 | FromDiscord | <shadow.> lmfao |
16:19:07 | FromDiscord | <shadow.> time to upload to github |
16:19:49 | FromDiscord | <shadow.> !repo shadowninja55/aoc-2020 |
16:19:50 | disbot | https://github.com/shadowninja55/aoc-2020 -- 9aoc-2020: 11my attempt at advent of code 2020 in nim. 15 1β 0π΄ |
16:19:56 | FromDiscord | <shadow.> i actually think my day 12 was quite elegant |
16:20:18 | FromDiscord | <shadow.> > for _ in 1..(num div 90):β΅> swap(wpPos.x, wpPos.y)β΅> wpPos.y = -1β΅i just whipped open a graphing calculator to figure that out lol |
16:30:50 | FromDiscord | <shadow.> how can i read the nth line of a file? |
16:31:21 | mipri | read n-1 lines, and then read the next one. read the entire file and split it by lines. |
16:31:40 | FromDiscord | <shadow.> ohh ok fair enough |
16:31:46 | FromDiscord | <shadow.> thanks |
16:31:59 | mipri | there aren't really any clever options unless you deal with unusual files. |
16:37:05 | FromDiscord | <sealmove> `tuple[genedSym: int]` what `NimSymKind` do I use for it? |
16:37:14 | FromDiscord | <sealmove> `nskField`? |
16:45:42 | FromDiscord | <sealmove> Ok `nskField` works |
16:50:19 | FromDiscord | <shadow.> can you index an ordered table with an int? |
16:50:25 | FromDiscord | <shadow.> or is it only ordered in terms of iteration |
16:52:09 | Zevv | you good npeg wise shadow? |
16:52:17 | mipri | yeah, just iteration |
16:52:25 | Zevv | k |
16:52:30 | FromDiscord | <shadow.> and yes im good on npeg thanks |
16:52:39 | FromDiscord | <shadow.> it's very intuitive lol |
16:52:58 | Zevv | nice |
16:55:54 | FromDiscord | <Clyybber> Zevv: since disruptek is gone, can you tell me which cps bugs are still valid? |
16:56:00 | FromDiscord | <Clyybber> or how to repro them |
16:57:08 | FromDiscord | <shadow.> how do i enumerate an iterator? |
16:58:04 | FromDiscord | <shadow.> im trying to enumerate `string.split()` |
16:58:10 | FromDiscord | <shadow.> from `strutils` |
16:58:31 | mipri | are you looking for std/enumerate ? |
16:58:54 | FromDiscord | <shadow.> probably |
16:59:58 | mipri | !eval import std/enumerate; for (i, n) in enumerate([1]): echo (i, n) |
17:00:01 | NimBot | (0, 1) |
17:01:38 | FromDiscord | <shadow.> im guessing you can't brute force day 13? |
17:01:39 | FromDiscord | <shadow.> 12 |
17:03:14 | mipri | supposedly day 13 part 2 is amenable to DP techniques as well. |
17:04:18 | FromDiscord | <shadow.> fuck im awful at DP |
17:04:26 | FromDiscord | <shadow.> for day 10 i just used statistics lmfao |
17:04:52 | FromDiscord | <dom96> Ahh DP, why is this problem tricky for DP? |
17:05:45 | mipri | well I reckon about 99% of the gold stars discussed it, saw that they had to use a specific algorithm (not DP related anymore), and then implemented that by rote copying an implementation online, and are now congratuling themselves for having persevered and having 'learned' this algorithm that they will forget entirely because it's so narrowly useful (once per year in AoC events) |
17:05:59 | mipri | yeah I'm mad about today as well. |
17:06:23 | FromDiscord | <shadow.> rip |
17:06:36 | FromDiscord | <mratsim> dynamic programming is the worst technique name ever |
17:06:40 | FromDiscord | <shadow.> right now im just trying to brute force on intervals of the highest bus id or so |
17:06:47 | FromDiscord | <shadow.> im guessing that will not suffice |
17:07:19 | FromGitter | <fish-face> Could someone help me understand why the following does not compile: https://dpaste.com/8DMBL7LLM ? Error is a type mismatch on line 13: `got <seq[int], string> but expected one of: proc `[]`(s: RefSeq; p: string): int` - why is `rs` a `seq[int]` not a `RefSeq` (or `ref seq[int]`) |
17:07:51 | mipri | no, any brute force worthy of the 'brute' term isn't going to suffice. |
17:08:06 | FromDiscord | <shadow.> fair enough |
17:08:44 | FromDiscord | <mratsim> @fish-face just use type RefSeq {.shallow.} = object; data: seq[int] |
17:09:42 | FromDiscord | <mratsim> this is what I have been using for 3 years in Arraymancer https://github.com/mratsim/Arraymancer/blob/v0.6.1/src/arraymancer/tensor/data_structure.nim#L21-L30 until I dropped down to pointer + length this week |
17:11:25 | disruptek | clyybber: carnac demonstrates the bug i'm working on now. |
17:11:37 | FromDiscord | <mratsim> Nim has autodereferencing of "ref" in some cases and it might be triggered on your last line |
17:11:55 | FromDiscord | <mratsim> ah |
17:12:07 | FromDiscord | <Clyybber> disruptek: Oh cool, which one is it? |
17:12:44 | mipri | >The . (access a tuple/object field operator) and [] (array/string/sequence index operator) operators perform implicit dereferencing operations for reference types |
17:13:24 | Zoom[m] | PMunch made me feel good, saying the proper solution to today's aoc P2 is "super clever" in his stream :3 |
17:13:31 | disruptek | custom allocators aren't a problem for arc. |
17:14:15 | * | FromDiscord quit (Remote host closed the connection) |
17:14:32 | * | FromDiscord joined #nim |
17:16:22 | Zoom[m] | Can we have a nice compiler error for tuple unpacking in For loops? |
17:17:44 | disruptek | clyybber: the bug is that the body of the proc it rewrites reaches the backend without having been sem'd. |
17:17:47 | FromDiscord | <shadow.> https://play.nim-lang.org/#ix=2HSl |
17:17:51 | disruptek | parts of it, anyway. |
17:17:53 | FromDiscord | <shadow.> mipri: so im guessing this is too inefficient |
17:19:29 | mipri | you can see how long it takes on the test input for part 2. |
17:20:46 | FromDiscord | <shadow.> instant |
17:20:50 | disruptek | dom96: the reason you might want separate allocators is to impl regions, pools, x-device memory, or, like, a million other things. allocating memory is a kinda basic operation that is nice to be able to control. |
17:21:17 | FromDiscord | <shadow.> hmm im guessing im gonna need some sort of math in here to implement skipping ahead |
17:21:25 | FromDiscord | <Clyybber> disruptek: Ah, is it the result of a macro and if so what is the return type of that macro? |
17:21:56 | disruptek | i dunno, and the return type doesn't matter. even the proc itself is unsem'd. |
17:22:07 | disruptek | in the carnac test, it's a fibonnaci. |
17:22:27 | disruptek | it's a macro result, yes. carnac is a proc macro. |
17:22:33 | disruptek | it's well-commented, too. |
17:23:00 | disruptek | it memos your func calls and their results, loading and storing the cache from disk at runtime. |
17:23:08 | disruptek | that's it. |
17:23:43 | FromDiscord | <Clyybber> cool, where are you at currently? |
17:23:52 | FromDiscord | <Clyybber> investigating or minimizing? |
17:26:20 | FromDiscord | <dom96> > allocating memory is a kinda basic operation that is nice to be able to control.β΅agreed. It would be nice if we could get support for custom allocators in Nim. |
17:26:59 | disruptek | dom96: arc makes custom allocators about as easy as they could be. |
17:27:13 | disruptek | i looked at the site of the crash and noted that the codegen input was not sem'd. |
17:27:24 | disruptek | i asked araq wtf that was about and he said, "probably something bugged in nfSem". |
17:27:29 | disruptek | i haven't looked at it since then. |
17:27:35 | disruptek | there's no point to minimizing; it's pretty damned minimal, by design. |
17:27:47 | disruptek | sorry; my network is such shit i dunno what made it through. |
17:27:58 | FromGitter | <fish-face> mipri: ah I see, how do you control when/whether that happens? I think I am having performance issues due to copying large structures but am having trouble testing? Is that what @mratsim's `{.shallow.}`does? |
17:28:24 | mipri | {.shallow.} gives you reference semantics on assignment yes |
17:28:34 | FromDiscord | <Clyybber> disruptek: so you are working on it? |
17:28:37 | disruptek | dom96: you could, like, define an allocator just for a single scope. |
17:28:38 | FromDiscord | <mratsim> Nim sequences have value semantics by default. {.shallow.} make them having reference semantics and so they share by default insstead of copying. |
17:28:38 | FromDiscord | <Clyybber> or is it up for the taking |
17:28:51 | mipri | --gc:arc --expandArc:blah helps a lot to reveal unexpected copying |
17:29:03 | disruptek | clyybber: we can work on it together, but i am prostituting myself today, so i might not be so helpful. |
17:29:25 | FromDiscord | <Clyybber> disruptek: cool |
17:29:39 | mipri | as for controlling the automatic dereferencing, I think you'd have to use distinct or a wrapper object so you can get the [] you want |
17:29:40 | disruptek | it's one of this bugs that is probably simple, but the problem is not where you first look. |
17:30:04 | disruptek | so, like, we just have to work backwards and the solution will probably fall out on the floor. |
17:30:10 | FromDiscord | <Clyybber> yeah |
17:30:22 | FromDiscord | <shadow.> welp got it |
17:30:23 | disruptek | this is one of the cps blockers. |
17:30:34 | FromDiscord | <shadow.> but i agree, that chinese remainder theorem shit is only going to be used this one time |
17:30:38 | FromDiscord | <shadow.> i dont see how that's a good challenge lmfao |
17:30:41 | FromDiscord | <dom96> disruptek: does this mean it's possible to specify what allocator closures use? |
17:31:04 | FromDiscord | <Clyybber> @dom96 not yet afair |
17:31:06 | disruptek | also, i did confirm that the test passes when you take the macro out of the test and just compose it manually. |
17:31:17 | disruptek | or, compose it from the macro output, i mean. |
17:31:33 | disruptek | dom96: you could do that, yes. |
17:31:34 | FromDiscord | <Clyybber> compose as in result = newTree(...) ? |
17:31:41 | FromDiscord | <Clyybber> or compose as in write it down |
17:31:53 | disruptek | like, i dumped the macro output and then put it in a file and ran it. |
17:32:04 | FromDiscord | <Clyybber> ah, yeah that works of course |
17:32:30 | disruptek | http://ix.io/2HSv/nim |
17:32:36 | FromDiscord | <dom96> If it's possible then mratsim should have been able to use that instead of writing his own implementation of closures, and I think this would apply to the CPS work as well. |
17:32:53 | FromDiscord | <Clyybber> writing your own closures isn't that hard or bad IMO |
17:33:20 | FromDiscord | <KingDarBoja> sent a code paste, see https://play.nim-lang.org/#ix=2HSx |
17:33:22 | FromDiscord | <Clyybber> but the code to get the locals is probably good to share |
17:33:30 | disruptek | it could be the best solution for alloc, yes, but you still need to rewrite the control-flow. |
17:33:50 | disruptek | yeah, i plan to make it use more of the compiler's code once it stabilizes. |
17:33:59 | FromDiscord | <KingDarBoja> sent a code paste, see https://play.nim-lang.org/#ix=2HSy |
17:34:02 | disruptek | then cps will be harder to break during compiler changes. |
17:34:19 | FromDiscord | <KingDarBoja> But AFAIK I am not reassigning inside the loop so, what's the deal with this new error? |
17:34:38 | disruptek | just remember that with cps, the memory stuff isn't the interesting part. π |
17:35:16 | FromDiscord | <dom96> oh? |
17:50:38 | FromGitter | <fish-face> so the docs seem to imply that `{.shallow.}` is unsafe - does this essentially mean you shouldn't store shallow refs |
17:50:56 | FromGitter | <fish-face> because when the original var goes out of scope it'll be GCd or so? |
17:52:37 | mipri | surprising mutation at a distance kind of memory safety |
17:53:29 | * | a_chou joined #nim |
17:56:56 | FromGitter | <fish-face> oh right |
17:57:04 | FromGitter | <fish-face> not segfault unsafety? |
17:57:12 | * | a_chou quit (Remote host closed the connection) |
17:59:48 | FromDiscord | <Clyybber> disruptek: does it pass through afterCallActions? |
18:00:15 | FromDiscord | <Clyybber> disruptek: And does it only happen when you use the macro as a pragma? |
18:01:47 | * | abm joined #nim |
18:01:55 | mipri | https://play.nim-lang.org/#ix=2HSH - seems to copy it anyway, weird. |
18:03:01 | FromGitter | <fish-face> mipri: what version/etc do you get the arc gc? |
18:04:37 | mipri | you mean what's the oldest version that has it? 1.2 has --gc:arc |
18:07:19 | FromGitter | <fish-face> yeah. OK, my distro gave me 1.0.4 apparently |
18:09:54 | * | thomasross joined #nim |
18:11:40 | FromDiscord | <mratsim> @fish-face it's considered unsafe as in ref are unsafe as well because of sharing updates. |
18:12:02 | FromDiscord | <mratsim> and no if the original goes out of scope it won't be collected |
18:12:13 | FromDiscord | <mratsim> it's refcounted like other nim ref types |
18:14:14 | FromDiscord | <mratsim> @dom96 @disruptek, @Clyybber, I think I missed a beat, what is Carnac, how do you custom allocate a closure is that loadCache/storeCache? and where is that lift locals code? |
18:15:16 | FromDiscord | <Clyybber> @mratsim carnac is a memoization macro that demonstrates a compiler bug that is blocking the typed cps macro |
18:15:31 | FromDiscord | <mratsim> ok |
18:17:05 | FromDiscord | <Quibono> Could you write an iOS app in Nim? |
18:18:45 | FromDiscord | <dom96> yep |
18:22:25 | FromDiscord | <Quibono> Lol is it a PITA? |
18:23:57 | FromDiscord | <Quibono> Trying to decide if I just need to learn swift. |
18:26:40 | mipri | that's obviously going to be where the resources, frameworks, tooling, tutorials, Q&A, etc. are. |
18:27:53 | mipri | this is one of those questions where asking the question is your answer. You don't know the platform well enough to say if you could do an app in Nim, so you need all that stuff, so you can't do an app in Nim. |
18:28:22 | FromDiscord | <Quibono> Yeah fair. |
18:29:51 | FromDiscord | <Quibono> Working on this thing that my father thinks should be an app, Iβd rather just have it in a webpage but he wants it to function offline lol |
18:30:43 | FromDiscord | <mratsim> Someone wrote a game on iOS that was omewhat popular |
18:31:01 | * | PMunch joined #nim |
18:31:37 | FromDiscord | <Quibono> In Nim? Huh. |
18:31:50 | disruptek | https://github.com/disruptek/nimph/issues/143 |
18:31:51 | disbot | β₯ nimph is racist |
18:32:13 | disruptek | c'mon people, get a fucking grip. |
18:34:23 | * | leorize quit (Ping timeout: 240 seconds) |
18:40:20 | leorize[m] | lol are you referring about nimph not understanding default branches other than master? |
18:40:45 | mipri | it's really useful to be aware of what other people are psyching themselves up to do, because they're so prepared to do that thing that they'll do it when it doesn't make sense, or on the slightest stimuli |
18:41:06 | mipri | kind of like how you can hear almost pure static and then turn your head to see who just called your name. Nobody called your name; you're just super prepared to hear it. |
18:41:39 | mipri | these people are psyching themselves up to solve all the world's problems by delivering an inspiring speech in front of a crowd that will start clapping really slowly and then speed up. |
18:43:15 | mipri | (so if you want them to go away one tactic is to just applaud them for their wise words and then not do anything.) |
18:46:09 | leorize[m] | disruptek: how's IC going? is it stable enough to start writing tooling around packed ast? |
18:48:06 | disruptek | yes. |
18:48:51 | disruptek | the word `master` doesn't appear in the nimph source. |
18:49:55 | disruptek | maybe i'll just close this issue and let a legit user report a bug, if one is discovered. |
18:50:25 | voidpi | or wait until april's 1 to put it on |
18:50:29 | FromDiscord | <UNIcodeX> "master" and "slave" are terms that are used in other industries with no malice intended. One example is a "slave cylinder" in a car. |
18:50:50 | disruptek | leorize[m]: the main problem you'll run into is that only araq is working on ic and he doesn't really collaborate. π |
18:50:57 | FromDiscord | <Daniel> What about color words, like white, black, green, red, ....etcβ΅In a way, you could label everything as racist , or some other format of conflict. |
18:51:09 | disruptek | it's ridiculous, of course. |
18:51:11 | FromDiscord | <UNIcodeX> also... slavery is not something that affects a singular race. It's an issue that plagues all of humanity; people from all walks of life. |
18:51:20 | FromDiscord | <Daniel> In this context fish a racist, for example big white shark |
18:51:24 | FromDiscord | <UNIcodeX> therefore... not "racist" as asserted |
18:51:28 | FromDiscord | <Daniel> (edit) "a" => "are" |
18:51:59 | * | leorize joined #nim |
18:52:08 | FromDiscord | <Daniel> exactly, slavery is bad, no mater what living organism it applies to |
18:52:26 | FromDiscord | <UNIcodeX> succinctly, yes. indeed. |
18:54:55 | disruptek | don't knock it until you've tried it. |
18:55:21 | disruptek | sexual slavery has its ups and downs, and for some it's a hard, hard life. for others, it's orgasmic. |
18:55:49 | disruptek | but this has nothing to do with anything. |
18:56:00 | disruptek | the point is, you can't let an ideology own your language. |
18:56:44 | FromDiscord | <UNIcodeX> I mean. some people get down like that, but that's their business. π |
18:57:12 | FromDiscord | <UNIcodeX> (edit) "business." => "business (if they like being commanded, etc..)." |
18:57:15 | FromDiscord | <Daniel> (edit) exactly, (forced) slavery is bad, no mater what living organism it applies to |
18:57:46 | FromDiscord | <Daniel> (edit) exactly, (forced) slavery is bad, no mater what living organism it is applied to |
19:00:51 | FromDiscord | <Quibono> I mean I think itβs a small change to make people feel included. |
19:00:56 | * | vesper11 quit (Ping timeout: 256 seconds) |
19:01:01 | FromDiscord | <Quibono> But yeah you can take it too far |
19:05:59 | FromDiscord | <Quibono> And @disruptek we all let ideology control our language, you just happen to disagree with this one. |
19:12:27 | FromDiscord | <de_inferno> Okay then let's rename all functions and variables into non existant words to confuse everyone instead, profit |
19:20:26 | FromDiscord | <UNIcodeX> These conversations typically don't end well anyway so maybe we should move on. |
19:21:57 | Zevv | narimiran: you made that up yourself? |
19:22:07 | narimiran | Zevv: yes |
19:22:11 | Zevv | pfff |
19:22:18 | narimiran | after two hours of pain |
19:22:40 | Zevv | how long does it take |
19:23:03 | narimiran | to run? less then 1ms |
19:23:08 | Zevv | i don't even understand why it works I guess :) |
19:23:15 | Zevv | I spent an hour and gave up |
19:24:02 | * | MightyJoe quit (Quit: I'm out!) |
19:28:53 | * | fredrikhr joined #nim |
19:31:44 | PMunch | Hurrah, I figured out day two :) |
19:32:30 | Zoom[m] | Didn't you have the stars for D2 already? |
19:32:41 | PMunch | What do you mean? |
19:33:43 | * | fredrikhr quit (Read error: Connection reset by peer) |
19:35:14 | narimiran | Zevv: i knew immediately about CRT, but the last time i encountered it was in 2017 (also AOC). so i knew what to search for, but not how to implement it |
19:35:38 | narimiran | Zevv: so i went to solve some simple examples on pen and paper, and then it dawned on me |
19:36:14 | Zoom[m] | I mean you have the starts, you solved it already |
19:36:47 | Zoom[m] | narimiran: the same for me! Forgot about CRT completely, even though I heard of it |
19:37:05 | Zevv | Well, I got the basics, buses being obviously prime, tried something smart with math.lcm |
19:37:19 | Zevv | but I must admit CRT is not in my ready-cookbook |
19:37:23 | narimiran | yeah, LCM of primes is..... well....... |
19:37:38 | Zoom[m] | The thing is, it's not necessary to solve it |
19:37:45 | narimiran | Zoom[m]: exactly |
19:38:12 | Zoom[m] | I'm pretty pleased with how I figured this one and path searching for adapters |
19:38:23 | Zevv | yeah but that one I got in a few mins |
19:39:16 | Zoom[m] | My version for today is still 2x loc over narimiran's. Although I have tests |
19:39:57 | Zevv | i'm reading mirans, but i don't see it |
19:40:04 | Zevv | nevermind, tomorrow's a new day |
19:40:05 | Zevv | :) |
19:44:04 | Zoom[m] | By the way, if I want to pass some distinct type, such as a named tuple, as an expression, how can I specify the type? |
19:44:38 | FromDiscord | <fwsgonzo> is there GDB support for Nim? |
19:44:39 | PMunch | Zevv, mine is similar, but easier to read :P |
19:44:52 | PMunch | @fwsgonzo, yes |
19:45:58 | Zevv | PMunch: I look at yours and still don't know why it works |
19:47:32 | PMunch | You start stepping with the first bus' offset, then when the next bus matches you know that the next such match can only occur at the current offset * this bus' number. |
19:47:40 | FromDiscord | <lqdev> @Zoom wdym? |
19:47:50 | FromDiscord | <lqdev> you can try doing `x: type YourType` |
19:48:15 | Zoom[m] | No variable |
19:48:46 | FromDiscord | <lqdev> it only works with proc/template/macro params |
19:48:53 | Zoom[m] | I mean to specify the type on the "sending side", such as the end of a block |
19:49:01 | FromDiscord | <lqdev> oh |
19:49:06 | PMunch | So you loop with this as your offset, until you find the third bus that matches. You know that the next time they all match is as current offset * this bus' number so you continue looping with this as your offset |
19:49:09 | Zevv | PMunch: ah right, how elegant |
19:49:11 | FromDiscord | <lqdev> i don't think that's possible |
19:49:19 | FromDiscord | <lqdev> at the end of a block |
19:49:19 | PMunch | Zevv, yeah it's pretty neat :) |
19:49:21 | FromDiscord | <lqdev> though maybe |
19:49:34 | Zevv | funny I totally was not able to think of that myself |
19:50:00 | FromDiscord | <lqdev> @Zoom it totally works https://play.nim-lang.org/#ix=2HTm |
19:50:00 | Zevv | y'all much smarter anyways |
19:50:02 | PMunch | I was just throwing ideas on the wall until something stuck :P |
19:51:18 | Zoom[m] | @lqdev eh, this is probably not what I want |
19:52:40 | Zoom[m] | @lqdev I have a named tuple and I want to end an expression with it, specifying it's a distinct tuple |
19:52:53 | * | abm quit (Read error: Connection reset by peer) |
19:53:32 | Zoom[m] | That's used all the time for basic FP style ops, like map |
19:53:53 | FromDiscord | <lqdev> https://play.nim-lang.org/#ix=2HTo |
19:56:15 | Zoom[m] | That probably should work, and I'm not sure why it didn't. Probably I was doing something wrong |
19:57:29 | Zoom[m] | Or I was looking for a way to do it without full type construction (it could be tedious with large number of fields), and just add some tick to the tuple, as we can do with number literals |
20:09:16 | * | narimiran quit (Ping timeout: 256 seconds) |
20:10:53 | * | Jesin quit (Quit: Leaving) |
20:11:05 | * | fredrikhr joined #nim |
20:12:40 | * | Jesin joined #nim |
20:15:14 | * | PMunch quit (Quit: leaving) |
20:23:48 | * | hnOsmium0001 joined #nim |
20:26:37 | * | nyaayaya joined #nim |
20:31:56 | * | habamax quit (Ping timeout: 240 seconds) |
21:04:04 | FromDiscord | <kodkuce> i wanted to fallow result thing insted using return but i get Error: undeclared identifier: 'result' |
21:04:17 | FromDiscord | <kodkuce> hmm, wtf am i doing wrong |
21:04:47 | FromDiscord | <kodkuce> oh i know i am tard i dident declere retrun value in proc def |
21:39:02 | * | nyaayaya quit (Remote host closed the connection) |
21:39:19 | * | disruptek throbs. |
21:40:13 | disruptek | clyybber: does carnac work now? |
21:40:36 | FromDiscord | <Clyybber> disruptek: dunno? |
21:40:47 | FromDiscord | <Clyybber> disruptek: Did you see my earlier questions |
21:41:00 | FromDiscord | <Clyybber> does it only happen when you use the macro as a pragma? |
21:41:59 | disruptek | i dunno what afterCallActions is. |
21:41:59 | disruptek | i haven't tried it otherwise. |
21:42:37 | disruptek | it's in the wrong scope if i pass it to the macro as an argument. |
21:42:41 | FromDiscord | <kodkuce> hmm am back doing advent of code so am at day 4, i have question can i split on double newlines, like want to split when row is empty to get pasport groups |
21:42:56 | disruptek | splitWhitespace from strutils |
21:44:48 | FromDiscord | <Clyybber> disruptek: WDYM? |
21:44:52 | FromDiscord | <kodkuce> that splits on any whities, i wanted to split only when row is empty |
21:45:08 | FromDiscord | <kodkuce> guess will just for loop it or something |
21:45:20 | FromDiscord | <kodkuce> or read and process |
21:45:25 | FromDiscord | <Clyybber> disruptek: Can you try calling the macro normally |
21:47:14 | disruptek | the nodes aren't tagged as nfSem. |
21:47:45 | disruptek | i will try calling it "normally" now. |
21:47:48 | FromDiscord | <19> is copyMem == memcpy ? |
21:48:33 | disruptek | that compiles, at least. |
21:48:55 | FromDiscord | <Clyybber> disruptek: So it works? |
21:49:00 | FromDiscord | <Clyybber> @19 yeah |
21:50:18 | disruptek | yeah, that seems fine, but it doesn't work because the proc isn't in the same scope as its invocation. |
21:50:47 | disruptek | http://ix.io/2HUa/nim |
21:51:52 | disruptek | codegen looks fine. |
21:52:29 | disruptek | you can remove my testes from your end if you want. |
21:52:53 | disruptek | i mean, if it helps you finish. |
21:54:23 | FromDiscord | <Clyybber> disruptek: I haven't started yet |
21:54:32 | FromDiscord | <Clyybber> just trying to tickle out what exactly the issue is |
21:55:26 | FromDiscord | <Clyybber> disruptek: I don't know what you mean with it isn't in the same scope |
21:55:54 | FromDiscord | <Clyybber> doesn't testes return a proc definition for fib1 ? |
21:56:34 | disruptek | well, the code i pasted doesn't work because fib2 is not defined at the point of invocation. |
21:57:08 | disruptek | testes doesn't rewrite the procs, really, but again, you can remove my testes; s/testes:/when true:/ |
21:57:24 | FromDiscord | <Clyybber> ok |
21:57:51 | FromDiscord | <Clyybber> and what does carnac do? |
21:58:02 | FromDiscord | <Clyybber> it returns a proc definition right? |
21:58:08 | disruptek | yeah. |
21:58:42 | FromDiscord | <Clyybber> and that proc is fib2? |
21:58:45 | disruptek | it's commented, but you can just read the "manual" version which compiles and runs correctly. |
21:58:56 | disruptek | yes, fib2. |
21:59:05 | FromDiscord | <Clyybber> so it should be in scope |
22:00:10 | disruptek | hmm, with expandMacros it /is/ in scope, but i get a nil deref at compile-time. |
22:00:36 | * | disruptek removes his testes. |
22:01:14 | disruptek | it's running now. time to find out if it works this way. |
22:01:26 | disruptek | how did you know pragmas would be special? |
22:01:34 | FromDiscord | <Clyybber> intuition |
22:01:41 | FromDiscord | <Clyybber> and I skimmed the code once I think |
22:02:07 | disruptek | sucks. |
22:02:27 | disruptek | no runtime error. now i have to instrument it to see if it actually does its carnac magic. |
22:02:36 | disruptek | ah, it doesn't. |
22:02:59 | disruptek | yeah, it's not rewriting it. |
22:03:47 | disruptek | oh, it doesn't think it's a func. |
22:04:19 | disruptek | ah, because it's a stmtlist. |
22:04:21 | disruptek | fun fun fun |
22:04:29 | FromDiscord | <Clyybber> heh |
22:04:42 | FromDiscord | <Clyybber> I assumed your macro can deal with that :D |
22:05:09 | disruptek | okay, still a nil deref at ct. |
22:05:28 | disruptek | same place as the pragma. |
22:05:51 | disruptek | so. problem unchanged from the pragma invocation, after all. |
22:06:25 | * | pbb_ quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
22:06:51 | * | pbb joined #nim |
22:12:48 | FromDiscord | <Clyybber> ok |
22:16:16 | * | idf31 quit (Ping timeout: 240 seconds) |
22:19:11 | * | Vladar quit (Quit: Leaving) |
22:23:52 | * | kenran quit (Quit: leaving) |
22:35:20 | * | tane quit (Quit: Leaving) |
22:35:57 | disruptek | it's my testes that drag it out of scope; because it's not part of the same block, so testes assumes it can capture it as a separate test. |
22:36:02 | disruptek | damn testes. |
22:37:41 | disruptek | easily fixed. |
22:37:47 | disruptek | snip, snip. |
22:42:16 | FromDiscord | <19> can someone tell me what this means: https://i.imgur.com/yh008Ky.png |
22:42:48 | FromDiscord | <19> recursion too deep? |
22:47:37 | FromDiscord | <Clyybber> disruptek: but the carnac issue remains |
22:47:39 | FromDiscord | <Clyybber> right? |
22:47:48 | FromDiscord | <Clyybber> and its a codegen issue, right? |
22:48:01 | disruptek | yes. |
22:48:04 | disruptek | i'm not a miracle worker. |
22:48:04 | disruptek | well, i am, but only in the bedroom. |
22:48:19 | FromDiscord | <Clyybber> but the nil deref is gone |
22:48:21 | FromDiscord | <Clyybber> ? |
22:48:33 | disruptek | it's a front-end issue afaict. |
22:48:33 | disruptek | no. |
22:49:41 | disruptek | the scope issue had nothing to do with anything. turns out pragmas aren't to blame, either. |
22:49:45 | disruptek | scope issue was just me using my testes incorrectly, yet again. |
22:50:25 | FromDiscord | <Clyybber> ok |
22:51:06 | FromDiscord | <Clyybber> I'm not at my PC atm, but I would start from afterCallActions |
22:51:20 | FromDiscord | <Clyybber> its in semexprs afair |
22:51:26 | disruptek | okay, thanks. |
22:55:20 | FromDiscord | <acek7> hello beautiful |
22:56:53 | FromGitter | <deech> In `sequtils` the proc `all` and the template `allIt` default to `true` for an empty list. I found this surprising what is the reasoning behind that? |
22:57:11 | FromDiscord | <Clyybber> it makes sense, no? |
22:58:46 | FromDiscord | <ElegantBeef> There are no items to check so there for all items meet the predicate |
22:58:54 | FromDiscord | <ElegantBeef> therefore even |
22:59:42 | FromGitter | <deech> Do all the elements in an empty list pass some predicate? I guess I could see it ... I would have expected `false` or `Option[bool]` maybe. |
23:00:01 | FromDiscord | <kodkuce> how to create an empty dict |
23:00:21 | FromDiscord | <kodkuce> initTable[string, string]() dident work :( Error: cannot instantiate: 'Table[A, B]'; Maybe generic arguments are missing |
23:00:54 | FromDiscord | <ElegantBeef> `var a = initTable[string, string]()` or `var a: Table[string, string]` should work |
23:01:04 | FromDiscord | <ElegantBeef> Did you `import tables`? |
23:01:09 | FromDiscord | <kodkuce> yes |
23:01:20 | FromDiscord | <kodkuce> var passport : Table = initTable[string, string]() |
23:01:46 | FromDiscord | <ElegantBeef> You need to give that type annotation the generic types |
23:01:48 | FromDiscord | <kodkuce> removed : Table |
23:01:53 | FromDiscord | <kodkuce> and it works now |
23:02:10 | FromDiscord | <kodkuce> var passport Table[string,string] |
23:02:15 | FromDiscord | <ElegantBeef> `var a: Table[string, string] = initTable[string, string]()` would work |
23:02:16 | FromDiscord | <kodkuce> (edit) "var passport ... Table[string,string]" added ":" |
23:02:21 | FromDiscord | <kodkuce> yep got it |
23:02:22 | FromDiscord | <kodkuce> my bad |
23:02:24 | FromDiscord | <kodkuce> ty |
23:02:47 | FromDiscord | <ElegantBeef> Use of generics like that are only usable in procs, but not really suggested |
23:08:55 | FromDiscord | <kodkuce> hmm tard question but i used wile loop for some reason is there some way to check if next row is endoffile wihout reading it? |
23:09:03 | FromDiscord | <ElegantBeef> peek |
23:09:40 | FromDiscord | <ElegantBeef> I assume you're reading aoc input data, imo it's just easier to do `data.split('\n')` |
23:09:47 | FromDiscord | <ElegantBeef> Although that makes a new string, so be warned π |
23:11:09 | FromDiscord | <kodkuce> ye i did split for old ones but for some reason i wanted to be perf better and wanted to do wile myinput != endoffile. but now i have issue cuz last line is not blank and cuz of that i get -1 value :( |
23:12:08 | FromDiscord | <kodkuce> from whered does peek come |
23:12:12 | FromDiscord | <kodkuce> sequtils or what? |
23:12:35 | FromDiscord | <kodkuce> rror: attempting to call undeclared routine: 'peek' |
23:13:03 | FromDiscord | <kodkuce> oh streams |
23:13:06 | FromDiscord | <kodkuce> hope it works |
23:13:30 | FromDiscord | <kodkuce> but expression 'my_input' is of type: File noooooooooo |
23:13:36 | FromDiscord | <ElegantBeef> fileStreams exist |
23:14:05 | FromDiscord | <kodkuce> oh ye easy fix |
23:20:36 | FromDiscord | <kodkuce> beh i just added 1 new line to input dont want to waste time on this |
23:27:01 | FromDiscord | <kodkuce> beh fixed it tough tarded way |
23:27:19 | FromDiscord | <kodkuce> just runed 1 more check after while loop ends |
23:29:16 | FromDiscord | <kodkuce> is in range only way to 1 line check in number inbetwin |
23:57:54 | FromDiscord | <kodkuce> hmm if i have try statment but i dont need any info from except what do i put in excapt |
23:58:00 | FromDiscord | <kodkuce> cuz i cant leave blank row |