00:07:21 | * | qwr quit (Ping timeout: 244 seconds) |
00:12:10 | * | zedeus joined #nim |
00:12:28 | Prestige | You could just reassign it without allocation, right? Like, mystr = "foo" |
00:14:19 | nisstyre | Is it possible to compile a nim program into a C shared library? I have `{.passC: "-shared -fPIC -o foo.so".}` but that just conflicts with the other args that get passed to gcc |
00:14:27 | nisstyre | is there a way to commpletely override those args? |
00:21:43 | FromDiscord | <fenrave> can't seem to find an option or anything on google about changing the default compilation flags for code runner |
00:29:34 | FromDiscord | <รєคɭ๓๏שє> Hey @giaco nice that you are still here ^^ |
00:30:13 | giaco | Hi Sealmove! I'm writing some bitstreams right now :D |
00:31:10 | giaco | actually dealing with a char protocol now, not really sure if binarylang is the right tool for the job performance wise, but it is working |
00:32:25 | * | vicfred joined #nim |
00:38:57 | * | qwr joined #nim |
00:41:18 | giaco | actually I'm quite puzzled what's the correct way to deal optional fields like in a string "AfooBfoo[Cfoo][Dfoo][Efoo]Ffoo" where sections C___ D___ and E___ are optionals and may appear all, none, or part of them, but Ffoo is always present |
00:45:12 | giaco | is there a nim lib to calculate CRC16? |
00:51:26 | FromDiscord | <ElegantBeef> giaco this might help with the first question https://play.nim-lang.org/#ix=2ScI |
00:53:34 | giaco | ElegantBeef, thanks! But I was asking sealmove about how to do that using his library "BinaryLang". Btw I'm thinking about switching to a dsl-less version like yours, bookmarked |
00:53:44 | FromDiscord | <ElegantBeef> Ah |
00:53:52 | FromDiscord | <ElegantBeef> I didnt join the two messages together 😄 |
00:56:44 | FromDiscord | <Hi02Hi> In reply to @nisstyre "Is it possible to": My first guess would be to instead of putting the flags inside the prog, to say `nim c --passC: "-shared -fPIc -o foo.so" file` |
00:56:52 | giaco | you've anticipated my question about if parseutils would fit for the job |
00:57:22 | Prestige | damn if I'm going to write a tree-sitter grammar, I'll need to write some c++.. |
00:59:40 | FromDiscord | <Hi02Hi> In reply to @nisstyre "Is it possible to": also note that the Nim manual mentions exporting to C in ↵https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export↵and↵https://nim-lang.org/docs/manual.html#foreign-function-interface-exportc-pragma |
01:13:39 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:14:00 | * | njoseph joined #nim |
01:29:12 | * | krux02 quit (Remote host closed the connection) |
01:32:57 | * | abm quit (Read error: Connection reset by peer) |
01:41:54 | * | ex_nihilo quit (Quit: Leaving) |
02:01:07 | nisstyre | Thanks, that makes sense |
02:01:19 | nisstyre | I guess I could just compile a C file that just uses the function I want |
02:16:24 | * | lritter quit (Ping timeout: 246 seconds) |
02:17:11 | * | lritter joined #nim |
02:33:55 | * | blackpawn_ joined #nim |
02:34:45 | * | blackpawn quit (Ping timeout: 264 seconds) |
03:08:31 | FromDiscord | <Gary M> what's the correct way to stream a binary file into memory? |
03:09:16 | FromDiscord | <Gary M> the allocator I'm trying to read into wants a uint32 size |
03:09:51 | FromDiscord | <Gary M> but I'm getting a "cannot read from stream" error |
03:10:17 | FromDiscord | <Gary M> https://i.imgur.com/nvX7lnS.png |
03:10:41 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2Sd5 |
03:13:45 | Prestige | What constitutes a `literal` in the Nim grammar? https://nim-lang.org/docs/manual.html#syntax-grammar |
03:14:39 | Prestige | is it every TokType with a `Lit` suffix in compiler/lexer.nim? |
03:15:15 | ForumUpdaterBot | New post on r/nim by suijuricide: Advice on building a text expander, see https://reddit.com/r/nim/comments/m0xeme/advice_on_building_a_text_expander/ |
03:19:53 | * | muffindrake quit (Ping timeout: 272 seconds) |
03:21:21 | * | muffindrake joined #nim |
03:41:29 | saem | Prestige: yes, I believe that's correct. |
03:42:14 | saem | well hold on, I spoke too soon I think. |
03:44:49 | saem | It's defined in the grammar, the question is do you mean what nim says is a literal in the grammar technically (in which case it's as defined) or generally speaking what someone might consider a literal? |
03:49:48 | * | Q-Master joined #nim |
03:51:38 | * | astronavt___ joined #nim |
03:51:41 | Prestige | just as it's defined in the grammar saem |
03:51:46 | * | spiderstew_ joined #nim |
03:52:10 | Prestige | it looks like it matches the enum types I mentioned |
03:52:27 | saem | yeah |
03:52:42 | Prestige | That might be a pain to define in treesitter |
03:52:44 | * | zedeus_ joined #nim |
03:52:57 | * | def-- joined #nim |
03:53:06 | * | idxu_ joined #nim |
03:53:14 | Prestige | Well, I'll just have to do custom parsing |
03:53:22 | * | madnight_ joined #nim |
03:54:11 | * | d10n_ joined #nim |
03:54:35 | saem | out of curiosity, what does treesitter get you? |
03:55:57 | * | giaco_ joined #nim |
03:55:59 | Prestige | I've been wondering if it's worth it. Atm just syntax highlighting and indentation, and it's very fast since it only looks at modifications to nodes in a tree |
03:57:12 | * | wasted_youth2 quit (Quit: Leaving) |
03:58:22 | giaco_ | I have a long named tupled of strings, how can I concat it into a single long string? |
03:58:46 | * | Ekho quit (Disconnected by services) |
03:59:03 | * | Cthalupa- joined #nim |
03:59:25 | * | FromDiscord quit (*.net *.split) |
03:59:25 | * | ^Q-Master^ quit (*.net *.split) |
03:59:25 | * | Jesin quit (*.net *.split) |
03:59:26 | * | def- quit (*.net *.split) |
03:59:26 | * | ForumUpdaterBot quit (*.net *.split) |
03:59:26 | * | Cthalupa quit (*.net *.split) |
03:59:27 | * | so quit (*.net *.split) |
03:59:27 | * | zedeus quit (*.net *.split) |
03:59:27 | * | spiderstew quit (*.net *.split) |
03:59:27 | * | jess quit (*.net *.split) |
03:59:27 | * | astronavt quit (*.net *.split) |
03:59:28 | * | clemens3 quit (*.net *.split) |
03:59:29 | * | giaco quit (*.net *.split) |
03:59:29 | * | d10n quit (*.net *.split) |
03:59:29 | * | idxu quit (*.net *.split) |
03:59:29 | * | madnight quit (*.net *.split) |
03:59:30 | * | def-- is now known as def- |
03:59:30 | * | idxu_ is now known as idxu |
03:59:42 | * | FromDiscord joined #nim |
04:00:07 | Prestige | saem: I'm hoping there will be more general use cases for tree-sitter later, since it can examine basically a sort of AST for any language, but idk if that'd become useful for nim |
04:01:13 | * | jess joined #nim |
04:01:34 | Prestige | https://tree-sitter.github.io/tree-sitter/playground if you want to see it in action |
04:02:34 | * | Jesin joined #nim |
04:02:44 | * | clemens3 joined #nim |
04:03:03 | saem | might be more useful as a binding rather than for nim itself, but who knows. |
04:03:14 | Prestige | Yeah - I think that exists already |
04:04:16 | saem | Like, if you want to parse nim, then use the nim parser? |
04:05:00 | * | Ekho joined #nim |
04:05:27 | Prestige | Yeah, I wish there was an easy way to just translate that into a treesitter grammar tbh |
04:05:47 | Prestige | could just plug-and-play better syntax hl |
04:06:33 | * | ForumUpdaterBot joined #nim |
04:07:15 | saem | so... textmate grammars or something won't do? |
04:08:37 | Prestige | I'm not familiar with it - my intent for a tree sitter grammar was for the new neovim adoption of treesitter for language parsing (indent and syntax hl) |
04:08:57 | saem | ah |
04:09:12 | Prestige | maybe the effort is moot, I still wonder if I'll run into weird issues with macros and ufcs |
04:10:03 | Prestige | like if foo.bar where foo is a function in another module, who knows what the hell it is |
04:10:30 | * | 7JTACD05E joined #nim |
04:10:31 | * | 7JTACD05E quit (Write error: Broken pipe) |
04:10:33 | saem | yeah, that's not really syntax, that's more semantics. |
04:10:36 | Prestige | (treesitter just looks at the local file) |
04:10:39 | * | so joined #nim |
04:10:41 | Prestige | Yeah |
04:11:45 | saem | so there is syntax highlighting and semantic highlighting, which is similar but not the same thing. |
04:12:40 | Prestige | Yeah, so we'd probably just end up with the same coloring for foo.bar. Semantic hl would be nicer |
04:12:51 | saem | So if you want to do the latter, I would suggest you look at the compiler/nimsuggest and sem. |
04:12:54 | Prestige | and I think nim.nvim (the plugin) has it |
04:14:17 | saem | the vim thingy that leorize[m] maintains for nim does that. I think that's nim.nvim, so yeah it does. |
04:14:21 | Prestige | I keep forgetting who alaviss is until I look at that repo, lol. Maybe I'll just contrib to it |
04:14:21 | saem | I hear it's pretty slick. |
04:14:32 | Prestige | Yeah I like it |
04:15:37 | saem | someone mentioned wanting it for the vscode plugin, I'm tempted, but I don't want to just yet because there are other things I'd rather have working before really diving into that again. |
04:16:06 | Prestige | oh wow he wrote most of it in viml |
04:18:07 | * | spiderstew joined #nim |
04:19:38 | * | spiderstew_ quit (Ping timeout: 245 seconds) |
04:23:08 | leorize[m] | and I'm not proud of that viml :p |
04:25:18 | Prestige | nobody is proud of any viml haha |
04:31:15 | saem | LoL |
04:34:34 | Prestige | I'd be down to help convert it to a vscode plugin |
04:39:25 | * | gpanders quit (Remote host closed the connection) |
04:39:44 | * | gpanders joined #nim |
04:39:58 | FromDiscord | <Gary M> dose nim have an equivalent to c++ fread |
04:41:04 | FromDiscord | <Varriount> @araq : What was the motivation behind merging https://github.com/nim-lang/Nim/pull/17012 ? |
04:42:51 | FromDiscord | <Varriount> In reply to @Gary M "dose nim have an": Yes, there is both a threading and thread pool module in the standard library. That being said, Nim's thread model is not the same as C/C++'s. |
04:43:11 | FromDiscord | <Gary M> no no, fread as in file reading |
04:43:25 | FromDiscord | <Gary M> basically there is but I don't see a readByte() proc |
04:43:37 | FromDiscord | <Gary M> so I'm hoping maybe just readChar() with a cast to byte idk it feels weird |
04:43:57 | FromDiscord | <Varriount> Oh, sorry. I mis-read. I believe there should be a read() procedure in system? |
04:44:20 | FromDiscord | <Varriount> Why do you need to cast to a byte? |
04:44:52 | FromDiscord | <Gary M> so basically the C/C++ lib I'm interfacing with has helper utils that aren't wrapped |
04:45:16 | FromDiscord | <Gary M> and they help with loading in the binary files by reading them by bytes |
04:45:38 | FromDiscord | <Gary M> so I'm rewriting that in nim but also using the original libraries allocators |
04:46:35 | FromDiscord | <flywind> https://nim-lang.org/docs/streams.html#readInt8%2CStream |
04:46:43 | FromDiscord | <flywind> `readInt8`? |
04:47:21 | FromDiscord | <Varriount> In reply to @Gary M "and they help with": Or `readBytes` https://nim-lang.org/docs/io.html#readBytes,File,openArray[],Natural,Natural |
04:58:40 | FromDiscord | <Gary M> trying readBytes, getting index out of bounds, the container is empty |
05:00:37 | FromDiscord | <Gary M> ah it's because I didn't set a size for the byte array I made... hm |
05:02:45 | saem | Prestige: source is up, I'm all for PRs, please improve away. Happy to work through problems too as you've seen. |
05:06:03 | Prestige | You mean vscode-nim? Cool |
05:07:32 | Prestige | I'll probably take a look tomorrow |
05:14:04 | saem | Yup |
05:14:14 | saem | The nim one I ported |
05:16:46 | Prestige | Still on the same stance with https://github.com/saem/vscode-nim/issues/22 ? |
05:17:03 | Prestige | Might be my first PR (I need to install vscode..l |
05:19:02 | Prestige | man this editor is so good but I can't *not* use vim |
05:21:13 | saem | Yup that's it |
05:31:42 | Prestige | This is interesting https://github.com/saem/vscode-nim/issues/28 I didn't know you could change the case etc of built-in keywords |
05:34:20 | FromDiscord | <Gary M> is there a way to access a pointer in nim like `pointerVar[idx]` |
05:35:25 | FromDiscord | <ElegantBeef> Needs to be a `ptr UncheckedArray[T]` |
05:37:06 | FromDiscord | <Gary M> so ` cast[ptr UncheckedArray[char]](mem.data)[mem.size - 1] = '\0'` |
05:38:07 | FromDiscord | <Hi02Hi> do you mean get the pointer of a value? |
05:38:32 | FromDiscord | <ElegantBeef> Think he wants to get an offset of a pointer |
05:40:00 | * | narimiran joined #nim |
05:41:27 | FromGitter | <redblack3_gitlab> Hey guys, quick question. When I call `=destroy` on an object that contains fields that are `importcpp`d structs, will the C++ destructor be called for those fields? Or will I have to do that myself? |
05:44:44 | FromDiscord | <ElegantBeef> If they're structs the destructor doesnt really matter now does it? |
05:45:07 | FromGitter | <redblack3_gitlab> It does if the destructor on the C++ does something |
05:45:22 | FromGitter | <redblack3_gitlab> like reference counting |
05:46:04 | FromDiscord | <ElegantBeef> Well then i'll go in the corner and count the points, until someone that knows shows up 😄 |
05:46:40 | FromGitter | <redblack3_gitlab> If I have to do it myself, do you think something like the following be sufficient? It destructors in C++ propagate right? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=60470bbfd74bbe49e0e0851e] |
05:48:15 | FromGitter | <redblack3_gitlab> Actually I can google that... |
05:49:13 | saem | Prestige: that is the very hard part of parsing nim |
05:49:16 | FromDiscord | <ElegantBeef> Yea google is smarter than me, it doesnt tend to make stuff up |
05:50:05 | Prestige | saem: is it just doing string comparisons with pattern matching, or how is that highlighting supposed to work? |
05:50:06 | FromDiscord | <ElegantBeef> for nice tooling you pretty much have to have semantic highlighting, since it'd resolve a bunch of that afaik |
05:50:17 | Prestige | e.g. pROC doesn't highlight but it compiles |
05:50:25 | Prestige | Yeah it would |
05:50:58 | Prestige | although nim.nvim doesn't hl it either but I thought it uses semantic hling |
05:50:59 | ForumUpdaterBot | New thread by Jasonfi: How to change an object's field, in a complex object, when using recursion?, see https://forum.nim-lang.org/t/7592 |
05:51:01 | saem | Well the static highlighting is textmate grammars |
05:51:10 | Prestige | ah I see |
05:51:11 | saem | The semantic can be added via nimsuggest |
05:51:20 | saem | The grammar files are in the repo |
05:52:01 | saem | There is an abandoned version of the extension someone improved the grammars but it seemed like sloppy work based on commit history so who knows |
05:52:12 | Prestige | https://github.com/pragmagic/vscode-nim was it this |
05:52:25 | saem | Nah |
05:52:33 | saem | That's the original Typescript one |
05:52:55 | saem | It's like some person's name in the extension |
05:52:57 | saem | Let me see |
05:53:27 | Prestige | should be try changing https://github.com/saem/vscode-nim/blob/main/syntaxes/nim.json#L79 or just add semantic hling? |
05:54:32 | saem | This: https://marketplace.visualstudio.com/items?itemName=garym.nim-alt for the possibly improved textmate grammars |
05:54:39 | FromGitter | <redblack3_gitlab> Ah, so that Nim snippet should do the job then: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=60470d9f5d0bfb4e5897cb07] |
05:55:09 | Prestige | Also leorize[m] your plugin fails to hightlight weird capitalizations of keywords (like pROC). Is the issue with nimsuggest? |
05:57:14 | FromDiscord | <ElegantBeef> I'm going to say nimsuggest most likely works https://media.discordapp.net/attachments/371759389889003532/818724083466240040/unknown.png |
05:58:53 | leorize[m] | Prestige: nimsuggest doesn't handle that one, the syntax plugin does |
05:59:15 | Prestige | hm okay (I don't see it working on either though) |
05:59:55 | FromDiscord | <ElegantBeef> Although i dont require if normal language extensions would work there |
05:59:58 | FromDiscord | <ElegantBeef> (edit) "require" => "recall" |
06:00:02 | leorize[m] | Prestige I only implemented it for pragmas since someone complained :p |
06:00:13 | Prestige | haha cool, yeah it seems like a weird use case tbh |
06:00:28 | leorize[m] | it's easy to replicate for the rest if you want, there's already a function in the syntax file |
06:01:07 | Prestige | yeah maybe I will, if it won't be much of a hassle. Idk why anyone would use it though |
06:02:41 | FromDiscord | <ElegantBeef> Considering how slow `nim check` can be i'm scared of what'll happen without an IC + semantic highlighting 😄 |
06:06:35 | FromDiscord | <Araq> IC is starting to work |
06:08:11 | FromDiscord | <KnorrFG> Is it possible to use a macro to create a new type, and instantiate it?↵so that `var foo = someMacro(...)` is an instance of a type that hasnt existed prior to the macro call? |
06:08:59 | * | mbomba joined #nim |
06:09:06 | leorize[m] | yes |
06:09:34 | leorize[m] | you can do this even without macros |
06:09:38 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Sdp |
06:09:59 | FromDiscord | <KnorrFG> ahhh cool. that was ecaxtly what it needed |
06:09:59 | FromDiscord | <KnorrFG> ty |
06:11:10 | * | mbomba quit (Client Quit) |
06:11:29 | FromDiscord | <KnorrFG> (edit) "ecaxtly" => "exactly" | "it" => "i" |
06:17:03 | ForumUpdaterBot | New thread by Halloleo: JS backend: How to access the `files` attribute in the Node object of an `input type="file"` element, see https://forum.nim-lang.org/t/7594 |
06:22:25 | * | vicfred quit (Quit: Leaving) |
06:23:11 | FromDiscord | <Gary M> What's the equivalent to a void pointer in nim? |
06:23:18 | FromDiscord | <Gary M> Strictly interfacing with C |
06:23:47 | FromDiscord | <Gary M> It's expecting an array passed as a void pointer |
06:27:34 | FromDiscord | <Araq> void pointer is `system.pointer` |
06:39:49 | FromDiscord | <Gary M> So just using `addr` should be sufficient? |
06:39:56 | FromDiscord | <ElegantBeef> > In general, a ptr T is implicitly convertible to the pointer type |
06:40:23 | FromDiscord | <Gary M> Or should I `cast[pointer]` |
06:40:23 | FromDiscord | <ElegantBeef> So yes |
06:40:43 | FromDiscord | <ElegantBeef> `thing.addr` can be implicitly converted to a `pointer` |
06:54:26 | FromDiscord | <haxscramper> Prestige: have you seen my link for tree-sitter? https://irclogs.nim-lang.org/08-03-2021.html#07:54:11 |
06:54:58 | FromDiscord | <haxscramper> Should save you quite a bit of annoying work at the start |
06:55:59 | FromDiscord | <Araq> if you want to parse Nim, Nim's parser isn't all that bad as a starting point |
06:58:12 | Prestige | @haxscramper oh I did not see that |
06:58:41 | FromDiscord | <Araq> and if you want to know how indentation based parsing is done... the manual explains it |
06:58:42 | Prestige | Idk if it'll be of good use of time tbh |
06:58:59 | * | lritter quit (Ping timeout: 260 seconds) |
06:59:03 | Prestige | we already have decent syntax highlighting |
06:59:13 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:59:47 | FromDiscord | <Araq> it's actually quite miserable for me |
06:59:59 | Prestige | Is it bad for large files? |
07:00:01 | FromDiscord | <Araq> but fixing it doesn't require much parsing work |
07:00:18 | FromDiscord | <Araq> no, the keywords are misclassified |
07:00:33 | FromDiscord | <Araq> `when` has a different color than `proc` |
07:00:52 | FromDiscord | <Araq> and `false` and `true` are rendered as keywords, they are not in Nim. |
07:00:59 | FromDiscord | <haxscramper> In reply to @Araq "if you want to": I wanted to write pretty-printer, so I wanted to have concrete syntax tree. |
07:01:00 | Prestige | What plugin are you using? I'm planning on helping saem with that work |
07:01:15 | FromDiscord | <Araq> we have an 100% precise list of keywords, nobody cared |
07:01:17 | FromDiscord | <haxscramper> Just parsing nim code is of course better done by actual parser |
07:02:04 | FromDiscord | <Araq> some things are white, others bright yellow for no apparent reason |
07:02:37 | FromDiscord | <Araq> pragma parsing is broken, pragmas can end in `}`, it doesn't have to be `.}` |
07:03:00 | FromDiscord | <Araq> yet the highlighter doesn't accept `}` |
07:03:15 | Prestige | @Araq you talking about the vscode plugin saem made? |
07:03:27 | FromDiscord | <Araq> the VSCode plugin, yes |
07:03:41 | FromDiscord | <haxscramper> Prestige: as I already said I just got stuck somewhere in the middle, so if you want I can just give you commit access or you can simply copy over anything useful |
07:03:48 | FromDiscord | <haxscramper> If you want |
07:04:21 | Prestige | If I decide to work on it I'll probably fork and make a PR (unless you've abandoned it) |
07:04:48 | FromDiscord | <Araq> and while we're at it, ` 133'foo` is becoming valid Nim code (user defined literals) |
07:05:03 | FromDiscord | <haxscramper> I'm not abandoning it, just not main focus for now |
07:05:10 | Prestige | Kk |
07:05:42 | Prestige | @Araq if you have any time to list these sorts of issues on the github page I'll start looking into in this week |
07:06:12 | FromDiscord | <Araq> certainly. which issue tracker to use? |
07:06:12 | FromDiscord | <haxscramper> Also tree-sitter grammar can be used together with github semantic (which I already want to learn how to use for haxdoc) so we might get go-to-definition on GitHub some day |
07:06:31 | FromDiscord | <haxscramper> Not particularly useful and half-broken though |
07:06:36 | Prestige | https://github.com/saem/vscode-nim/issues |
07:08:05 | Prestige | Any pictures or whatever helps |
07:08:13 | FromDiscord | <Araq> also, please notice that I'm particularly easy to satisfy as I hate semantic parsing |
07:08:57 | FromDiscord | <Araq> for me it suffices to distinguish between keywords, string literals, comments and everything else |
07:09:04 | Prestige | on a side note, user-defined literals sounds interesting. Any literature on it? |
07:09:17 | FromDiscord | <ElegantBeef> The PR for it 😛 |
07:09:27 | FromDiscord | <Araq> there are also outdated RFCs about it |
07:09:54 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/Nim/pull/17020 for the most recent conversation/progress |
07:10:49 | Prestige | That's pretty cool. Thanks for the link |
07:18:48 | saem | Not sure if this highlighting is better, but there is an original TS extension fork and if the highlighting is just plain better maybe that's a good place to start https://github.com/GaryM-exkage/vscode-nim-alt/blob/master/syntaxes/nim.json |
07:19:22 | FromDiscord | <ElegantBeef> It's a bit better, but it still has it's limitations, regex can only go so far |
07:19:46 | FromDiscord | <Araq> for highlighting Nim code, regexes are entirely sufficient |
07:20:19 | FromDiscord | <Araq> except for the nestability of #[ ]# comments |
07:22:44 | Prestige | Trying to think of ways we could make a treesitter grammar easier to write |
07:23:02 | Prestige | because we'd need a custom scanner |
07:23:04 | FromDiscord | <ElegantBeef> Suppose so, depends on the depth of given knowledge. Like i imagine `object.field.proc.proc` would stimy the highlighter |
07:24:26 | saem | I very briefly looked at textmate grammars and they have a whole scopes thing, so it's not strictly regex, basically flips into different modes so you get a stack of matching rules as you enter and exist various things. |
07:24:32 | saem | exit |
07:26:11 | saem | huh, never checked out the scope inspector, that makes the whole thing seem quite a bit less dautning: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#scope-inspector |
07:27:59 | FromDiscord | <Araq> this is all nuts in my not so humble opinion. |
07:28:18 | FromDiscord | <Araq> highlighting should be purely based on the lexing aspects of a language |
07:29:20 | FromDiscord | <Araq> that actually helps newcomers to a language much moreso than petty distinctions between "control flow related keywords" vs "declarative keywords" |
07:29:23 | Prestige | That's what treesitter aims to do, but you have to write a grammar file in their own syntax. Then, for some special stuff, you have to write a scanner (which the parser in the compiler does anyway) so meh. |
07:31:17 | FromDiscord | <Araq> when you want more than lexing, get at least basic lexing right first... |
07:31:51 | FromDiscord | <Araq> I can tell Nim's highlighter treats Nim as some shitty dialect of Python, it's a pain. |
07:46:48 | FromDiscord | <Gary M> hey seam, I thought I did a pretty good job with the textmate grammer in vscode-nim-alt. The only issue is the nimsuggest part of it is unchanged from the original fork and isn't great. |
07:47:37 | * | aeverr quit (Quit: Konversation terminated!) |
07:49:29 | * | haxscramper joined #nim |
07:53:10 | saem | @Gary M: could you throw up equivalent screenshots in the issues Araq filed? It'd be nice to compare. |
07:54:31 | saem | If it's straight up better I'm not picky about it, as evidenced by the fact that I didn't get itchy enough to tackle it. 😄 |
07:58:14 | FromDiscord | <Araq> screenshot? just open any realistic Nim file and observe the mess of different colors |
08:00:54 | FromDiscord | <Araq> https://gist.github.com/Araq/1de715551a8ae38d1aa3328e8a5a6945 for example |
08:01:02 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/818755240618623007/Code_f1dFOGJwyX.png |
08:01:12 | FromDiscord | <Gary M> oh does this work over IRC |
08:01:15 | FromDiscord | <Gary M> or do I need to upload to imgur |
08:01:32 | FromDiscord | <Araq> quite sure it works |
08:01:35 | FromDiscord | <Gary M> okay |
08:01:37 | FromDiscord | <Gary M> that's saems |
08:01:37 | saem | It works |
08:01:42 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/818755408776003584/Code_BcM3Xdd9De.png |
08:01:44 | FromDiscord | <Gary M> and this is mine |
08:02:31 | FromDiscord | <Araq> "If a little color helps readability, having more colors helps readability even moreso! Obviously!" |
08:02:42 | FromDiscord | <Araq> ^ nope. it doesn't work this way. |
08:03:04 | FromDiscord | <Gary M> so for one thing |
08:03:44 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/818755919071674398/unknown.png |
08:03:50 | FromDiscord | <Gary M> why is matrix highlighted here? |
08:04:05 | saem | LoL, my phone went into black and white mode. 🤣 |
08:04:14 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/818756045517619220/unknown.png |
08:04:40 | FromDiscord | <XeroOl> the fact that `for` and `in` are different colors |
08:04:58 | saem | Because it's dumb and is approximating command syntax I think |
08:05:14 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/818756297679699978/unknown.png |
08:05:25 | FromDiscord | <XeroOl> your first picture |
08:05:29 | FromDiscord | <Gary M> I made sure all of the keywords were highlighted correctly. |
08:05:33 | FromDiscord | <Gary M> Yes, first picture is seam |
08:05:35 | FromDiscord | <Gary M> saem |
08:06:28 | FromDiscord | <Gary M> system types are not colored but someone requested that so it's an optional configurable variable you can add to your settings json |
08:06:38 | FromDiscord | <Gary M> like `float` etc 😛 |
08:07:02 | saem | OK, so as long as the scoping is good the theming can be controlled to avoid too many colours or more colours of that's your bag. |
08:07:27 | FromDiscord | <Araq> the defaults matter though, esp for beginners |
08:07:58 | FromDiscord | <Araq> simple defaults that reflect how the lexing works is much better than sophistry about proc vs template invokations |
08:08:07 | saem | Oh yes, I'll be picky about that, I can't have colours yelling at me. |
08:08:21 | FromDiscord | <Gary M> I tried to make it as consistent as possible. |
08:08:33 | FromDiscord | <Araq> consistent with what? |
08:08:38 | FromDiscord | <Gary M> coloration |
08:08:45 | saem | It's fine as long as the scoping is good. Then theming is easy. |
08:08:49 | FromDiscord | <Gary M> it shouldn't be colored one way and then another in any other context |
08:08:58 | FromDiscord | <Gary M> that's confusing |
08:11:53 | FromDiscord | <Gary M> anyways, my plugin is probably subpar with parsing. |
08:12:30 | saem | The matching rules are better for sure. Since you can differentiate all those things seems like scoping is precise. Which just means default theming needs to change, AFAICS. |
08:12:33 | FromDiscord | <Gary M> I think it has that whole issue of spawning way too many nimsuggest prompts |
08:12:52 | FromDiscord | <Gary M> but if you want to rip the textmate grammer from it be my guest |
08:13:11 | saem | \o/ |
08:13:18 | FromDiscord | <Gary M> grammar |
08:14:53 | FromDiscord | <KnorrFG> @ElegantBeef I tried to apply your example from before to the case were it should return a new type, but cant get it to work. Is something like this possible? https://play.nim-lang.org/#ix=2SdS |
08:15:27 | FromDiscord | <ElegantBeef> You have logic inside a typdefinition |
08:15:32 | FromDiscord | <ElegantBeef> (edit) "typdefinition" => "typedefinition" |
08:15:46 | * | PMunch joined #nim |
08:16:30 | FromDiscord | <ElegantBeef> That's just not right in any regard, what are you trying to do here? |
08:18:49 | * | muffindrake quit (Ping timeout: 272 seconds) |
08:20:01 | FromDiscord | <KnorrFG> sent a code paste, see https://play.nim-lang.org/#ix=2SdT |
08:20:32 | FromDiscord | <ElegantBeef> Ok so then what's with the weird field here? |
08:21:15 | FromDiscord | <KnorrFG> what wierd field? you mean member in the play.nim example? |
08:21:17 | FromDiscord | <ElegantBeef> Yea |
08:22:19 | FromDiscord | <KnorrFG> macro is just transformation from one syntax to another, right? and I want to create a new signal type which has emit and register procs with the fitting signatures in the Signal macro, so the resulting code would be in that position, wouldnt it? |
08:22:50 | FromDiscord | <ElegantBeef> I'm half wondering i a generic wouldnt just work? |
08:22:52 | FromDiscord | <KnorrFG> its the code i expect the macro to produce |
08:22:54 | FromDiscord | <ElegantBeef> (edit) "i" => "if" |
08:23:08 | FromDiscord | <KnorrFG> the problem is, that i want it to work with any signature |
08:23:17 | FromDiscord | <KnorrFG> with any amount of arguments |
08:23:20 | FromDiscord | <ElegantBeef> Ah |
08:23:22 | FromDiscord | <ElegantBeef> I see |
08:24:59 | FromDiscord | <ElegantBeef> I did something similar in this package basically generates a type that takes in a given set of arguments and works kinda like a C# System.action https://github.com/beef331/constructor/blob/master/src/constructor/events.nim |
08:25:37 | FromDiscord | <ElegantBeef> This test has an example https://github.com/beef331/constructor/blob/master/tests/tallfeatures.nim#L3 |
08:25:55 | FromDiscord | <ElegantBeef> Some inspiration/source to build off of |
08:26:41 | FromDiscord | <KnorrFG> ok, ill try to understand it, thank you |
08:27:21 | FromDiscord | <ElegantBeef> Knowing the code that you want to emit goes a long way in figuring out how to get there since you can `dumpTree` it and see what the AST is |
08:28:25 | FromDiscord | <KnorrFG> yep. the problem is, that im not really clear on what code should be emitted. But I hope your library can help |
08:28:39 | * | aeverr joined #nim |
08:28:56 | FromDiscord | <ElegantBeef> I tend to write what i desire, then work backwards from there solving it programatically |
08:32:26 | * | m4r35n357 quit (Ping timeout: 264 seconds) |
08:34:24 | * | m4r35n357 joined #nim |
08:41:26 | FromDiscord | <KnorrFG> ur macro seems to be pretty much exactly what I want, except for that it is not inplace, but needs to be defined prop |
08:41:33 | FromDiscord | <KnorrFG> (edit) "prop" => "prior to the usage" |
08:42:04 | FromDiscord | <ElegantBeef> Well due to how Nim's type section macros work you kinda have to predeclare it before the type signature, or make a typedef with the type |
08:42:49 | * | xace quit (Ping timeout: 276 seconds) |
08:43:01 | FromDiscord | <KnorrFG> I see, i guess I'll just use ur library then 😄 |
08:45:09 | * | xace joined #nim |
08:47:14 | FromDiscord | <ElegantBeef> There is this issue <https://github.com/nim-lang/Nim/issues/13830> which if implemented would allow you to emit a new type before the current type with all the args you want |
08:57:03 | FromDiscord | <KnorrFG> I dont really undertand anything there 🙈 |
08:57:25 | FromDiscord | <ElegantBeef> Well just use my library until it angers you enough 😛 |
08:58:02 | FromDiscord | <KnorrFG> but that thing was added as a blocker for 1.4, and 1.4 is out, so I guess it wont come, right? |
08:58:17 | FromDiscord | <ElegantBeef> Dont ask me i'm not a core dev |
08:59:58 | FromDiscord | <Araq> it might come for 1.6 then |
09:00:11 | * | vycb[m] quit (Quit: Idle for 30+ days) |
09:00:31 | FromDiscord | <KnorrFG> ok, cool:) |
09:05:03 | FromDiscord | <Araq> (we handle milestones poorly ... what works is marking things as 'Showstopper' bugs) |
09:50:02 | * | krux02 joined #nim |
10:07:46 | PMunch | I'm probably going to start my "keyboard firmware in Nim" streaming today. It's going to be programming micro-controllers directly in Nim without using the Arduino libraries to create a nice and user-friendly keyboard firmware that should be dead simple for people to set up and configure to run on their own boards. |
10:08:20 | PMunch | Aiming to start the stream at 5PM UTC |
10:16:33 | * | ubert1 joined #nim |
10:24:09 | FromDiscord | <mratsim> you need to write in in Rust first otherwise it will have a low HN impact factor. |
10:25:14 | PMunch | Haha, that sounds like way too much work :P |
10:26:15 | * | tane joined #nim |
10:26:18 | * | JustASlacker joined #nim |
10:26:38 | FromDiscord | <ElegantBeef> Write a Rust backend for Nim so you can then rewrite Nim in Rust in Nim to complete the circle |
10:27:33 | FromDiscord | <ElegantBeef> They'll be out back shouting "RIIR" whilst chasing their own tails |
10:29:17 | FromDiscord | <Gary M> damn look at this nice code `copyMem(lightDirTime.addr, temp.addr, sizeof(temp))` |
10:30:44 | PMunch | @Gary M, not sure if that was facetious or not.. |
10:31:02 | FromDiscord | <Gary M> oh it's very sarcastic 😛 |
10:31:13 | PMunch | Haha, okay :P |
10:31:29 | PMunch | Because it arguable looks quite a lot better than similar code in C |
10:32:27 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2Sem |
10:33:09 | FromDiscord | <Gary M> poor variable name choices aside, it's not very different. |
10:34:30 | PMunch | I guess I just never really liked the */& syntax |
10:35:26 | FromDiscord | <Araq> /& are ok but I find `x.f` vs `x->f` a never ending pain in the ass |
10:35:41 | PMunch | Oh yeah, so glad Nim did away with that |
10:35:59 | FromDiscord | <Gary M> lol Visual Studio got really good at automatically expanding "." to "->" where necessary |
10:36:24 | FromDiscord | <Gary M> it's a nice crutch for bad design |
10:36:30 | FromDiscord | <ElegantBeef> I though araq was working on the 01/04/2021 patch where he replaced `ptr` and `addr` with the C counterparts to make the IR nicer 😛 |
10:37:08 | FromDiscord | <Araq> the IR fine, special cased nkAddr and nkDeref nodes |
10:39:07 | FromDiscord | <ElegantBeef> Well with the missing of my reference to april 1st i'll be off |
10:44:00 | * | JustASlacker quit (Ping timeout: 265 seconds) |
10:45:06 | FromDiscord | <Gary M> I read it as January 4th |
10:45:52 | FromDiscord | <Araq> @ElegantBeef the joke escaped me indeed 🙂 |
10:46:30 | * | xet7 quit (Remote host closed the connection) |
10:47:37 | * | xet7 joined #nim |
10:47:38 | * | JustASlacker joined #nim |
10:54:54 | * | JustASlacker quit (Ping timeout: 260 seconds) |
10:57:37 | FromDiscord | <haxscramper> If C callback accepts `T` for pointer-to-array, is it safe to make `UncheckedArray[T]` argument on nim side, or I need to explicitly do the conversion? |
11:02:11 | PMunch | I think that should be safe |
11:04:21 | FromDiscord | <Araq> you need `ptr UncheckedArray[T]` |
11:04:38 | FromDiscord | <Araq> an UncheckedArray is still an array, not a pointer |
11:04:57 | Clonkk[m] | If C does ``int mycproc(int* arg)``, then you need ``proc myproc(x: ptr UncheckedArray[cint]): cint {.importc: "mycproc".}`` |
11:08:12 | FromDiscord | <Araq> correct |
11:19:09 | * | Vladar joined #nim |
11:21:08 | FromDiscord | <mratsim> I don't know whether the worst ceremony is around Nim toOpenArray or ptr UncheckedArray |
11:23:25 | FromDiscord | <Goel> @Araq Hey Araq, i'm trying to learn GTK+ using gintro, by Stefan Salewski. In one of the open issues, Stefan said this about a specific (GStreamer, appsink) "...Handling this automatically seems to be really hard. Mr. Rumpf may have ideas, but I will not ask him, he does not like GTK that much" So i was wondering why you don't like GTK and what are you pref pick as a GUI for Nim? |
11:24:06 | FromDiscord | <mratsim> Command Line For4ever |
11:24:22 | FromDiscord | <Rika> have you ever tried using a cli browser |
11:24:32 | FromDiscord | <Rika> its not fun |
11:24:33 | FromDiscord | <Araq> I usually encourage people to look into fidget, but beware, I never used it myself |
11:24:38 | FromDiscord | <mratsim> yep, links2 elinks and lynx |
11:25:05 | Clonkk[m] | I just have the Vimium extension 😛 |
11:26:11 | FromDiscord | <Araq> as for why I don't like GTK ... because it's enormous in size and I personally think big object oriented projects in C are trolling when C++ exists. |
11:26:11 | PMunch | I tried Nyxt recently, but could never really get into it.. |
11:27:03 | FromDiscord | <Araq> yes, yes, C++ bad because you cannot read a book about it and avoid its dark corners, whatever. |
11:27:21 | FromDiscord | <Rika> so whats your opinion on qt then? that's c++ |
11:27:42 | FromDiscord | <Araq> Qt is indeed ridiculously better. |
11:28:07 | FromDiscord | <whisperdev> Too bad Yardanico gave up on his sciter bindings |
11:30:35 | Clonkk[m] | Isn't GTK coded in Vala these days ? |
11:32:28 | FromDiscord | <mratsim> Wasn't oksca part of Sciter? |
11:33:06 | FromDiscord | <mratsim> oskca |
11:33:35 | FromDiscord | <mratsim> He created the initial bindings directly in sciter repo: https://github.com/sciter-sdk/nsciter |
11:33:48 | FromDiscord | <Goel> What's Vala? |
11:34:02 | FromDiscord | <mratsim> C# clone from Gnome |
11:34:18 | FromDiscord | <mratsim> might as well use Mono nowadays. |
11:37:35 | liblq-dev | Clonkk: GTK has Vala bindings but it's implemented in C |
11:39:03 | FromDiscord | <whisperdev> https://github.com/MustafaHi/Recast |
11:39:23 | FromDiscord | <whisperdev> This works really well on my Windows even though the logic is implemented in the slow TIScript |
11:53:07 | FromDiscord | <Kiloneie> sent a long message, see http://ix.io/2SeD |
11:55:40 | ForumUpdaterBot | New thread by Arnetheduck: Zero-knowledge proofs (and rust integration) come to Nim.., see https://forum.nim-lang.org/t/7595 |
11:55:43 | FromDiscord | <Yardanico> Why hard subs though? |
11:57:59 | * | Vladar quit (Read error: Connection reset by peer) |
11:58:57 | FromDiscord | <Kiloneie> Hard because, most people don't ever turn them on so they don't even know that they exist, and secondly because if i were to ever get myself onto Floatplane or something, if i had used Youtube to add subtitles, i would most probably have to redo it all, and good luck once you have a lot of videos D: |
11:59:01 | * | Vladar joined #nim |
12:00:14 | FromDiscord | <Kiloneie> i just watched Life of Boris talk about why he has subs hardcoded on every video, and 98% of people voted for them to stay, maybe for different reasons, but it seems that most people are mobile users who would benefit from this, and of course non english natives still struggling with english |
12:00:35 | FromDiscord | <Yardanico> Well it's up to you, but I personally prefer soft ones more |
12:00:36 | FromDiscord | <Kiloneie> i only turned on subs on youtube like a few times, and half of the time they were auto generated or more, and were garbage |
12:01:20 | FromDiscord | <Yardanico> that doesn't mean that soft subs are bad, YouTube tries to do some automatic subs even if none are available |
12:01:37 | FromDiscord | <Yardanico> I've seen a lot of videos with soft subs, sometimes for more than 1 language |
12:02:57 | FromDiscord | <Kiloneie> Hmmm, i will think about that, maybe if i add soft subs i should remind the person watching the video that subs exist |
12:04:24 | FromDiscord | <Kiloneie> Gotta see what youtube does on my videos xD |
12:06:01 | FromDiscord | <Yardanico> Also YouTube subs are much more customizable than you think |
12:07:01 | FromDiscord | <Yardanico> Sadly that functionality mostly works on desktop |
12:07:08 | FromDiscord | <Yardanico> You can check https://youtu.be/UxM5UgpXYM4 for an example |
12:07:24 | FromDiscord | <Yardanico> (enable English subs on desktop) |
12:09:24 | FromDiscord | <Kiloneie> what do you mean it mostly works on desktop ? i can see them on phone ? i mean i have the youtube app but so do pretty much everyone no ? |
12:10:14 | FromDiscord | <Yardanico> Check this video on desktop to understand what I mean |
12:10:30 | FromDiscord | <Yardanico> I was talking about how YouTube subs are really customisable |
12:11:55 | FromDiscord | <Kiloneie> it seems to me watching about a minute of my last video that youtube auto subtitles are 99% accurate for my video so far... |
12:12:20 | FromDiscord | <Kiloneie> "Nim's" is the only problem becomes "Nims" |
12:13:21 | FromDiscord | <Kiloneie> it heard sdl's on 1:52 |
12:13:46 | FromDiscord | <Kiloneie> huh... seems like i don't need to do subs at all, seems that i talk pretty clearly. |
12:16:31 | FromDiscord | <Kiloneie> sdl 2 became sl2 , on mine, became online, maybe 98% accurate |
12:17:17 | FromDiscord | <Kiloneie> sdl 2 became "sdl to" xD lul |
12:17:36 | FromDiscord | <Kiloneie> or "sl2" xD |
12:17:50 | FromDiscord | <Kiloneie> anyways i guess i don't need them |
12:18:29 | FromDiscord | <Kiloneie> Can you edit what youtube has auto generated though ? |
12:18:59 | FromDiscord | <Kiloneie> Maybe i could just fix some rare fails of the auto generate |
12:19:42 | ForumUpdaterBot | New thread by Drkameleon: Un-static strings in template, see https://forum.nim-lang.org/t/7596 |
12:20:59 | FromDiscord | <Yardanico> In reply to @Kiloneie "Can you edit what": Of course |
12:21:10 | FromDiscord | <Kiloneie> Perfect. |
12:36:03 | FromDiscord | <arnetheduck> In reply to @Yardanico "also it's funny how": got it fixed in one place at least 🙂 https://github.com/saem/vscode-nim/issues/27 |
12:36:41 | FromDiscord | <Yardanico> Extensions should just compare case insensitively except the first letter :) |
12:36:50 | FromDiscord | <Yardanico> I don't think it's that hard stuff regexes |
12:36:52 | FromDiscord | <hamidb80> > When I started Nim's development I had a small simple language in mind that compiles to C; its implementation should not be more than 20,000 lines of code. The core guideline has always been that Nim should be a small language with a macro system, which should be capable of extending Nim with all the features that the small core is missing. |
12:37:09 | FromDiscord | <hamidb80> https://nim-lang.org/araq/v1.html |
12:37:53 | FromDiscord | <Yardanico> In reply to @Yardanico "Extensions should just compare": Even with highlite it's not hard to do - https://github.com/pietroppeter/nimib/blob/main/src/nimib/highlight.nim |
12:42:45 | FromDiscord | <hamidb80> In reply to @hamidb80 "https://nim-lang.org/araq/v1.html": > The future is bright, version 1 is the beginning. It's like a marriage, it doesn't stop with the wedding. |
12:42:58 | * | haxscramper quit (Remote host closed the connection) |
12:43:13 | * | haxscramper joined #nim |
12:43:41 | FromDiscord | <Yardanico> why are you quoting so much stuff from that blog post? :) |
12:44:11 | FromDiscord | <arnetheduck> In reply to @Yardanico "Extensions should just compare": as an option, I hope - it's a pita and a security nightmare when people use different spellings |
12:44:20 | * | sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in) |
12:44:34 | FromDiscord | <Yardanico> In reply to @arnetheduck "as an option, I": I'm talking about syntax highlighting |
12:44:43 | * | sacredfrog joined #nim |
12:44:54 | FromDiscord | <Yardanico> It's very easy to do and isn't really related to security or anything |
12:44:56 | FromDiscord | <arnetheduck> In reply to @Yardanico "I'm talking about syntax": people spell like their editor encourages them to do |
12:45:09 | FromDiscord | <Yardanico> Yes, and I'm not talking about autocompletion |
12:45:36 | FromDiscord | <hamidb80> i hate Youtube ads from `Tabnine` and stuff like that |
12:46:07 | FromDiscord | <hamidb80> "do you write code? Tabnine would speedup your coding ..." |
12:46:41 | FromDiscord | <Yardanico> TabNine is actually quite cool if you have the RAM for it |
12:46:46 | FromDiscord | <hamidb80> (edit) "would" => "will" |
12:46:52 | FromDiscord | <Yardanico> Also, why don't you have an ad blocker? |
12:47:10 | FromDiscord | <Yardanico> In reply to @Yardanico "TabNine is actually quite": Even Araq uses it :P |
12:47:15 | FromDiscord | <arnetheduck> In reply to @Yardanico "I'm talking about syntax": actually would be great if it did highlight alternative spellings with red or something 🙂 |
12:47:20 | FromDiscord | <hamidb80> In reply to @Yardanico "Even Araq uses it": uses tabnine? |
12:47:33 | FromDiscord | <Yardanico> In reply to @hamidb80 "uses tabnine?": Yes |
12:47:57 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/7242#45805 |
12:47:59 | FromDiscord | <hamidb80> In reply to @Yardanico "Also, why don't you": some of them are fun |
12:50:05 | FromDiscord | <hamidb80> like "circle ci" ads |
12:50:15 | FromDiscord | <Kiloneie> i tried tabnine but idk it didn't seem immediately useful so i deleted it |
12:50:58 | FromDiscord | <Yardanico> it's actually really cool in that it can complete whole lines of code based on the context |
12:51:10 | FromDiscord | <Yardanico> That's why it's largely language agnostic |
12:51:28 | FromDiscord | <Kiloneie> btw could the compiler be improved to provide better ERROR info than invalid indentation when trying to add fields to a ref object of a ref object ? i had that problem yesterday and it took me like 2-3 minutes to figure out what the heck is going on xD... |
12:52:21 | FromDiscord | <Kiloneie> also why is this nim extension now made in Nim using ScreenWidth and ScreenHeight i put in comments being suggested to me by autocomplete instead of the actual constants i made as ScreenW and ScreenH |
12:52:23 | FromDiscord | <Kiloneie> !? |
12:53:18 | FromDiscord | <Yardanico> are you sure that they were suggested by the Nim extension and not VSCode itself? |
12:53:45 | FromDiscord | <Kiloneie> how can i know that ? |
12:54:20 | FromDiscord | <Yardanico> Check the icons on the left of autocompletion items |
12:54:37 | FromDiscord | <Kiloneie> well uhmm, why do i have both nim extensions installed lol... |
12:54:59 | FromDiscord | <Kiloneie> nimsaem is the Nim version right ? |
12:55:23 | FromDiscord | <Yardanico> yes |
12:55:54 | FromDiscord | <Kiloneie> pretty sure having both extensions installed makes them fight |
12:56:09 | FromDiscord | <Kiloneie> just like back in the olden days having 2 anti viruses installed makes them kill your pc ! |
12:56:35 | FromDiscord | <Kiloneie> my dad did that... D: |
12:56:57 | * | narimiran quit (Ping timeout: 264 seconds) |
12:57:14 | FromDiscord | <Kiloneie> what does this even do ? https://media.discordapp.net/attachments/371759389889003532/818829782501687306/unknown.png |
12:57:30 | FromDiscord | <Kiloneie> shouldn't work with Nim no ? |
12:59:39 | FromDiscord | <Kiloneie> this is what i meant earlier https://media.discordapp.net/attachments/371759389889003532/818830391402168340/unknown.png |
13:00:22 | FromDiscord | <Kiloneie> Don't mind my comments, that wall was 4x as big, i talk to myself xD |
13:00:42 | FromDiscord | <hamidb80> In reply to @Kiloneie "this is what i": that's not from nim extension |
13:01:31 | FromDiscord | <Kiloneie> becasue it says abc on the left and not Nim ?... |
13:01:56 | FromDiscord | <hamidb80> In reply to @Kiloneie "becasue it says abc": i guess |
13:02:24 | FromDiscord | <dk> In reply to @Kiloneie "shouldn't work with Nim": should |
13:02:28 | FromDiscord | <hamidb80> In reply to @Kiloneie "becasue it says abc": you can turn off nim extention and try again |
13:02:39 | FromDiscord | <hamidb80> (edit) "In reply to @Kiloneie "becasue it says abc": you can turn off nim extention and try ... again" added "it" |
13:02:39 | FromDiscord | <Yardanico> Just restart VSCode to check |
13:02:51 | FromDiscord | <Yardanico> In reply to @Kiloneie "this is what i": Yeah those are default VSCode autocompletions |
13:02:58 | FromDiscord | <Yardanico> Not from the Nim extension |
13:03:17 | FromDiscord | <Kiloneie> i figured it out |
13:03:23 | FromDiscord | <Kiloneie> this saem nim extension is the problem |
13:03:40 | FromDiscord | <Kiloneie> uninstalling it and using the previous most popular one gets me all the cool stuff |
13:03:40 | FromDiscord | <dk> propably not |
13:03:51 | FromDiscord | <Kiloneie> uninstalling it then using same one again gets me abc crap |
13:03:52 | FromDiscord | <mratsim> the cool bugs? |
13:03:57 | FromDiscord | <Yardanico> In reply to @Kiloneie "this saem nim extension": it works for me just fine |
13:04:05 | FromDiscord | <Yardanico> the problem's in your setup :P |
13:04:20 | FromDiscord | <mratsim> I deactivated nimsuggest and I've never been so well. Change my mind. |
13:04:41 | FromDiscord | <Kiloneie> how ? the one by Zaitsev auto works |
13:04:45 | FromDiscord | <Kiloneie> this one doesn't... |
13:05:02 | FromDiscord | <dk> In reply to @mratsim "I deactivated nimsuggest and": with some macros you don't even have a choice |
13:05:42 | FromDiscord | <Kiloneie> it's enabled https://media.discordapp.net/attachments/371759389889003532/818831916198920223/unknown.png |
13:05:57 | FromDiscord | <Kiloneie> https://media.discordapp.net/attachments/371759389889003532/818831975867088896/unknown.png |
13:06:20 | FromDiscord | <Yardanico> Check the nimsuggest log? |
13:06:28 | FromDiscord | <Kiloneie> uninstall and use the older extension https://media.discordapp.net/attachments/371759389889003532/818832106175463424/unknown.png |
13:06:30 | FromDiscord | <Yardanico> in vscode terminal tabs |
13:07:03 | FromDiscord | <Yardanico> Anyway, I still think it might be something wrong with your VSCode, that extension works fine for me :P |
13:07:29 | FromDiscord | <Kiloneie> it runs the program on F6 |
13:07:38 | FromDiscord | <Kiloneie> but auto suggest/complete isn't doing crap |
13:07:48 | FromDiscord | <Kiloneie> which tab ? |
13:07:49 | FromDiscord | <dk> works on my machine |
13:07:59 | FromDiscord | <Kiloneie> hey are all empty |
13:11:32 | FromDiscord | <Yardanico> In reply to @Kiloneie "which tab ?": The bottom VSCode panel |
13:11:42 | FromDiscord | <Yardanico> You can select tabs there when you open it |
13:12:06 | FromDiscord | <Kiloneie> yeh only the normal output had anything |
13:12:09 | FromDiscord | <Kiloneie> im reainstalling |
13:12:59 | FromDiscord | <Kiloneie> okay but why does vs code remember what extensions i had and has them installed even though i uninstalled and reinstalled... bloody microsoft so sloppy... |
13:13:34 | FromDiscord | <Yardanico> In reply to @Kiloneie "okay but why does": You enabled VSCode sync? |
13:13:40 | FromDiscord | <Yardanico> it's off by default |
13:14:21 | FromDiscord | <Kiloneie> i don't remember doing it, but i recall seing that earlier |
13:14:27 | FromDiscord | <Kiloneie> anyways same thing... |
13:15:58 | FromDiscord | <Kiloneie> no it's off |
13:16:08 | FromDiscord | <Kiloneie> it says turn on settings sync |
13:16:30 | FromDiscord | <Kiloneie> uninstaller doesn't actually clean... just another sloppy uninstaller |
13:16:42 | FromDiscord | <Kiloneie> which is how windows xp pcs broke down usually |
13:17:06 | FromDiscord | <Kiloneie> cause every damn program shat everywhere including the register and never cleaned anything |
13:25:29 | * | vsantana joined #nim |
13:35:12 | FromDiscord | <NickSeagull> sent a code paste, see https://play.nim-lang.org/#ix=2Sff |
13:37:56 | FromDiscord | <Araq> use `--gc:orc -d:useMalloc` and run it under valgrind. New code should always be developed with `--gc:orc` |
13:38:21 | FromDiscord | <Araq> every other GC is moribund anyway cough |
13:39:41 | FromDiscord | <konsumlamm> @Araq any plan when `--gc:orc` will become the default? |
13:40:09 | FromDiscord | <haxscramper> IIRC it was 1.6 |
13:41:16 | FromDiscord | <Araq> plans change, the current plan is 1.6 ships with IC and then 2.0 makes --gc:orc the default |
13:41:27 | FromDiscord | <haxscramper> 2.0& |
13:41:29 | FromDiscord | <haxscramper> (edit) "2.0&" => "2.0?" |
13:41:35 | FromDiscord | <Araq> orc both needs and deserves the 2.0 IMO. |
13:41:55 | FromDiscord | <Araq> it breaks low level code that uses `cast` and shallowCopy |
13:42:46 | FromDiscord | <haxscramper> Ah oh, I just thought 2.0 wasn't even on the map for the foreseeable future |
13:43:03 | FromDiscord | <Araq> internally the new runtime is named `nimV2` fwiw |
13:44:25 | FromDiscord | <NickSeagull> In reply to @Araq "use `--gc:orc -d:useMalloc` and": Thanks, will try |
13:46:08 | FromDiscord | <NickSeagull> Compiled with `--gc:orc` the issue went away! |
13:49:18 | FromDiscord | <mratsim> and gc:v2 is now? |
13:53:27 | FromDiscord | <Araq> gc:v2 got removed in Nim devel iirc |
13:54:29 | FromDiscord | <Araq> @NickSeagull you should run under valgrind regardless |
14:00:28 | FromDiscord | <Rika> In reply to @arnetheduck "actually would be great": so why do we even bother with case insensitivity if we're going to discourage alternate spellings from the "norm"? |
14:06:56 | FromDiscord | <Araq> legacy and the usual "individual vs team" development modes. Individuals prefer freedom, teams prefer constraints |
14:07:07 | FromDiscord | <Araq> (generally speaking) |
14:07:55 | FromDiscord | <mratsim> Maintenance as well |
14:08:36 | FromDiscord | <mratsim> Frees the mind to think about other stuff. Which is the tole of a type system for example. |
14:14:30 | FromDiscord | <Araq> @Clyybber ! https://github.com/nim-lang/Nim/pull/17308 is the bomb |
14:15:24 | FromDiscord | <Clyybber> :) |
14:15:45 | FromDiscord | <Clyybber> (edit) ":) ... " added "thanks!" |
14:20:40 | * | Vladar quit (Quit: Leaving) |
14:30:06 | * | D_ quit (Remote host closed the connection) |
14:31:10 | * | D_ joined #nim |
14:45:36 | * | narimiran joined #nim |
14:46:36 | FromDiscord | <Rika> are new concepts under a switch or are they still unimplemented? |
14:47:07 | FromDiscord | <Clyybber> they are triggered by the new syntax |
14:47:08 | * | muffindrake joined #nim |
14:49:05 | FromDiscord | <Rika> can you link me the rfc again? i dont remember where it is |
14:51:18 | FromDiscord | <Clyybber> https://github.com/nim-lang/RFCs/issues/168 and the PR https://github.com/nim-lang/Nim/pull/15251 |
14:59:42 | FromDiscord | <Rika> is there a define like "hasNewConcepts" or something so i can still build on older nim versions? |
14:59:59 | * | Vladar joined #nim |
15:00:59 | m4r35n357 | Hi Guys, getting a weird compiler error on the last two lines I added to a 90 line file ;) up until then it was clean. Error: ambiguous identifier: 'sqrt' |
15:01:14 | FromDiscord | <Rika> can you elaborate on the error |
15:01:32 | m4r35n357 | Of course I claim it is not ambiguous ;) It seems to be having problems choosing between float64 and float32 |
15:01:55 | FromDiscord | <flywind> !eval import math; echo sqrt(1) |
15:01:57 | NimBot | Compile failed: /usercode/in.nim(1, 23) Error: ambiguous call; both math.sqrt(x: float32) [declared in /playground/nim/lib/pure/math.nim(256, 8)] and math.sqrt(x: float64) [declared in /playground/nim/lib/pure/math.nim(257, 8)] match for: (int literal(1)) |
15:01:58 | FromDiscord | <flywind> I think |
15:02:02 | m4r35n357 | of the sqrt argument. I have three files set up on pastebin of anyone is up for it . . |
15:02:02 | FromDiscord | <mratsim> are you using it on an int? |
15:02:24 | m4r35n357 | it is on a field of a tuple |
15:02:26 | FromDiscord | <mratsim> not a bug, use 1.0 or 1'f32 |
15:02:32 | m4r35n357 | a float field |
15:02:56 | FromDiscord | <mratsim> it's a literal though |
15:03:05 | FromDiscord | <mratsim> so it's not yet associated to a type |
15:03:09 | FromDiscord | <mratsim> you can paste just the line |
15:03:59 | m4r35n357 | mratsim what line? |
15:04:08 | m4r35n357 | my line? |
15:04:27 | m4r35n357 | p.p_r = sqrt(p.R.val >= 0.0 ? p.R.val : - p.R.val) |
15:04:43 | m4r35n357 | .val selects the field |
15:05:26 | m4r35n357 | oh boy! cancel that! |
15:05:40 | m4r35n357 | cut 'n' paste from c with wrong ternary ;) |
15:05:42 | FromDiscord | <Rika> also i cant seem to use the new concepts? getting `Error: undeclared identifier: 'self'` on `Nim Compiler Version 1.5.1 [Linux: amd64]; Compiled at 2021-02-27` |
15:06:00 | FromDiscord | <flywind> `Self`? |
15:06:18 | FromDiscord | <Rika> the rfc specifies undercase `self` |
15:06:23 | FromDiscord | <Rika> lowercase |
15:06:25 | FromDiscord | <Rika> im not ok |
15:07:25 | FromDiscord | <flywind> it's `Self` indeed |
15:07:30 | FromDiscord | <Rika> ???????? okay |
15:07:39 | FromDiscord | <Rika> what the heeeck okay |
15:07:49 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=2SfQ |
15:07:49 | m4r35n357 | OK sorry about that |
15:07:58 | m4r35n357 | It works in Nim ;) |
15:32:17 | * | Vladar quit (Quit: Leaving) |
15:47:39 | * | acidx_ joined #nim |
15:48:48 | * | acidx_ quit (Client Quit) |
15:49:07 | * | acidx joined #nim |
15:52:41 | FromDiscord | <Araq> @Rika I've updated the RFC |
15:56:12 | * | Oddmonger quit (Ping timeout: 272 seconds) |
15:58:38 | * | Oddmonger joined #nim |
16:00:14 | * | Oddmonger quit (Changing host) |
16:00:14 | * | Oddmonger joined #nim |
16:13:04 | PMunch | Keyboard firmware stream starting in 45 minutes :) |
16:19:10 | FromDiscord | <arnetheduck> In reply to @Rika "so why do we": It's a fantastic feature in code obfuscation contests 😆 |
16:23:49 | FromDiscord | <konsumlamm> In reply to @Araq "<@259277943275126785> I've updated the": speaking of which, do you still plan to add `each` and `either`/`orelse`? |
16:28:53 | * | letto quit (Quit: Konversation terminated!) |
16:30:20 | FromDiscord | <Araq> not in the near future. |
16:30:49 | * | letto joined #nim |
16:31:17 | FromDiscord | <Araq> ideally we find a different extension that can also infer (static) values |
16:39:50 | FromDiscord | <Clyybber> @Araq What is the reasoning behind https://github.com/nim-lang/Nim/pull/17255/commits/e08bb6d54c067cef35eaf7f3f225617f17af0daa ? |
16:41:50 | FromDiscord | <Araq> we don't `mixin` these symbols, we bind them |
16:42:55 | FromDiscord | <Araq> but it's giving me headaches, want to take over? 😛 |
16:43:12 | FromDiscord | <Clyybber> heh, but it does work right? |
16:43:37 | FromDiscord | <Araq> well the test is green |
16:43:42 | FromDiscord | <Clyybber> I think the example in the manual needs adapting |
16:43:57 | FromDiscord | <Araq> but I'm waiting for @zahary to give me a better example |
16:44:25 | FromDiscord | <Araq> a more realistic one. |
16:44:53 | FromDiscord | <Clyybber> I see |
16:45:22 | FromDiscord | <Clyybber> I wonder if we should require those bind/mixin statements at all |
16:46:11 | FromDiscord | <Clyybber> bind should be for resolving syms at declaration context, and mixin to do the opposite right? |
16:50:36 | FromDiscord | <Clyybber> @Araq I think a simpler design (from a user perspective) is to include the declaration scope with the proc to take into account when resolving symbols of the instantiation, and then using bind to bind early, essentially excluding symbols from the instantiation context, wdyt? |
16:50:50 | FromDiscord | <Araq> there is an ongoing debate about this and IMHO declarations like these are required for sanity |
16:52:01 | FromDiscord | <Araq> you are describing Zahary's solution to the problem, I'm not convinced. I don't want to live in the world where I cannot remove "obviously" unused local procs because generic instantation will pick up these identifiers later, it's nuts. |
17:02:15 | PMunch | https://www.twitch.tv/pmunche <- Stream is live! |
17:03:16 | FromDiscord | <DARTHVADER NAXXX> PMunch E |
17:03:25 | PMunch | Huh? |
17:03:32 | FromDiscord | <DARTHVADER NAXXX> (edit) "E" => "E" |
17:04:25 | federico3 | @Araq the new CVEs have been assigned - do you want to review the fixed advisories before publishing them? https://github.com/nim-lang/security/security/advisories/ |
17:07:42 | FromDiscord | <queersorceress> @Yardanico well i got some answers https://github.com/jackhftang/threadproxy.nim/issues/2#issuecomment-794014770 /cc @mratsim (if you were curious) |
17:09:59 | * | haxscram` joined #nim |
17:10:07 | * | haxscram` left #nim (#nim) |
17:11:38 | * | haxscramper quit (Ping timeout: 265 seconds) |
17:20:17 | FromDiscord | <queersorceress> though it means i am not any closer to solving this, which is really disappointing. ugh. this might say something for the bias in type of programming that nim gets used for that this is looking more and more like i have to DIY this. |
17:29:47 | * | reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/DtIlHzrLZnJuHfKbhGBCgCiw/message.txt > |
17:30:32 | * | vicfred joined #nim |
17:30:50 | FromDiscord | <Araq> @federico, yes, I want to review it |
17:31:20 | FromDiscord | <Clyybber> In reply to @Araq "you are describing Zahary's": sent a code paste, see https://play.nim-lang.org/#ix=2Sgw |
17:31:34 | FromDiscord | <Clyybber> but it might be unused even if uses is used |
17:31:59 | FromDiscord | <Araq> maybe, but why make it worse |
17:33:25 | FromDiscord | <Clyybber> because it makes more sense, especially when you think about template expansion in generics. With the explicit approach you have to write down all symbols in a mixin/bind statement that you think the template might use |
17:33:31 | FromDiscord | <Clyybber> it doesn't compose well |
17:34:38 | FromDiscord | <Araq> you need to pass the symbols around much like you would need to do with any other kind of parameter. Parameters do compose |
17:35:12 | FromDiscord | <Clyybber> yeah |
17:48:29 | reversem3 | Does anyone know of a script that if you highlight on a proc or method or function in one file the script can then show in every file? |
17:51:43 | FromDiscord | <zajrik> Is Nim able to do expressions spanning multiple lines? I can't seem to get it to work. I have a very long conditional I want to split up but I'm just getting invalid indentation errors |
17:51:55 | FromDiscord | <Clyybber> In reply to @Araq "maybe, but why make": I dont think it makes it worse. You have to follow the "test is unused when uses is unused" rule anyways with the old design too.↵It's a strict improvement from a user perspective IMO (maybe not for the compiler implementer :p) |
17:52:58 | FromDiscord | <haxscramper> In reply to @zajrik "Is Nim able to": sent a code paste, see https://paste.rs/dPc |
17:53:13 | FromDiscord | <zajrik> hmm |
17:53:19 | FromDiscord | <haxscramper> The line should end with an operator IIRC |
17:53:33 | FromDiscord | <zajrik> I've done just that but I'm still getting errors |
17:53:34 | FromDiscord | <Clyybber> In reply to @Clyybber "I dont think it": @Araq Although I can imagine saying "unexported symbols have to be explitly mixed/bound in"; would be a reasonable compromise IMO |
17:54:08 | FromDiscord | <haxscramper> In reply to @zajrik "I've done just that": My example works on playground so ... Can you show the code then to see the error? |
17:54:33 | FromDiscord | <Solitude> In reply to @zajrik "Is Nim able to": newline after binary operator |
17:54:36 | FromDiscord | <zajrik> https://i.imgur.com/mjIlgJr.png |
17:54:56 | FromDiscord | <zajrik> oops. I need to switch those !=s |
17:55:07 | FromDiscord | <zajrik> but that's not relevant to the error |
17:55:22 | FromDiscord | <zajrik> OH |
17:55:24 | FromDiscord | <Solitude> you have open paren |
17:55:31 | FromDiscord | <zajrik> Yeah I JUST saw that lmao |
17:55:35 | FromDiscord | <zajrik> as I tabbed back |
17:55:47 | FromDiscord | <zajrik> (edit) "back" => "back, while I was flipping those !=s" |
17:56:14 | FromDiscord | <zajrik> I feel like such a dummy now |
17:56:53 | FromDiscord | <zajrik> I had previously grouped the pos/posX/posY checks and scuffed up the paren removal I suppose lol |
17:57:50 | FromDiscord | <zajrik> I'm experienced, I swear :ablobsweats: |
17:59:15 | FromDiscord | <haxscramper> By the way, I think you can cut it down to something like `{ "id" : JString() .. } ?= config` if you use pattern matching, instead of writing `!=` checks |
17:59:15 | FromDiscord | <haxscramper> https://nim-lang.github.io/fusion/src/fusion/matching.html#matching-different-things-kvminuspairs-matching |
18:00:46 | FromDiscord | <haxscramper> !eval import std/[json]; import fusion/[matching]; echo { "id" : JString() } ?= %{"id": %"hello"} |
18:00:49 | NimBot | true |
18:01:17 | FromDiscord | <zajrik> Ooh, I haven't actually looked into pattern matching yet |
18:01:25 | FromDiscord | <zajrik> I only saw the other day that that was finally being worked on |
18:01:44 | FromDiscord | <haxscramper> if if you want to avoid `?=` operator can also do `config.matches({ "id" : JString() })` |
18:01:51 | FromDiscord | <haxscramper> In reply to @zajrik "I only saw the": It is done and merged |
18:02:00 | FromDiscord | <haxscramper> Well, not "done" of course, |
18:02:21 | FromDiscord | <zajrik> Due for an official release soon though? |
18:02:47 | FromDiscord | <haxscramper> No, we had 1.4.4 couple (?) weeks ago, and there are no planned releases soon IIRC |
18:03:16 | FromDiscord | <haxscramper> And pattern matching is in fusion so it is not strictly tied to main nim versioning, it is just 'slightly more official' package |
18:03:43 | FromDiscord | <zajrik> In reply to @haxscramper "if if you want": Does this require fusion? |
18:03:55 | FromDiscord | <haxscramper> yes -`import fusion/matching` |
18:03:59 | FromDiscord | <mratsim> There is a `fission` pckage in-between third-party and fusion btw. |
18:04:05 | FromDiscord | <zajrik> Okay, cool. I'll give that a try |
18:04:14 | FromDiscord | <mratsim> it will be released in 22 days. |
18:05:09 | FromDiscord | <zajrik> I'll have to look into that as well |
18:05:20 | FromDiscord | <mratsim> 222 days from now is April 1st |
18:05:24 | FromDiscord | <mratsim> (edit) "222" => "22" |
18:05:37 | FromDiscord | <zajrik> sus |
18:06:12 | FromDiscord | <ache of head> 😳 |
18:06:18 | federico3 | @Araq: if you mention me @federico it's not triggering the highlight :) |
18:06:33 | FromDiscord | <zajrik> Not finding Fission in a google search, and the april first thing has me thoroughly convinced I've been pranked |
18:08:55 | FromDiscord | <mratsim> https://www.youtube.com/watch?v=dQw4w9WgXcQ |
18:10:40 | FromDiscord | <zajrik> In reply to @haxscramper "if if you want": Oh man, it's so much more pleasant https://i.imgur.com/UXw6JGH.png |
18:12:09 | FromDiscord | <haxscramper> Yeah. Though I just realized it is not possible to invert match (e.g. `"id": isnot JString()`), but I think I will have some time to fix this, because it is a clear oversight |
18:12:50 | FromDiscord | <zajrik> That would indeed be handy |
18:15:08 | FromDiscord | <zajrik> I'm glad I could help you come to this realization |
18:16:13 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2SgV |
18:16:35 | FromDiscord | <haxscramper> `template` to just avoid function call and instead inline everything into pattern |
18:19:14 | FromDiscord | <mratsim> Hello, Haskell my old friend. I've come with Applicative Functor <> again. |
18:19:18 | FromDiscord | <zajrik> is it possible to store this pattern in a variable for later use? |
18:19:42 | FromDiscord | <haxscramper> No, patterns cannot be stored in values at runtime |
18:20:14 | FromDiscord | <zajrik> Shoot, okay |
18:20:37 | FromDiscord | <haxscramper> I had https://github.com/haxscramper/nimtrs for this, but I'm not sure if it even works still |
18:21:19 | FromDiscord | <haxscramper> But that is basically the closest thing you could get for this - store pattern as a term, try to unify with it at runtime and see what happens |
18:22:39 | FromDiscord | <haxscramper> Turned out to be a super weird idea for the most part. Fascinating, but almost no useful applications, except for being v0.3 for `fusion/matching` ideas |
18:24:24 | FromDiscord | <haxscramper> And I overengineered this to a degree where I have triple-nested case objects |
18:24:26 | FromDiscord | <mratsim> At runtime, you need efficient coroutines. |
18:24:32 | * | fosred joined #nim |
18:25:32 | FromDiscord | <haxscramper> Why? It is very close to parser/regex, at leas in my implementation. |
18:26:21 | FromDiscord | <haxscramper> Some fail-fast optimization to select the only matching pattern to try and unifty with |
18:26:28 | FromDiscord | <haxscramper> (edit) "unifty" => "unify" |
18:26:32 | FromDiscord | <mratsim> It depends on whther you want to compose with other blocks: https://eli.thegreenplace.net/2009/08/29/co-routines-as-an-alternative-to-state-machines |
18:27:23 | FromDiscord | <mratsim> but lexing/parsing can be separated in code while interleaved in actual processing with coroutines (they were made for that in COBOL days in the 60s). |
18:27:36 | * | fosred quit (Client Quit) |
18:28:02 | FromDiscord | <haxscramper> There is no actual processing, I just unify two AST trees basically, and copy captures to the store |
18:28:06 | FromDiscord | <mratsim> if composition is needed but everything is known at instantiation time, views work as well. |
18:28:31 | FromDiscord | <mratsim> so many possibilities and API .... |
18:30:24 | * | mmohammadi9812 joined #nim |
18:37:09 | * | waleee-cl joined #nim |
18:40:19 | * | Vladar joined #nim |
19:24:31 | FromDiscord | <zajrik> I don't know why I can't get it into my head that it's `joinPath()`, not `pathJoin()` |
19:24:38 | FromDiscord | <zajrik> Every. Single. Time. |
19:30:42 | FromDiscord | <haxscramper> Just use `/`: https://nim-lang.org/docs/os.html#%2F%2Cstring%2Cstring |
19:44:32 | FromDiscord | <zajrik> :blobfacepalm: |
19:45:21 | FromDiscord | <zajrik> the number of helper operator procs is overwhelming sometimes lol. I always fail to read over them when reading the docs |
19:45:30 | FromDiscord | <zajrik> Thank you for that |
20:05:19 | FromDiscord | <Gary M> how's it going everyone |
20:05:24 | FromDiscord | <haxscramper> We have approximately 42 different operators in stdlib: `! !& ! !\ % %% & &= % = + +% += - -% -+- -= -> .. / /% /../ // /= < <% <-> <= <=% = == ? @ []= ^ {}= | !$ $ $$ `. And I also found `@||->` and `||->` in tests, as well as `||`, `|+|` in compiler code |
20:05:59 | FromDiscord | <haxscramper> Fusion also has `?=` and `:=` |
20:09:14 | FromDiscord | <Gary M> is there a way to add arguments to a nimble task? |
20:09:17 | FromDiscord | <haxscramper> And overall there are 149 different operators in all packages. |
20:11:22 | FromDiscord | <haxscramper> Yes |
20:11:22 | FromDiscord | <Solitude> In reply to @Gary M "is there a way": you can access them with paramStr |
20:11:27 | FromDiscord | <haxscramper> > Run flags are those after the task name and are available as command line arguments to the task. They can be accessed per usual from `commandLineParams: seq[string]` |
20:11:28 | FromDiscord | <Solitude> but they will be offset |
20:11:57 | FromDiscord | <Gary M> what do you mean offset |
20:11:58 | FromDiscord | <haxscramper> So you need to find your task name in argument list and then look for arguments from there |
20:12:28 | FromDiscord | <haxscramper> In reply to @Gary M "what do you mean": Arguments for nimble invocation are `nimble <compflags> task <runflags>` |
20:12:37 | FromDiscord | <haxscramper> You are only interested in the last part |
20:12:44 | FromDiscord | <haxscramper> `<runflags>` |
20:12:52 | FromDiscord | <Gary M> actually I wanted to allow additional compflags to the task |
20:13:07 | FromDiscord | <Gary M> like passing in extra defines |
20:13:38 | FromDiscord | <Gary M> because I use my tasks for building |
20:13:56 | FromDiscord | <haxscramper> You want to pass defines from task to the compiler? Or from user to the task? |
20:14:11 | FromDiscord | <Gary M> from user to task |
20:14:35 | FromDiscord | <Gary M> so like I have a task `nimble linux` which will build both the debug and release binaries |
20:15:00 | FromDiscord | <Gary M> but it would be nice if they could optionally specify something like `-d:wayland` |
20:15:09 | FromDiscord | <Gary M> without having to have another task |
20:15:35 | FromDiscord | <haxscramper> You need to get `<runflags>` in the task and then do whatever you want down the line |
20:16:09 | * | narimiran quit (Ping timeout: 246 seconds) |
20:16:21 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2Shs |
20:16:28 | FromDiscord | <haxscramper> Something like that, but that is a pseudocode |
20:16:43 | FromDiscord | <Gary M> cool, I'll hack away at it. |
20:16:48 | FromDiscord | <haxscramper> (i.e. not tested myself) |
20:22:44 | * | raboof joined #nim |
20:47:55 | * | PMunch quit (Remote host closed the connection) |
20:59:43 | * | mmohammadi9812 quit (Remote host closed the connection) |
20:59:59 | * | mmohammadi9812 joined #nim |
21:01:29 | FromDiscord | <Gary M> is echo able to pass ANSI colors? |
21:01:48 | FromDiscord | <Gary M> like "\033[31mText Here" |
21:02:59 | FromDiscord | <haxscramper> Of course, though we have std/terminal for that sort of things |
21:03:27 | FromDiscord | <haxscramper> And \e escape is also supported IIRC |
21:05:37 | FromDiscord | <Gary M> In reply to @haxscramper "Of course, though we": well that's a better answer than I was looking for 😄 |
21:10:40 | FromDiscord | <Gary M> lol welp, nimscript is failing because it doesn't know what 'stdout' is |
21:12:18 | FromDiscord | <haxscramper> If you have complicated logic sometimes it is just easier to write actual nim file and just `exec("nim r task_implementation.nim")` |
21:12:44 | FromDiscord | <Gary M> it's not super important, just unecessary eyecandy that I won't bother with 😄 |
21:12:49 | FromDiscord | <Gary M> but that's good to know |
21:46:20 | * | lritter joined #nim |
21:50:58 | FromDiscord | <Gary M> I have to sequences of strings, and I don't care about performance at all |
21:51:12 | FromDiscord | <Gary M> I want to compare them like `if a in b:` |
21:51:53 | FromDiscord | <Gary M> like `if @["x", "y"] in @["x", "y", "z"]:` |
21:52:15 | FromDiscord | <Gary M> eh, guess I'll just make a shitty proc. |
21:53:04 | * | Vladar quit (Quit: Leaving) |
21:55:10 | * | mmohammadi9812 quit (Ping timeout: 276 seconds) |
21:58:01 | * | quantimnot joined #nim |
22:01:05 | * | mmohammadi9812 joined #nim |
22:06:14 | quantimnot | Are there any tips for setting conditional breakpoints while debugging the compiler? I figured out I can use ``PContext.module.name.s`` and ``BProc.module.module.name.s`` to break when the module of interest is compiled.But, I would really like to break when a specific statement in the module is compiled. I don't see how to do that. Any clue? |
22:27:50 | FromDiscord | <CAA> Even if garbage collection turned off, how does nim handle memory management? |
22:29:47 | FromDiscord | <ElegantBeef> If you disable GC you have to manually free all allocated types,https://nim-lang.org/docs/gc.html tells you all you need to know |
22:30:04 | FromDiscord | <CAA> Is there a book I can read about how garbage collection works? |
22:30:40 | FromDiscord | <ElegantBeef> Well there are multiple GC solutions + the scoped memory management, but yes i assume there are books on it 😄 |
22:31:20 | FromDiscord | <ElegantBeef> https://nim-lang.github.io/Nim/intern.html#the-garbage-collector also does explain the GC more in detail |
22:37:50 | * | tane quit (Quit: Leaving) |
22:48:50 | * | NimBot joined #nim |