<< 24-11-2021 >>

00:07:07*pch quit (Remote host closed the connection)
00:11:28FromDiscord<ynfle (ynfle)> Is there a way to get a `var` version of a base type (for a `distinct`)?
00:11:58FromDiscord<ynfle (ynfle)> Or, how can I `{.borrow.}` `mitems` where it's generic? It doesn't seem to be working
00:12:27*kayabaNerve quit (Ping timeout: 264 seconds)
00:16:44*pch joined #nim
00:17:13FromDiscord<Elegantbeef> You can do `thing.base[: type].mitems`
00:17:30FromDiscord<Elegantbeef> Atleast assuming you're using a version of Nim with my fixes implemented
00:17:34FromDiscord<Elegantbeef> Might require devel
00:18:43FromDiscord<Elegantbeef> Generic distincts borrowing generic ops isnt presently supported and it's a bit confusing what it should mean
00:31:52FromDiscord<evoalg> Has anyone tried Julia (programming language)? I'm interested to know why people chose to use Nim instead. Julia is like python in that it's high-level and interpreted, but runs at near C speed. I'm thinking it has it's place but it may be too specialized, whereas Nim can be used for loads of different things. I suspect that Nim has smaller executables etc too.
00:32:20FromDiscord<Elegantbeef> I've briefly looked into it, it's use of multiple dispatch is a bit scary to me
00:34:05FromDiscord<evoalg> if it's scary for you then I'd be petrified
00:35:03FromDiscord<Elegantbeef> Eh it's more for data scientists
00:35:46FromDiscord<impbox [ftsf]> multi dispatch is cool though?
00:36:07FromDiscord<Elegantbeef> I mean it's confusing to reason about
00:37:41FromDiscord<Elegantbeef> Nim does have it though it's deprecated behind a flag
00:38:20FromDiscord<impbox [ftsf]> yeah i used to use it a bunch
00:38:38FromDiscord<impbox [ftsf]> nice for interactions between different types
00:38:42FromDiscord<Elegantbeef> I pretty much never touch the OOP stuff in Nim so havent ever really felt the need for it
00:39:58FromDiscord<jfmonty2> tbh the more I've used OOP patterns the more I tend to dislike them
00:40:18FromDiscord<jfmonty2> personal taste, but composition \> inheritance as far as I'm concerned, because it's more explicit
00:41:10FromDiscord<jfmonty2> having worked with one or two massively overly-abstracted codebases (cough Magento) I can say with absolute certainly that trying to chase a method call up through 6 levels of `AbstractBaseRouteHandlerGeneratorFactory` classes is Not Fun
00:41:25FromDiscord<impbox [ftsf]> magento makes me so upset
00:41:33FromDiscord<impbox [ftsf]> i used to have to work with it at previous job
00:41:35FromDiscord<impbox [ftsf]> D: D: D:
00:41:35FromDiscord<jfmonty2> it's just a big ball of cancer
00:41:55FromDiscord<jfmonty2> to add insult to injury I was the one who made the call to use it in the first place \:(
00:41:59FromDiscord<jfmonty2> I have learned my lesson
00:42:17FromDiscord<impbox [ftsf]> i don't mind light usage of classes/objects, but deep stuff like that is terrible
00:42:37FromDiscord<jfmonty2> yeah classes can be great, as long as you basically just use them as "state containers" so to speak
00:42:50FromDiscord<jfmonty2> i.e. some state, some functions that manipulate the state, and bob's yer uncle
00:43:11FromDiscord<impbox [ftsf]> when I worked with magento we solved problems by just avoiding it and talking to the DB directly
00:43:27FromDiscord<jfmonty2> That's very amusing because I've wound up with pretty much the exact same solution
00:43:35FromDiscord<impbox [ftsf]> which magento didn't like, but at least we could follow the code and it was fast
00:44:02FromDiscord<jfmonty2> e.g. our warehouse management software is bad at keeping Magento's inventory levels in sync, so I've had to write a nightly sync task that keeps them up to date, and at some point recently the Magento API just broke
00:44:07FromDiscord<jfmonty2> like it was responding 200, but no updates were happening
00:44:10FromDiscord<jfmonty2> so now I just talk to the DB directly
00:44:14FromDiscord<jfmonty2> as you said
00:48:21FromDiscord<impbox [ftsf]> we made a lot of money "fixing" magento performance for customers just by putting lots of caches in front of it
00:48:38FromDiscord<jfmonty2> yeah I love how that's always the solution
00:48:48FromDiscord<jfmonty2> like how they built support for Varnish because they couldn't do it fast enough themselves
00:49:39FromDiscord<jfmonty2> tbh I don't even blame PHP for the most part, I mean it doesn't help but I've seen fast sites written in PHP
00:49:53FromDiscord<jfmonty2> but Magento did it to themselves with shitty design choices
00:50:06FromDiscord<impbox [ftsf]> and made it worse with every release
00:50:11FromDiscord<jfmonty2> oh yes
00:50:26FromDiscord<jfmonty2> last time I tried to update it, I discovered that Elasticache is now a hard requirement (???)
00:51:49FromDiscord<jfmonty2> and I've lost count of the garbage 3rd-party extensions that are now bundled-by-default because somebody paid them money, and in some cases can't even be disabled because basic functionality now depends on them
00:57:00FromDiscord<impbox [ftsf]> yup, oh well, good incentive to get away from it
00:57:16FromDiscord<jfmonty2> some day I'll just write my own
00:57:45FromDiscord<jfmonty2> maybe in Nim! if I can convince my manager
01:06:41FromDiscord<ynfle (ynfle)> @beef I don't get this syntax `thing.base[: type].mitems`
01:07:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FVF
01:08:05FromDiscord<Elegantbeef> `[: type]` is just a solution for generics + method call syntax
01:08:15FromDiscord<Elegantbeef> you can of course do `seq[int](myDist).mitems`
01:10:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FVG
01:10:44FromDiscord<Elegantbeef> Ideally someone fixes borrowing generic symbols, but presently i think they only work for procs
01:20:18FromDiscord<demotomohiro> Nim needs `[:type]` syntax because Nim use`[]` for both generic parameter and array/seq element access?
01:20:57FromDiscord<Elegantbeef> Yes it needs it to know whether it's `[](a.b)` or `b[](a)`
01:21:53FromDiscord<ynfle (ynfle)> Thanks. For some reason that didn't work for me
01:22:04FromDiscord<Elegantbeef> It doesnt or didnt?
01:22:31FromDiscord<ynfle (ynfle)> It does now, but what I tried to do, didn't work
01:25:49FromDiscord<ynfle (ynfle)> nvm, I think it's because I forgot the `var` in the proc definition
01:25:53FromDiscord<ynfle (ynfle)> Don't need it anyway
01:36:18FromDiscord<demotomohiro> There are not many charactors that can be used like parenthesis in ascii code and some programming language reuse same charactor for different thing. C++ uses '>' for compare, bit shift and template parameter and `vector<vector<int>>` caused problem.↵If Nim could use unicode parenthesis like 【】 or「」 and didn't reuse them for different things, Nim would not need to create a inconsistent `[:type]` syntax.
01:36:46FromDiscord<Elegantbeef> Sure but that's also a very annoying thing to write on the standard US keyboard
01:37:06FromDiscord<Elegantbeef> The `[: T]` is a nice solution to the problem imo
01:42:41FromDiscord<Elegantbeef> Well the proof of concept macro REPL has started 😀
01:49:22FromDiscord<demotomohiro> I thought always use `[:T]` for every generic parameters would be consistent coding rule but Nim says `var x: seq[:int]` is invalid indentation.
01:50:15FromDiscord<Elegantbeef> Well it's an escape hatch for `[]`
01:51:30FromDiscord<Elegantbeef> I think it's fine to not allow `seq[: T]` since it's odd and bad style in this case
01:51:43FromDiscord<Elegantbeef> There is no ambiguity to solve there
01:56:08FromDiscord<demotomohiro> But there are 2 different ways to specify generic parameters and I have to choose right one o n the right place is inconsistent and not simple.
01:58:53FromDiscord<demotomohiro> I can use one syntax to specify generic parameter in anywhere would be nice.
02:04:38FromDiscord<Elegantbeef> Well suggest a way of doing it that isnt hideous or confusing 😛
02:11:54FromDiscord<demotomohiro> How about to `[.T.]` syntax? It use '.' like pragma. AFAIF, Nim never use '.' for suffix nor prefix. I don't think it looks so odd.
02:13:03FromDiscord<demotomohiro> AFAIK, Nim never use '.' for suffix nor prefix.
02:15:26FromDiscord<Elegantbeef> I feel like making generics always `[.T.]` falls under hideous
02:15:32FromDiscord<Elegantbeef> Pragmas are already hideous
02:19:27FromDiscord<demotomohiro> That idea was already suggested in 2015: https://github.com/nim-lang/Nim/issues/3502
02:22:33FromDiscord<cpunion (Li Jie)> sent a code paste, see https://paste.rs/7E0
02:27:43FromDiscord<demotomohiro> This idea looks best but he changed mind: https://github.com/nim-lang/Nim/issues/3502#issuecomment-152781004
02:41:59*src quit (Quit: Leaving)
03:24:53*arkurious quit (Quit: Leaving)
03:44:52FromDiscord<Rika> pragmas do not look hideous to me lol
03:52:12FromDiscord<hyu1996> what is this https://media.discordapp.net/attachments/371759389889003532/912913462856941609/unknown.png
03:53:42FromDiscord<hyu1996> garbled code?
04:04:18FromDiscord<Rika> broken linK?
04:04:20FromDiscord<Rika> dunno
04:06:02*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:11:42*ox joined #nim
04:12:29*ox is now known as oz
04:51:42*rockcavera quit (Remote host closed the connection)
05:23:04*elph quit (Quit: Connection closed for inactivity)
06:13:00FromDiscord<claude> pragmas don't look bad, it's just that the symbol characters around them are distracting from the usually ~4 letter words inside them that are important, just curlies would have the same problem
06:17:24FromDiscord<claude> they're still better than things like java annotations imo
06:18:32FromDiscord<claude> though that might be because they come after the declaration, which i think is pretty uncommon
07:29:25FromDiscord<𝙧𝙚𝙢> is there a more idiomatic way of doing this loopign structure in nim
07:29:33FromDiscord<𝙧𝙚𝙢> the while(1) i mean
07:29:34FromDiscord<𝙧𝙚𝙢> sent a code paste, see https://play.nim-lang.org/#ix=3FWz
07:30:39FromDiscord<Elegantbeef> `while true`
07:30:56FromDiscord<haxscramper> idiomatic nim would probably use less continue/returns, but that's up to you
07:31:05FromDiscord<haxscramper> "structured control flow"
07:31:07FromDiscord<𝙧𝙚𝙢> well i need to build up a ast
07:31:12FromDiscord<𝙧𝙚𝙢> so idk if i have a choice
07:32:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FWA
07:32:24FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3FWB
07:32:28FromDiscord<Elegantbeef> and even then the `return n ` is questionable
07:32:32FromDiscord<Elegantbeef> There we go
07:33:22FromDiscord<haxscramper> (edit) "https://play.nim-lang.org/#ix=3FWB" => "https://play.nim-lang.org/#ix=3FWC"
07:34:17FromDiscord<𝙧𝙚𝙢> slight issue my lexer has the tokens emitted for `1 + 2` as `[tkInt, tkPlus, tkInt]` - there is no `Add` token
07:34:36FromDiscord<haxscramper> Ins't `Plus` == `Add`?
07:34:53FromDiscord<𝙧𝙚𝙢> wait
07:34:53FromDiscord<𝙧𝙚𝙢> yeah
07:35:44FromDiscord<𝙧𝙚𝙢> wait howd you do `new` in nim
07:35:58FromDiscord<𝙧𝙚𝙢> i have a `Node(kind: thing, ...)` struct
07:36:29FromDiscord<haxscramper> you can do func newTree(kind: NodeKind, subnodes: varargs[Node]): Node
07:36:31FromDiscord<𝙧𝙚𝙢> this basically
07:36:33FromDiscord<𝙧𝙚𝙢> sent a code paste, see https://play.nim-lang.org/#ix=3FWE
07:36:38FromDiscord<haxscramper> first of,
07:36:44FromDiscord<𝙧𝙚𝙢> hm?
07:40:53FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3FWF
07:41:03FromDiscord<𝙧𝙚𝙢> no nim uses nnk
07:41:22FromDiscord<haxscramper> I have a compiler fatigue then, it uses `nk`
07:41:35FromDiscord<𝙧𝙚𝙢> good idea changing it tho
07:41:46FromDiscord<𝙧𝙚𝙢> so can u give an example of how i can implement subnodes
07:44:16FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3FWH
07:44:24FromDiscord<haxscramper> The proc above is a constructor
07:44:50FromDiscord<Elegantbeef> There are some sexy nodes 😛
07:45:00FromDiscord<haxscramper> And you don't have the `Add/Plus/Minus` nodes for expressios, you have `Infix[Ident("+"), <some-node>, <some-node>]`
07:45:13FromDiscord<𝙧𝙚𝙢> this is mildly confusing, could u give an example of using it for an add node and string node?
07:45:24FromDiscord<haxscramper> Same for `Call[Ident("+"), <arg-1>, <arg-2>]`
07:45:34FromDiscord<𝙧𝙚𝙢> In reply to @𝙧𝙚𝙢 "this is mildly confusing,": ^
07:45:57FromDiscord<haxscramper> `func newXxxNode(strVal: string): XXXNode = XXXNode(kind: xxxStr, strVal: strVal)`
07:46:02FromDiscord<haxscramper> Like this?
07:46:10FromDiscord<𝙧𝙚𝙢> i mean the whole thing
07:46:16FromDiscord<𝙧𝙚𝙢> i dotn really understand the code
07:47:37FromDiscord<𝙧𝙚𝙢> In reply to @haxscramper "Same for `Call[Ident("+"), <arg-1>,": especially this part
07:48:16FromDiscord<𝙧𝙚𝙢> @haxscramper
07:48:27FromDiscord<𝙧𝙚𝙢> could u epxlain it please
07:48:30FromDiscord<haxscramper> yes, give be a second to write an example
07:48:35FromDiscord<𝙧𝙚𝙢> okay
07:55:47*PMunch joined #nim
07:57:57FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3FWK
07:58:28FromDiscord<Elegantbeef> Damn hax you went all out
07:58:32FromDiscord<Elegantbeef> +1 to you
07:59:07FromDiscord<haxscramper> etc
07:59:10FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3FWL
07:59:26FromDiscord<𝙧𝙚𝙢> is this some cursed nim java hybrid 🤔
07:59:36FromDiscord<haxscramper> I suppose `Token` is a current token that you edit somewhere else, so you can have a
07:59:39FromDiscord<𝙧𝙚𝙢> tysm tho this makes much more sense
07:59:55FromDiscord<𝙧𝙚𝙢> `token` is just `parser.peek`
08:00:02FromDiscord<haxscramper> `func newIdent(token: TokenType): XXXNode = newXXXIndet(token.strVal)`
08:00:03FromDiscord<𝙧𝙚𝙢> just returns the `n`th token
08:00:50FromDiscord<haxscramper> also look at the `lispRepr` - you can see the utility of the single `subnodes` field
08:01:12FromDiscord<haxscramper> imagine you had to write something like that with separate fields for all the nodes and then repeatedly edit it each time you add a new tree kind
08:01:13FromDiscord<𝙧𝙚𝙢> is this a builtin function were overriding or?
08:01:35FromDiscord<haxscramper> no, it is just a common convention
08:01:51FromDiscord<𝙧𝙚𝙢> ah
08:02:05FromDiscord<𝙧𝙚𝙢> also only other thing is im struggling to see where subnodes is being populated
08:02:59FromDiscord<haxscramper> sent a code paste, see https://paste.rs/inH
08:03:01FromDiscord<haxscramper> but none of them are "built-in"
08:03:28FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3FWP
08:03:34FromDiscord<haxscramper> `@` converts `varargs` tot he `seq[Node]`
08:03:40FromDiscord<𝙧𝙚𝙢> ohh i see
08:05:18FromDiscord<𝙧𝙚𝙢> so Infix is used instead of Add/Sub/Mul/Div?
08:05:18*blackbeard420_ joined #nim
08:05:47*blackbeard420 quit (Ping timeout: 264 seconds)
08:06:17*systemdsucks quit (Ping timeout: 250 seconds)
08:06:23*joshbaptiste quit (Ping timeout: 264 seconds)
08:06:32FromDiscord<haxscramper> Yes. You can use dumpTree from std/macros and see how nim parses this
08:06:44FromDiscord<𝙧𝙚𝙢> ahh ok
08:06:53FromDiscord<𝙧𝙚𝙢> also off topic but whats a better way to structure this
08:06:53FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3FWS
08:06:55FromDiscord<𝙧𝙚𝙢> spam incoming
08:07:12FromDiscord<𝙧𝙚𝙢> this is very ugly code
08:07:12FromDiscord<𝙧𝙚𝙢> sent a code paste, see https://play.nim-lang.org/#ix=3FWT
08:07:20FromDiscord<𝙧𝙚𝙢> however its just a list of tokens
08:07:26FromDiscord<𝙧𝙚𝙢> so idk if i can use the same as the AST
08:07:57*systemdsucks joined #nim
08:08:09*joshbaptiste joined #nim
08:08:54FromDiscord<𝙧𝙚𝙢> i just dont want this to be this ugly if its possible
08:09:21FromDiscord<𝙧𝙚𝙢> its less than it was before a day or two ago but still a lot of ugliness
08:11:41FromDiscord<𝙧𝙚𝙢> and how would i better name them than tk
08:11:42FromDiscord<haxscramper> Tokens are most ok I guess, but it of course depends on crazy you want to go
08:12:00FromDiscord<haxscramper> In reply to @𝙧𝙚𝙢 "and how would i": ctk ? Just first letter of the language
08:12:05FromDiscord<haxscramper> qtk
08:12:13FromDiscord<haxscramper> Well, you get the idea
08:12:16FromDiscord<𝙧𝙚𝙢> i see
08:12:59FromDiscord<haxscramper> I mean there is not a lot of space for maneuvering anyway, it is a token kind, so you would probably end up with tk somewhere
08:13:42FromDiscord<𝙧𝙚𝙢> yeah
08:17:08FromDiscord<𝙧𝙚𝙢> also whats func vs proc
08:19:40FromDiscord<Elegantbeef> `func` is pure in that it cannot have side effects
08:19:58FromDiscord<Elegantbeef> so you can only mutate state of things passed in as `var`
08:20:24FromDiscord<𝙧𝙚𝙢> i see
08:24:21FromDiscord<haxscramper> for that to be true enable `{.experimental: "strictFuncs".}`, otherwise you can also mutate `ref`, which is most likely not what you want if you use `func`
08:28:12FromDiscord<evoalg> I just found out that `.add` not like python's `.append` in that it seems to do this conversion ... https://play.nim-lang.org/#ix=3FX0
08:31:41FromDiscord<Elegantbeef> It doesnt get converted there is a `seq.add(seq)`
08:31:51FromDiscord<Elegantbeef> Procedures can overload!
08:32:01FromDiscord<evoalg> ahhhh
08:32:11FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/912983926916661288/image.png
08:32:23FromDiscord<Elegantbeef> Dont know if they're contigious in the docs
08:32:50FromDiscord<𝙧𝙚𝙢> In reply to @haxscramper "your code here would": btw i tried to implement this and it doesnt work
08:33:02FromDiscord<𝙧𝙚𝙢> ` of rtkPlus: node = newRuneNode(rnInfix, newRuneIdent(token.strVal), node, parseFactor)↵`
08:33:30FromDiscord<𝙧𝙚𝙢> sent a code paste, see https://play.nim-lang.org/#ix=3FX1
08:33:43FromDiscord<haxscramper> `parseFactor()`
08:33:50FromDiscord<haxscramper> you passed a proc, not proc's resultt
08:33:58FromDiscord<𝙧𝙚𝙢> still not working
08:34:03*xet7 quit (Remote host closed the connection)
08:34:12FromDiscord<𝙧𝙚𝙢> you never defined a newXXXnode that takes this params
08:34:23FromDiscord<𝙧𝙚𝙢> unless u meant newTree?
08:34:33FromDiscord<haxscramper> yes, new tree
08:34:52FromDiscord<haxscramper> well, it is a pseudocode anywya
08:35:09FromDiscord<haxscramper> yes, I messed up names
08:35:14*xet7 joined #nim
08:35:20FromDiscord<𝙧𝙚𝙢> yeah just confused me a bit lol
08:45:45FromDiscord<𝙧𝙚𝙢> @haxscramper seeing as u have knowledge w/ parsing i assume, could u help me w/ why my parseFactor function just recurses forever?
08:45:55FromDiscord<𝙧𝙚𝙢> sent a code paste, see https://play.nim-lang.org/#ix=3FX3
08:45:56FromDiscord<𝙧𝙚𝙢> this is all the relavent code
08:46:06FromDiscord<𝙧𝙚𝙢> im testing it w/ expression `2 4`
08:47:22FromDiscord<haxscramper> You call parse factor immediately in the parse factor, it is not possible to parse infix expressions using simple recursive descent parser
08:47:39FromDiscord<𝙧𝙚𝙢> so what should i do then
08:48:02FromDiscord<haxscramper> You need to use a Pratt parser, or precedence climbing algorithm, or shunting-yard, IIRC those are the alternatives
08:48:21FromDiscord<𝙧𝙚𝙢> brb killing myself
08:48:25FromDiscord<𝙧𝙚𝙢> this sounds way harder
08:49:55FromDiscord<haxscramper> https://github.com/haxscramper/hack/blob/4b3672348cef91bb8e9441d29c127e73be5d4b69/testing/nim/wip1/shunting_yard_parser.nim
08:50:13FromDiscord<haxscramper> https://github.com/haxscramper/hack/blob/master/testing-impls/parsing/pratt.nim
08:50:31FromDiscord<haxscramper> those won't compile beacuse I already broke all dependencies twice
08:51:12FromDiscord<haxscramper> but it worked at some point at least
08:51:51FromDiscord<𝙧𝙚𝙢> looks complex and confusing
08:55:13FromDiscord<𝙧𝙚𝙢> @haxscramper so hwo do i convert my code to shunting yard or do i only do it for my factor and term parsing functions?
08:55:31FromDiscord<haxscramper> only for expression parsers
08:56:09FromDiscord<𝙧𝙚𝙢> how do i create a stack in nim
08:56:16FromDiscord<𝙧𝙚𝙢> is there a data type
08:56:58FromDiscord<that_dude> I want to confirm my email for the forums, but nothing was sent to me? How do I confirm it?
08:57:22FromDiscord<haxscramper> `seq.add`, `seq.pop`↵(@𝙧𝙚𝙢)
08:57:30FromDiscord<haxscramper> ping @dom96↵(@that_dude)
08:58:13FromDiscord<𝙧𝙚𝙢> ok thanks
08:58:16FromDiscord<that_dude> Well @dom96 If you're awake, how would I go about it? (sorry for ping)
09:02:01FromDiscord<𝙧𝙚𝙢> sent a code paste, see https://play.nim-lang.org/#ix=3FX8
09:03:45*neurocyte0132889 joined #nim
09:03:45*neurocyte0132889 quit (Changing host)
09:03:45*neurocyte0132889 joined #nim
09:05:26FromDiscord<𝙧𝙚𝙢> @haxscramper any idea because if i just remove the return it will break the entire RD parser
09:06:20FromDiscord<𝙧𝙚𝙢> but i need to push it to the operand stack which im not sure how to do both
09:06:24FromDiscord<haxscramper> I recommend you to read about the algorithm first, because it is not exactly a trivial hack-in, and it is better to understand what is going on
09:06:24FromDiscord<𝙧𝙚𝙢> without breaking the entire thing
09:06:52FromDiscord<𝙧𝙚𝙢> i have a wikipedia article up
09:07:00FromDiscord<𝙧𝙚𝙢> im just wondering how the fuck do i get this to not break
09:07:35FromDiscord<haxscramper> I never actually wrote a proper parser for whole expressions, I just had this for some calculator thing
09:07:53FromDiscord<𝙧𝙚𝙢> ok well how would i get this working though
09:08:21FromDiscord<haxscramper> https://gist.github.com/haxscramper/3562fa8fee4726d7a30a013a37977df6#examples there are quite a few implementations that you can look at
09:09:57FromDiscord<𝙧𝙚𝙢> https://github.com/nc-x/crafty/blob/master/src/craftypkg/parser.nim↵↵this is just using RD lol
09:21:11*advesperacit joined #nim
09:24:45*Guest3758 joined #nim
09:26:17Guest3758Hello. New to nim. I'm trying to create a template/macro that will print an expression then evaluate it. Something like: demo 1+1 => echo "1+1", 1+1
09:27:07Guest3758I can't splice the expression inside the string. I've tried:
09:27:08Guest3758macro demo(expr) = quote("@") do: echo "@expr = ", @expr
09:27:18Guest3758but it doesn't work. What do I miss?
09:28:26FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3FXe here you go
09:28:40FromDiscord<Elegantbeef> Oh i misread what you wanted but close enough 😀
09:29:16FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3FXf for that proper thing
09:29:30FromDiscord<Elegantbeef> My assumption is that it was printing `@expr = 1+ 1` ?
09:30:16FromDiscord<Elegantbeef> If so that's cause you should do before `let strExpr = expr.repr` `echo @strExpr, " = ", @expr`
09:31:14Guest3758Thanks!
09:31:15Guest3758template demo(expr) = echo astToStr(expr), " = ", `expr`
09:31:18Guest3758Is what I waned
09:31:23Guest3758*wanted
09:31:37FromDiscord<Elegantbeef> For stuff like this templates are more suited anyway
09:31:51FromDiscord<Elegantbeef> templates for copy pastes, macros for introspection required logic
09:37:33FromDiscord<𝙧𝙚𝙢> this algorithm is insanely complex
09:42:14*fputs0 joined #nim
09:44:06*fputs quit (Ping timeout: 245 seconds)
09:44:06*fputs0 is now known as fputs
09:51:47*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
09:52:45*neurocyte0132889 joined #nim
09:52:45*neurocyte0132889 quit (Changing host)
09:52:45*neurocyte0132889 joined #nim
09:57:50PMunch@Guest3758, just in case you want a ready made solution: https://nim-lang.org/docs/sugar.html#dump.m%2Cuntyped
10:02:09*Guest3758 quit (Ping timeout: 256 seconds)
10:03:54FromDiscord<hyu1996> https://play.nim-lang.org/#ix=3FXm how to make it work
10:05:10FromDiscord<Elegantbeef> i assume someone realized it was just `.subobj` away 😀
10:12:47FromDiscord<hyu1996> sorry for my mistake
10:13:30FromDiscord<hyu1996> typo
10:13:42FromDiscord<Elegantbeef> Dont apologize, you did nothing wrong!
10:14:12FromDiscord<Rika> Unlike you beef you do everything wrong
10:14:17FromDiscord<Rika> Smh
10:14:24FromDiscord<Elegantbeef> Indeed
10:19:45*rlp10 quit (Ping timeout: 250 seconds)
10:20:01*rlp10 joined #nim
10:34:46FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3FXr
10:35:49FromDiscord<enthus1ast> `var flagsArr = [0x01'u8, 0x20'u8]`
10:35:51FromDiscord<enthus1ast> ...
10:36:00FromDiscord<enthus1ast> thanks guys and gals \:)
10:36:41FromDiscord<Elegantbeef> is the `...` you solving it?
10:36:45FromDiscord<enthus1ast> yes
10:36:57FromDiscord<Elegantbeef> Second one of these, rubber ducking is fun!
10:37:40FromDiscord<enthus1ast> thats why adding types to vars is a good thing, would have catched it immediately
10:38:01FromDiscord<tandy> i think i just found a unittest bug
10:38:04FromDiscord<Rika> I’m assuming the array was of 64 but numbers
10:38:08FromDiscord<Rika> Bit
10:38:11FromDiscord<enthus1ast> yes
10:38:16FromDiscord<Rika> Lol
10:38:44FromDiscord<tandy> aparently having 13 checks in a suite is too many?
10:39:11FromDiscord<Rika> Too many how?
10:39:16FromDiscord<Rika> What issue did you run into
10:40:59FromDiscord<tandy> i have a suite with 13 tests, each has a check
10:41:35FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3FXt
10:41:51FromDiscord<tandy> but if i comment out hte check it runs
10:42:22FromDiscord<enthus1ast> so can you comment ANY one of your tests, or just the last one?
10:42:52FromDiscord<enthus1ast> `Error: generic instantiation too nested` imho indicates that the compiler tries to unwrap a generic call
10:43:05FromDiscord<enthus1ast> recursively until it fails
10:43:36FromDiscord<tandy> hm actualy using a new suite didnt help
10:43:58FromDiscord<tandy> any `check`
10:44:16FromDiscord<tandy> oh wait no
10:44:17FromDiscord<tandy> not any check
10:44:33FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3FXv
10:44:40FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3FXw
10:44:42FromDiscord<tandy> just checks that look like these
10:49:30FromDiscord<hmmm> hoy beauties! if I have an enum directions north south west, can I add east at runtime?
10:49:47FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3FXy
10:50:34FromDiscord<tandy> il try
10:51:00FromDiscord<enthus1ast> @hmmm\: no
10:51:15FromDiscord<hmmm> 😓
10:51:46FromDiscord<tandy> this worked
10:51:49FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3FXA
10:52:09FromDiscord<enthus1ast> yeah strange
10:52:34FromDiscord<enthus1ast> might actually be a bug in unittest
10:53:52FromDiscord<enthus1ast> @hmmm\: when you'r goal is to add another value to an enum
10:54:03FromDiscord<tandy> hmm how can i find if ther is an existing issue..
10:55:21FromDiscord<enthus1ast> @hmmm\: i mean, what could be potentially be the goal here? Adding an enum at runtime makes no sense (or i can't imagine one to be honest)
10:56:58FromDiscord<hmmm> actually I think I don't really need to use an enum (well except for the fact I need to rewrite the entire app lol), I need to use some kind of data structure that allows the user to add new options to it
10:57:23FromDiscord<enthus1ast> while running?
10:57:27FromDiscord<hmmm> yep
10:57:41FromDiscord<enthus1ast> yeah then better use a seq, or table, or hashset
10:58:19FromDiscord<hmmm> hm yea but the enum was comfy because it kinda restricted the flow of it
10:58:28FromDiscord<hmmm> maybe I'll just hack a seq
10:58:34FromDiscord<tandy> and i dont really know how to make an MWE,
10:58:46FromDiscord<enthus1ast> MWE?
10:59:05FromDiscord<tandy> minmum working example
10:59:20FromDiscord<tandy> i wrote this but it works..
10:59:21FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3FXD
11:01:53FromDiscord<enthus1ast> maybe rip everything out of board that does not get touched by getPlayerMoves(board.human)
11:31:31PMunchWhen I do `createShared` and `freeShared`, can I but a GC'ed element like a string into that object?
11:31:49PMunchThe data might be used and freed by a different thread than the one which allocated it
11:34:37FromDiscord<Rika> Not sure how that would fuck with the reference counting
11:34:46FromDiscord<KittyBorgX> heyy, im new here!
11:34:50PMunchYeah that's what I'm afraid of
11:35:03PMunchI do use ORC by the way
11:35:08PMunchWelcome @KittyBorgX!
11:35:10FromDiscord<Rika> Hello
11:40:31FromDiscord<KittyBorgX> In reply to @PMunch "Welcome <@786599434960109568>!": Thankss!!
11:40:48FromDiscord<impbox [ftsf]> Welcome!!
11:41:20FromDiscord<KittyBorgX> ty!!
11:41:44FromDiscord<KittyBorgX> i want to learn and start using nim for daily basis and for my compiler development!
11:42:01FromDiscord<KittyBorgX> are there any good resources like yt vids or ebooks?
11:42:02PMunchSounds like a good fit!
11:42:31PMunchThis is a good place to start: https://nim-lang.org/documentation.html
11:42:43FromDiscord<KittyBorgX> In reply to @PMunch "This is a good": Thanks!!
11:42:44FromDiscord<enthus1ast> Hi @KittyBorgX
11:42:48FromDiscord<KittyBorgX> hey1
11:43:35FromDiscord<KittyBorgX> i started my journey in nim cuz i find it to be the perfect place between js / cpp / python and rust
11:43:45FromDiscord<KittyBorgX> all the features in one language hehe
11:44:09PMunchSounds familiar :P
11:45:06FromDiscord<impbox [ftsf]> I think a good way to get familiar with nim is to port something you've written in another language to it
11:45:30FromDiscord<impbox [ftsf]> It's good to have a goal
11:45:48FromDiscord<impbox [ftsf]> Other than just "i want to learn nim"
11:46:56PMunchOr just some small project that you want to make
11:48:48PMunchUgh, this is why I wish the new ARC/ORC stuff was documented better..
11:49:35PMunchAraq, ARC/ORC should really be documented better, specifically I want to know how it works across threads
11:52:18FromDiscord<haxscramper> what specific points are missing from the docs
11:52:51FromDiscord<KittyBorgX> In reply to @impbox "I think a good": yeah! i was finding a language to port my compiler written in rust cuz rust is a pain to work with and i stumbled upon nim!
11:53:00PMunch@haxscramper, I just struggle with figuring out what I can and can't do when it comes to threads
11:53:04FromDiscord<haxscramper> I don't know anything about arc-threading interaction, but surely your frustration is not just general "bad docs", you have some specific pain points
11:53:20FromDiscord<KittyBorgX> does nim have an init tool, like `cargo new --bin myproject` ?
11:53:27FromDiscord<haxscramper> `nimble init`
11:54:07PMunchThis time I interact with a C library which can hold a reference for me and give it back to me when I get called later (which might not occur on the same thread). I use createShared for this, which works fine, but can I put GC'ed memory in that object?
11:54:41FromDiscord<KittyBorgX> In reply to @haxscramper "`nimble init`": thanks! i wasnt aware of `nimble` being there, i was aware only of the `nim` command!
11:55:41PMunchLast time I was wondering if I could "steal" GCed memory from a thread. If one thread has allocated memory and put it in e.g. an array. Then another thread who knows where in memory this array lies, copies out the reference to this object and removes it from the array (either protected by a lock or with an atomic operation).
11:56:08PMunchWould that work? Or does the thread have to do something in order to move memory from one thread to another
11:56:38PMunchJust general things which I feel like I would be able to reason about if I had a document that shed some more light on the details of how ARC/ORC works
11:57:00PMunch@KittyBorgX, nimble is the most common package manager/build tool for Nim
11:57:47FromDiscord<KittyBorgX> In reply to @PMunch "<@786599434960109568>, nimble is the": ah, thanks for letting me know!
12:02:48FromDiscord<Yardanico> In reply to @PMunch "This time I interact": I think so, as long as you GC_ref it
12:04:31*xet7_ joined #nim
12:04:39PMunchThat's my whole problem, I can't "think" I know what I'm doing, I need to "know" what will and won't work
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:32*supakeen joined #nim
12:07:46*xet7 quit (Ping timeout: 260 seconds)
12:24:27FromDiscord<hmmm> this is hell my desktop pc has 4 spaces for tab and my laptop has 2 spaces and all my files are fucky aaaaaa
12:25:01FromDiscord<hmmm> 😒
12:26:00PMunchglhf
12:27:59FromDiscord<tandy> where is your compiler project?↵(@KittyBorgX)
12:31:33FromDiscord<xflywind> In reply to @PMunch "<@608382355454951435>, I just struggle": IMO, when it comes to threads with ARC, better to treat it as C++. Use smart pointers + ARC and don't use ref. Alternative way is using `std/isolated` which only works for acyclic refs.
12:32:15FromDiscord<xflywind> (edit) "refs." => "refs atm."
12:33:06PMunchThat requires that I'm comfortable with how you would do it in C++, which I'm not
12:33:16PMunchI would do it the C way if I had to handle this in C++
12:47:40FromDiscord<tandy> https://github.com/nim-lang/Nim/issues/19189
12:48:04arkanoidIs there a nim lib for network (graph) analysis? Like networkx for python
12:48:08FromDiscord<tandy> worlds biggest mwe
12:48:11arkanoidOr a wrapper
12:48:19FromDiscord<haxscramper> no and no
12:48:32arkanoidK thanks
12:52:39arkanoidIf the world picked nim instead of python for science, now we would have a cure for cancer, avoided covid, and turned nuclear research into proper energy production.
12:53:53FromDiscord<Rika> Time for you to port it xd
12:56:52FromDiscord<haxscramper> Maybe at some point hcparse will work just the way i want it it work
12:56:52FromDiscord<haxscramper> right now it just 1v1 with me against whole cxx ecosystem
12:57:10FromDiscord<haxscramper> and then I will port everything there is to port
12:57:57FromDiscord<Yardanico> In reply to @arkanoid "Or a wrapper": you can use nimpy to interact with python modules
12:58:14FromDiscord<Yardanico> but the performance will actually be a bit worse than if you were to call it from python itself because of the FFI
12:58:24FromDiscord<Yardanico> of course if you have some heavy calculations that don't need networkx you can do them in the nim side
12:59:13arkanoidSure, I got the proprotype working in python, and hell yeah it works but can't cope with the large amout of data in time. Networkx is a pure python lib
12:59:24FromDiscord<Yardanico> well, then using nimpy won't help
12:59:31FromDiscord<Yardanico> you can try alternative python implementations like PyPy
12:59:39FromDiscord<Yardanico> PyPy is mostly compatible with CPython and has a JIT
13:04:55arkanoidI could try, yeah
13:08:49arkanoidPypy is not compatible with the modules I need. Best bet to split which code to jit or not. Numba joins the party
13:08:57FromDiscord<Yardanico> which ones?
13:08:59FromDiscord<Yardanico> just curious
13:09:10FromDiscord<Yardanico> afaik PyPy has compat with almost all python modules out there nowadays
13:09:27FromDiscord<Yardanico> and I guess it's a discussion better suited for #nim-offtopic :)
13:15:33*rockcavera joined #nim
13:15:34*rockcavera quit (Changing host)
13:15:34*rockcavera joined #nim
13:15:35FromDiscord<tandy> So true↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
13:15:56FromDiscord<tandy> il pray↵(@haxscramper)
13:41:37arkanoidYardanico: http://packages.pypy.org/##pandas
13:41:53FromDiscord<Yardanico> it does work though, this is an outdated list kind of
13:42:24arkanoidwell, pip installing now from scratch (not using conda, but binary from official page)
13:42:31arkanoidbtw, sorry, I'm offtopic
13:42:49FromDiscord<Yardanico> yeah we have #nim-offtopic for that
13:47:54*blackbeard420_ quit (Quit: ZNC 1.8.2 - https://znc.in)
13:48:05*blackbeard420 joined #nim
13:50:32PMunch@arkanoid, in general if no-one is talking on-topic then straying off-topic in this channel is fine
13:51:48arkanoidyeah but talking about something that duck types in official nim channel makes me feel guilty
13:57:25*Vladar joined #nim
14:36:25*src joined #nim
14:56:21FromDiscord<lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FYV
14:56:34FromDiscord<lenis> because, if I move useName to another file the type inference doesnt work, but the code still runs
14:57:29FromDiscord<enthus1ast> template useName(name\: string) = ....
14:57:47FromDiscord<lenis> yes ok, but then you have to pass it in no?
14:57:54FromDiscord<enthus1ast> yes
14:58:05FromDiscord<lenis> thats not as nice from a DSL perspective
15:02:59FromDiscord<lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FZb
15:03:05FromDiscord<lenis> I tried to look through the manual but couldnt find anything
15:04:49FromDiscord<IsaacPaul> 🙃
15:04:56PMunchHmm, I'm wondering if I should just write documentation on ARC and make up the details I'm unsure about. Then PR that to the repository and see if I can get people to elaborate on this stuff that way :P
15:05:08FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3FZd
15:05:49FromDiscord<lenis> yeah i get that works, but then you have to pass around the context
15:06:02FromDiscord<IsaacPaul> so you want a global context..
15:06:23FromDiscord<lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FZe
15:06:30FromDiscord<lenis> onClick needs to know what it's being attached to
15:06:32nrds<Prestige99> I like that approach PMunch lol
15:06:46FromDiscord<lenis> but having to pass around context makes the DSL much less intuitive
15:07:11FromDiscord<IsaacPaul> Oh I see what you're doing.. hmm yea idk
15:07:12PMunchI mean I've been waiting for this documentation ever since ARC was announced..
15:07:33*pro joined #nim
15:09:05FromDiscord<enthus1ast> @lenis\: maybe you can use the with macro https://nim-lang.org/docs/with.html
15:09:24FromDiscord<enthus1ast> or do it kinda like it
15:10:25FromDiscord<lenis> hmm yes that might work
15:12:17FromDiscord<lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FZf
15:12:17FromDiscord<lenis> something like that?
15:16:09FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3FZi
15:16:13FromDiscord<enthus1ast> imho stuff\: string must then be a callback type,
15:17:31FromDiscord<enthus1ast> but it also works with a template
15:18:02FromDiscord<enthus1ast> https://play.nim-lang.org/#ix=3FZn
15:18:33*pro quit (Quit: WeeChat 3.3)
15:21:31nrds<Prestige99> PMunch: fwiw I don't know anything about arc/orc and just use the default gc. So any additional documentation is welcome on my end :P
15:22:44*PMunch quit (Quit: leaving)
15:23:02FromDiscord<enthus1ast> but i guess he's not aktively working on this any more, but you might read into the stuff he did
15:23:04FromDiscord<enthus1ast> https://github.com/PMunch/genui
15:24:55FromDiscord<lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FZp
15:24:56FromDiscord<lenis> In reply to @enthus1ast "https://github.com/PMunch/genui": Ill look at it
15:26:12FromDiscord<IsaacPaul> In reply to @PMunch "I mean I've been": What kind of questions do you have? isn't it just non-atomic ref bumps. When a reference gets copied +1 when it is erased -1 ? on 0 it goes bye bye
15:27:40FromDiscord<Yardanico> In reply to @IsaacPaul "What kind of questions": there are also destructors, cursors (copy elision), different hooks :)
15:27:44FromDiscord<Yardanico> https://nim-lang.org/docs/destructors.html
15:29:57FromDiscord<IsaacPaul> ah neat
15:30:28NimEventerNew thread by Jackpboy: Implementing a GC allocated seq replacement without magic, see https://forum.nim-lang.org/t/8651
15:35:42FromDiscord<lumi> sent a code paste, see https://play.nim-lang.org/#ix=3FZt
15:36:23FromDiscord<enthus1ast> then you must traverse the ast, and generate code accordingly
15:36:23FromDiscord<enthus1ast> but there might be other options, i think writing such a macro is not trivial
15:36:27FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3FZu
15:36:31FromDiscord<Yardanico> In reply to @lumi "Hello, I'm new to": you can't capture mutable `Foo` in your `Bar` object
15:36:37FromDiscord<Yardanico> well, you can, but only with view types and those are highly experimental
15:36:45FromDiscord<Yardanico> because that requires lifetime tracking and stuff
15:37:30FromDiscord<Kermithos> is there any way to limit how many threads can be created and let new threads wait until the running ones are finished?
15:38:04FromDiscord<Kermithos> I tried this code: https://github.com/nim-lang/Nim/issues/19166↵↵but I got a Segmentation fault
15:38:46FromDiscord<lumi> @Yardanico makes more sense, thank you 😄 That compiler error wasn't very clear
15:39:00FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3FZv
15:41:25FromDiscord<lumi> `ref` would imply an indirection wouldn't it?
15:41:44FromDiscord<IsaacPaul> In reply to @Kermithos "I tried this code:": It seems like they're not using a lock around echo? which might be causing their problem. ↵↵The first example here uses a lock: https://nim-lang.org/docs/threads.html
15:41:47FromDiscord<Yardanico> In reply to @lumi "`ref` would imply an": but `var` would be unsafe without proper lifetime tracking if you think about it
15:41:51FromDiscord<Yardanico> so yes, just use `ref` for now
15:42:04FromDiscord<Yardanico> you might experiment with view types but they're still in development
15:42:29FromDiscord<lumi> I'll stick with the regular features for now 😄
15:42:55FromDiscord<lumi> (edit) "😄" => ":D"
15:44:31FromDiscord<Kermithos> In reply to @IsaacPaul "It seems like they're": already tried removing all echos, still crashing
15:46:17FromDiscord<Kermithos> sent a code paste, see https://play.nim-lang.org/#ix=3FZz
15:52:17FromDiscord<IsaacPaul> I tried it with several different compile settings it that works for me.. what version of nim are you using?↵↵Honestly, instead of dealing threads I would use a preexisting scheduler. https://nim-lang.org/docs/asyncdispatch.html perhaps? I'm _assuming_ it uses a thread pool lol.
15:53:16FromDiscord<IsaacPaul> (edit) "I tried it with several different compile settings ... it" added "and" | removed "that"
15:53:45FromDiscord<Yardanico> no
15:53:52FromDiscord<IsaacPaul> damn I'm always wrong xD
15:54:17FromDiscord<Yardanico> you can use it with threads, but you'll have to manually start dispatcher in each thread
15:54:22FromDiscord<Yardanico> and distribute tasks between threads
15:57:09FromDiscord<Kermithos> In reply to @IsaacPaul "I tried it with": afaik this issue only occurs on linux
15:58:01FromDiscord<IsaacPaul> yea the last suggestion I have is to just try it with the latest version 🤷‍♂️
15:58:39FromDiscord<Kermithos> In reply to @IsaacPaul "yea the last suggestion": yea, already tried a bunch of compiler versions and options
16:00:11FromDiscord<IsaacPaul> yea the issue on github is also a linux with nim 1.6.0 . Looks like a bug.
16:08:20*kayabaNerve joined #nim
16:16:03FromDiscord<tandy> is there a datatype like `seq` but for storing distinct `(int, int)`s?
16:17:25FromDiscord<Yardanico> just store (int, int) in a seq?
16:17:32FromDiscord<Yardanico> not sure i understand the question
16:17:54FromDiscord<tandy> sorry i guess i mean unique values
16:18:27FromDiscord<IsaacPaul> you mean like a set
16:19:03FromDiscord<IsaacPaul> https://nim-lang.org/docs/sets.html
16:20:05FromDiscord<tandy> can u add items to a set ?
16:21:44FromDiscord<Yardanico> yes
16:23:03FromDiscord<tandy> hmmokay il try a set then
16:41:17FromDiscord<lantos> hey do you have to escape echo? like can echo be escaped by some random ascii/characters
16:44:57FromDiscord<Yardanico> In reply to @lantos "hey do you have": what do you mean?>
16:45:46FromDiscord<Yardanico> if you want to escape a quote inside a string, use the backslash
16:45:49FromDiscord<lantos> haha it sounds dumb but like do you need to sanitize stdout?
16:46:21FromDiscord<Yardanico> ??
16:48:39FromDiscord<lantos> sent a long message, see http://ix.io/3FZQ
16:49:15FromDiscord<Yardanico> it depends on your environment, but this is not a concert for nim
16:49:22FromDiscord<Yardanico> it's a concern for whatever environment you have
16:49:32FromDiscord<Yardanico> maybe it can treat stdout output in some specific way
16:49:35FromDiscord<Yardanico> but generally no
16:50:16FromDiscord<lantos> mmm, would be the environment but maybe a nim bundle that covers win/lin/mac
16:50:25FromDiscord<Yardanico> ???
16:53:16*kayabaNerve quit (Ping timeout: 245 seconds)
16:54:48FromDiscord<lantos> I'll google more, from your response probably not 😅
16:55:09FromDiscord<IsaacPaul> It's always safe to sanitize and limit user input
16:56:51FromDiscord<IsaacPaul> echo will do exactly as it's told. I'm _assuming_ there is some sort of buffer limit which probably cuts off text if exceeded.
16:58:14FromDiscord<Rika> that would be dependent on the environment again, not on nim
17:00:05*neurocyte0132889 quit (Read error: Connection reset by peer)
17:00:44FromDiscord<lantos> mmm from looking on SO, I think the most that one could do is spam/use annoying ascii
17:01:57*neurocyte0132889 joined #nim
17:01:58*neurocyte0132889 quit (Changing host)
17:01:58*neurocyte0132889 joined #nim
17:03:19FromDiscord<Rika> the question doesnt really make sense
17:03:28FromDiscord<Rika> why are you worried about echo and escape sequences?
17:03:46FromDiscord<Rika> the worst thing some attacker can do is mess with your terminal or logging systems
17:04:26FromDiscord<lantos> In reply to @Rika "the worst thing some": mmm, I'm worried about the environment really.↵But this is mainly what I am seeing.↵There is no chance for execution but just someone using annoying input
17:04:49FromDiscord<Rika> as long as you're not piping output into an interpreter
17:06:16FromDiscord<lantos> sent a code paste, see https://play.nim-lang.org/#ix=3FZT
17:06:29FromDiscord<lantos> and fill the terminal with annoying chards
17:06:31FromDiscord<lantos> (edit) "chards" => "chars"
17:06:47FromDiscord<Rika> or completely fuck with it yes
17:06:51FromDiscord<lantos> (edit) "chars" => "chars, unless you had something parsing checking the stdout"
17:07:01FromDiscord<lantos> huh how so?
17:07:21FromDiscord<Rika> cursor movement escape sequences
17:07:26FromDiscord<lantos> its not like they could send escape seqs
17:07:29FromDiscord<lantos> oh hahaha
17:07:32FromDiscord<Rika> an attacker might possibly edit "older" lines
17:07:39FromDiscord<lantos> yeah that is what I was trying to understand
17:07:40FromDiscord<Rika> are you sure?
17:07:56FromDiscord<lantos> how would you avoid this?
17:08:06FromDiscord<Rika> sanitise?
17:08:11FromDiscord<lantos> yeah
17:08:48*dv^_^2 joined #nim
17:08:51FromDiscord<Rika> sanitise, or output to file (files do not execute escape sequences)
17:09:00*euantorano_ joined #nim
17:09:07FromDiscord<Rika> idk how to disable terminal escape sequences
17:09:19*flynn6 joined #nim
17:09:32FromDiscord<Rika> https://stackoverflow.com/questions/14693701/how-can-i-remove-the-ansi-escape-sequences-from-a-string-in-python
17:09:37FromDiscord<Rika> not nim but related nonetheless
17:10:55*advesperacit_ joined #nim
17:10:56*rp1 joined #nim
17:15:50*advesperacit_ quit (Quit: advesperacit_)
17:16:40FromDiscord<lantos> yeah okay found something that puts the cursor back and overrides text
17:16:43*rlp10 quit (*.net *.split)
17:16:43*advesperacit quit (*.net *.split)
17:16:43*oz quit (*.net *.split)
17:16:43*dv^_^ quit (*.net *.split)
17:16:43*flynn quit (*.net *.split)
17:16:43*euantorano quit (*.net *.split)
17:16:43*stkrdknmibalz quit (*.net *.split)
17:16:45*euantorano_ is now known as euantorano
17:16:45*dv^_^2 is now known as dv^_^
17:16:45*flynn6 is now known as flynn
17:16:54FromDiscord<lantos> feel like that one could be abused hard
17:17:22FromDiscord<Yardanico> how?
17:17:57FromDiscord<lantos> logging? like if you were logging the output then a user could set the cursor back and then write over text
17:18:03FromDiscord<lantos> oh do you mean the example?
17:18:10FromDiscord<Yardanico> In reply to @lantos "logging? like if you": no that won't work
17:18:15FromDiscord<Yardanico> if you do "logging" you do it to somewhere
17:18:17FromDiscord<Yardanico> a file or something
17:18:20FromDiscord<Yardanico> and you can't overwrite text with that
17:18:24FromDiscord<lantos> sent a code paste, see https://play.nim-lang.org/#ix=3G05
17:18:24FromDiscord<Yardanico> in a file
17:21:20*arkurious joined #nim
17:22:55*oz joined #nim
17:23:53*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
17:26:46FromDiscord<Rika> In reply to @Rika "sanitise, or output to": yeah
17:27:58*neurocyte0132889 joined #nim
17:27:58*neurocyte0132889 quit (Changing host)
17:27:58*neurocyte0132889 joined #nim
17:35:15*lumo_e joined #nim
17:59:10FromDiscord<lantos> yeah okay, just tried with the logger, if you filelogger yeah it is clear but consolelogger does it which makes sense.↵Thanks 🙂
18:11:45*xet7_ is now known as xet7
18:12:11*xet7 quit (Quit: Leaving)
18:12:28FromDiscord<lantos> https://nim-lang.org/docs/strutils.html#escape%2Cstring%2Cstring%2Cstring
18:13:57*Colt joined #nim
18:36:38*xet7 joined #nim
18:56:36*Colt quit (Quit: Leaving)
18:57:14*Colt joined #nim
19:01:50*Colt quit (Remote host closed the connection)
19:02:20*Colt joined #nim
19:03:27*Colt quit (Remote host closed the connection)
19:03:29*Colt1 joined #nim
19:03:42*Colt1 quit (Remote host closed the connection)
19:06:37*Colt joined #nim
19:10:30FromDiscord<hmmm> hmmm
19:10:41FromDiscord<hmmm> my entire program is a side effect
19:10:49FromDiscord<hmmm> should I be worried 🧐
19:13:45FromDiscord<IsaacPaul> yea probably
19:14:03FromDiscord<hmmm> 😨
19:15:03FromDiscord<hmmm> still it's kind of elegant in a weird carcrash kind of way
19:15:10FromDiscord<hmmm> I'm proud of my little monster
19:23:13FromDiscord<dabmlfz> sent a long message, see http://ix.io/3G0z
19:24:41*krux02 joined #nim
19:40:19FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3G0D
19:46:41FromDiscord<IsaacPaul> If your project is not a library/package you could just change the values in nim manually 😛 https://github.com/nim-lang/Nim/blob/0d0c249074d6a1041de16108dc247396efef5513/compiler/extccomp.nim#L251↵↵Or via patchfile? (Don't quote me on this)
19:47:36FromDiscord<dabmlfz> that doesn't work sadly. I could also change the values in nim but that's even less elegant than the workaround above XD
19:47:43FromDiscord<dabmlfz> I'll check that issue out, thanks
20:18:06*terminalpusher joined #nim
20:29:29*proaxis joined #nim
20:46:36*proaxis left #nim (#nim)
21:07:54*terminalpusher quit (Remote host closed the connection)
21:14:34*src quit (Quit: Leaving)
21:16:19FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3G13
21:16:46FromDiscord<hmmm> and how do I color the synthax in discord 🤔 , I think I was told but I forgot
21:17:49FromDiscord<haxscramper> Triple backtick followed by the name of the language
21:18:10*ozzz quit (Remote host closed the connection)
21:18:25FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3G15
21:18:25FromDiscord<hmmm> hmm
21:18:52FromDiscord<hmmm> it looks grey to me 🤔
21:23:10FromDiscord<IsaacPaul> In reply to @IsaacPaul "you can also use": ^
21:23:46FromDiscord<reilly> sent a code paste, see https://play.nim-lang.org/#ix=3G17
21:24:23FromDiscord<reilly> The syntax highlighting that Discord provides for Nim is not very extensive, but it's better than nothing. Just don't expect things to suddenly pop with color.
21:24:43FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3G18
21:24:44FromDiscord<hmmm> NICE
21:27:01FromDiscord<reilly> I wish that the syntax highlighting would be improved, but I don't realistically see that happening anytime soon. Frankly, I think we're lucky to have Nim support at all.
21:27:54FromDiscord<IsaacPaul> In reply to @hmmm "hey bois I kinda": I think because you're getting a copy for `i`
21:27:58FromDiscord<hmmm> we also need nim lighting on rosetta code
21:28:34FromDiscord<hmmm> python has it! we can let them boss things around
21:28:52FromDiscord<hmmm> rust doesn't have it too
21:29:22FromDiscord<hmmm> isaac the question is how to get around it and massively populate my thingies
21:30:04FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3G1b
21:30:12FromDiscord<IsaacPaul> but there should be a way to do it without turning the object into a ref
21:30:18FromDiscord<hmmm> ref object
21:30:26FromDiscord<hmmm> hmmm
21:30:33FromDiscord<hmmm> never used it
21:30:55FromDiscord<hmmm> might work lets see
21:33:13*ozzz joined #nim
21:33:55FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3G1d
21:35:36FromDiscord<hmmm> this is perfect
21:35:49FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3G1e
21:36:37FromDiscord<hmmm> woa is there something called eachThing? this might possibly become my favourite nim word 😊
21:37:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3G1f
21:37:51FromDiscord<IsaacPaul> In reply to @hmmm "woa is there something": You can name it whatever you want
21:38:03FromDiscord<hmmm> ah it's i,v
21:38:09FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3G1g
21:38:39FromDiscord<Elegantbeef> You can also do stuff like this is if the index is important ↵https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L65
21:46:47FromDiscord<that_dude> Doesn't the default iterator use `.items` which is why the mutable one is `.mitems`?
21:46:58FromDiscord<Elegantbeef> Yes
21:47:18FromDiscord<Elegantbeef> well actually `for x, y in a` calls `pairs` and `for x in a` calls `items`
22:04:18*Vladar quit (Remote host closed the connection)
23:33:35FromDiscord<geekrelief> While working on my TM binding, I put together this macro to help deal with generating repetitive code. https://github.com/geekrelief/genit I'd like to get feedback on it if anyone finds it useful. I'm wondering is there's already a better way to do "inline" templates?
23:36:06FromDiscord<Elegantbeef> Somewhat interesting but also some what awful 😀
23:36:17FromDiscord<geekrelief> hehe yes it is aweful
23:36:25FromDiscord<geekrelief> (edit) "aweful" => "awful"
23:36:57FromDiscord<geekrelief> I find it addicting like a bad habit.
23:37:34FromDiscord<Elegantbeef> Yea macros are fun and addicting
23:38:10FromDiscord<Elegantbeef> You have practically made `genast` though invokable at base
23:38:12FromDiscord<geekrelief> My mind says no, but my fingers say yes.
23:38:15FromDiscord<Elegantbeef> at root\
23:38:19FromDiscord<geekrelief> yeah that's the idea
23:39:06FromDiscord<Elegantbeef> Yea i mean i did some silly stuff recently as well so who am i to judge
23:39:26FromDiscord<Elegantbeef> drop-2021-11-24\_15.34.24.mp4 https://media.discordapp.net/attachments/371759389889003532/913212244941213747/drop-2021-11-24_15.34.24.mp4
23:39:31FromDiscord<Elegantbeef> Stupid macro repl thingy
23:44:38FromDiscord<geekrelief> In reply to @Elegantbeef "Stupid macro repl thingy": Is that for anything in particular? or just experimenting?
23:45:52FromDiscord<Elegantbeef> well the idea is for making macro writting less tedious, but idk how useful it'll be
23:51:36FromDiscord<geekrelief> I see, yeah macros are kind of annoying. I'm trying to make `genit` something in between a template and macro. Please tell me if inline templates are a terrible idea, and if I'm a horrible person for suggesting it.
23:52:50FromDiscord<Elegantbeef> Well it has a purpose since you use it, but it's quite hard to read
23:54:27FromDiscord<geekrelief> I was playing around with various ways to make it cleaner. I don't know if it's a syntax issue or what. Simply replacing the slashes with dashes or something else might make it easier to read, but I want those things to stand out. Unfortunately, there's always a tradeoff between conciseness and readability.
23:54:55FromDiscord<geekrelief> Kind of like regular expressions.
23:55:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3G1T
23:56:36FromDiscord<Elegantbeef> the same with the tuples
23:56:58FromDiscord<Elegantbeef> `it[0]` for your insertion and then `[](it, 0)` for the index operator
23:57:30FromDiscord<geekrelief> In reply to @Elegantbeef "So my suggestion would": I thought about replacing `str_it` with `$it`, but I didn't want to interfere with intentional usage of `$`, same goes for tuples and indexing.
23:57:56FromDiscord<Elegantbeef> Sure but if you do the way i suggested it's clean and you dont directly interfere
23:58:23FromDiscord<Elegantbeef> I guess i messed up the example since it should be `$it` in the first one
23:58:45FromDiscord<Elegantbeef> You of course need to do the accquoted call, but that's cleaner than these magic variables imo
23:58:46FromDiscord<geekrelief> I think that might be even more confusing to read.
23:59:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3G1V