<< 22-12-2019 >>

00:00:01*junland quit (Quit: %ZNC Disconnected%)
00:00:11FromDiscord<slymilano> Is there something like this for Nim? https://github.com/dominikh/filesize
00:00:50*junland joined #nim
00:01:07FromDiscord<mratsim> maybe bytes2human, see: https://nimble.directory/search?query=size
00:04:30FromDiscord<slymilano> Hm... unfortunately I need to parse the string as well, to convert 287.3 MB into it's bytes in int format
00:26:39FromGitter<Varriount> slymilano: If you need a parser, I recommend NPeg... though that might be a bit too much for simple parsing.
00:27:34FromGitter<Varriount> Zevv: Did you use any special tool for the diagrams in NPeg's documentation, or did you do it by hand?
00:41:22*qwertfisch quit (Quit: ZNC - http://znc.in)
00:41:54*qwertfisch joined #nim
01:08:09*Hideki_ joined #nim
01:19:04FromDiscord<slymilano> Thanks Varriount
01:19:50FromGitter<kayabaNerve> Is there a parser out there that allows conversion between two syntaxes? Like if you enter two NPeg specs, you can convert back and forth.
01:20:09FromGitter<kayabaNerve> Not really the role of a parser, I just assume if such a 'mutator' exists it's built around a parser.
01:20:11FromDiscord<slymilano> I'm liking Nim a lot, I have something running and working, probably not idiomatic, but goes to show how quick you can get productive. https://github.com/sergiotapia/torrentinim 2020 is the year Nim will blow up 🙂
01:41:33FromGitter<bung87> @kayabaNerve the npeg accept extro param , you can save parsed data to a stack , then you can do what you what
02:05:47FromGitter<Varriount> @kayabaNerve I don't quite understand what you're describing. Do you mean, something that would take a regular PEG grammar, and convert it into NPeg code?
02:08:40FromDiscord<exelotl> @slymilano nice! For a quick tip: you can combine the fact that seqs are initialised to empty by default, with the implicit `result` variable, to save quite a few lines
02:08:40FromDiscord<exelotl> https://cdn.discordapp.com/attachments/371759389889003532/658128737552039966/unknown.png
02:10:44*rockcavera joined #nim
02:14:50FromGitter<kayabaNerve> @Varriount Nah. Something that parses X according to PEG grammar XG then outputs Y which can be parsed via YG to a value equivalent to the parsed X
02:15:04FromGitter<kayabaNerve> @bung87 I get that. Not the question :p
02:32:35FromDiscord<slymilano> That is AWESOME @exelotl
02:51:05FromDiscord<exelotl> :)
03:16:32*seerix quit (Ping timeout: 260 seconds)
03:17:42*muffindrake quit (Ping timeout: 260 seconds)
03:19:42*muffindrake joined #nim
03:51:20FromGitter<xflywind> when I use DateTime, I got a crash.
03:51:20FromGitter<xflywind> https://play.nim-lang.org/#ix=255M
03:52:53voltistDoes anyone know how I would go about creating a C fp object in Nim?
03:58:26FromGitter<xflywind> And it seems to appear only in DateTime object. ⏎ https://play.nim-lang.org/#ix=255O
04:03:05disruptekxflywind: it feels a little like my exception issue; like it's do to an alloc problem (ie. init-only fields).
04:03:18disruptek!issue author:disruptek exceptions
04:03:19disbothttps://github.com/nim-lang/Nim/issues/11088 -- 5Exceptions, raises pragma hard to use at best
04:03:20disruptek!issue author:disruptek exception
04:03:22disbothttps://github.com/nim-lang/Nim/issues/11081 -- 3DateTime field on Exception produces inconsistent C/++ handling 7& 2 more...
04:03:25disruptekthat one.
04:03:55disruptekalthough exceptions are refs.
04:08:54disrupteki would try using an object instead of a tuple.
04:13:32FromGitter<xflywind> I can use my object, but can't iterate in it.But if iteration in generic function, it's ok.
04:41:46shashlickleorize: you around?
04:42:28shashlicktrying to get nimterop working with nimsuggest - nimcheck already works correctly but nimsuggest isn't seeing the symbols
04:42:45shashlickunsure how to debug since all I have is neovim in the foreground
04:43:08disruptekthere's a way to tell it to log to a file.
04:47:15shashlickno idea how to use this
04:47:18shashlicknothing goes into the log
04:47:36shashlickno idea what code is being processed in the background
04:50:04*Hideki_ quit (Remote host closed the connection)
04:50:59*Hideki_ joined #nim
04:53:13*chemist69 quit (Ping timeout: 245 seconds)
04:55:14*Hideki_ quit (Ping timeout: 240 seconds)
04:55:21*chemist69 joined #nim
04:58:35FromDiscord<Xydium> So, is a NimNode passed to a macro mutable?
04:58:58FromDiscord<Xydium> I.e., `parent[i] = newNode...` to replace a node in the tree?
05:02:22FromDiscord<Xydium> Or do I have to rebuild the tree, one node at a time?
05:13:10FromDiscord<Xydium> Wait... I'm betting it's because the iterator returns values not references
05:13:52FromDiscord<slymilano> If I built my application with nimble, as a binary - what's the command to build a release for production? nimble build releases a binary, but with development symbols according to nimble's docs.
05:14:08FromDiscord<slymilano> is there like a `nimble build release` or similar?
05:14:38zedeus`nimble build -d:release`
05:16:27FromDiscord<slymilano> Awesome, where do you find this flag? It's not mentioned here: https://github.com/nim-lang/nimble#nimble-build
05:16:42shashlickgets forwarded to nim compiler
05:18:18FromDiscord<slymilano> I see awesome
05:27:21FromDiscord<slymilano> My github actions is dying mid-release because it's not auto answering Y. Is there a way to auto answer this prompt>
05:27:21FromDiscord<slymilano> https://cdn.discordapp.com/attachments/371759389889003532/658178738751799307/Screen20Shot202019-12-2220at2012.png
05:27:43shashlick-y
05:27:58FromDiscord<slymilano> ty
05:30:43disruptekno, just -y. if you at the t it won't work
05:31:13*seerix joined #nim
05:33:30FromDiscord<slymilano> lol
05:34:10FromDiscord<slymilano> Thanks guys, got auto releases working and the project builds + ships in like 50 seconds. https://github.com/sergiotapia/torrentinim/commit/4edae75a7bbe26d6c82c6133273d95c3a62eab71/checks?check_suite_id=370273999
05:34:28FromDiscord<slymilano> Now I need to figure out how to cross compile for all three major platforms, and name the release binaries different things.
05:36:30shashlickjust use travis - https://gist.github.com/genotrance/fb53504a4fba88bc5201d3783df5c522
05:37:20FromDiscord<slymilano> You mean hosted travisCI?
05:37:26FromDiscord<slymilano> I'd rather stay in house in github for free...
05:37:38shashlicktravis is also free - for open source that is
05:38:39shashlickanyway, no reason to change if you prefer what you have, only that the yml file i linked is all you need to get everything working
05:40:50FromDiscord<Xydium> Why does `nimNode[index] = newNode(...` not modify the AST
05:41:03FromDiscord<slymilano> I hear ya thanks for that backup strat @shashlick
05:44:37shashlickno problem
05:45:34shashlick@Xydium - share your code as a paste?
05:46:04FromDiscord<slymilano> It seems like nimble build doesn't use the `-o` or `--out` flag properly.
05:46:04FromDiscord<slymilano>
05:46:04FromDiscord<slymilano> ```
05:46:04FromDiscord<slymilano> THIS DOESN'T WORK, I just get torrentinim
05:46:05FromDiscord<slymilano> # sergiotapia at Sergios-Air in ~/Work/torrentinim on git:master ● [0:44:24]
05:46:05FromDiscord<slymilano> → nimble build -d:release --out:torrentinim-macosx
05:46:06FromDiscord<slymilano>
05:46:08FromDiscord<slymilano> THIS WORKS, I get torrentinim-macosx
05:46:10FromDiscord<slymilano> # sergiotapia at Sergios-Air in ~/Work/torrentinim on git:master ● [0:44:31]
05:46:12FromDiscord<slymilano> → nim c -d:release --out:torrentinim-macosx src/torrentinim.nim
05:46:13FromDiscord<slymilano> ```
05:46:59FromDiscord<Xydium> @shashlick https://pastebin.com/syRJAn6i
05:48:01shashlickslymilano - please use a paste service
05:48:39FromDiscord<slymilano> ok
05:55:27shashlickskymilano: can you try with --debug and see what the actual command line sent to nim is
05:57:29shashlickXydium - current is not mutable (let)
05:59:06FromDiscord<Xydium> Changing it to var doesn't fix the issue
06:00:43FromDiscord<slymilano> Yeah with --debug I can see it's ignoring my --out flag.
06:00:47FromDiscord<slymilano> Is this a bug then?
06:03:52shashlickcan you see if -o works?
06:04:38shashlickXydium: your code doesn't even compile - https://play.nim-lang.org/#ix=2565
06:04:50FromDiscord<slymilano> -o doesn't work either
06:05:30shashlickis there another -o in the command?
06:05:40shashlickdoesn't nimble build decide where the binary should go already?
06:06:36FromDiscord<Xydium> It compiles on my computer lol
06:07:14shashlickwell, if you can get a paste on http://play.nim-lang.org, it will be easier to help 🙂
06:08:20FromDiscord<slymilano> Here's the output; https://pastebin.com/181hLRK9
06:08:37*nsf joined #nim
06:08:41FromDiscord<slymilano> It uses my name at the start, then it's overwritten at the tail end of that command
06:09:14FromDiscord<Xydium> https://play.nim-lang.org/#ix=2566
06:10:00shashlickslymilano - yes cause nimble has been configured with the binary it should build and where it should go
06:11:07FromDiscord<slymilano> so i should just remove the `bin = @["torrentinim"]` from my .nimble file
06:11:14FromDiscord<slymilano> is that correct?
06:12:40shashlick```Error: undeclared identifier: 'uNeq'```
06:13:02shashlickslymilano - if you do that then nimble won't know what to build
06:13:06FromDiscord<Xydium> Yeah, because when the macro doesn't work, it doesn't parse
06:13:22shashlickjust rename it after the fact, or create a separate nimble task that builds with the name you want
06:13:22FromDiscord<Xydium> The macro is supposed to take 'tagged' identifiers (uNeq) and replace with untagged (Neq)
06:13:44FromDiscord<Xydium> Untagged alpha-numeric identifiers are variables in the CSP graph, and should be replaced with an array access
06:14:28FromDiscord<Xydium> The tree output after the macro is identical to the tree input to the macro
06:14:55FromDiscord<Xydium> Despite the fact that the macro does `parent[index] = newNode(...`
06:15:30FromDiscord<Xydium> (well technically it's done by a proc called by the macro but that shouldnt matter)
06:16:42FromDiscord<Xydium> For some reason, the NimNode tree passed to the proc is immutable
06:17:08FromDiscord<Xydium> It doesn't generate any compiler/runtime errors by trying to use the []= op, but it doesn't actually do anything either
06:17:18FromDiscord<Xydium> Or,
06:17:24*Hideki_ joined #nim
06:17:35FromDiscord<Xydium> Somehow, copies are being created where there should be references, and the changes only occur on the copies
06:18:43FromDiscord<Xydium> Pretty sure it's the second one
06:19:01FromDiscord<Xydium> When I echo the treeRepr of current[i] immediately after modifying it, it has the new nodes
06:19:28FromDiscord<Xydium> So the value of current is not a reference to the AST subtree that eventually gets returned by the macro
06:20:14shashlickWhy do you expect tree to change
06:20:30shashlickIt isn't passed in as a var arg
06:20:40FromDiscord<Xydium> and for some reason can't be
06:21:06FromDiscord<Xydium> edit: couldn't be
06:21:17shashlickWhat do you mean
06:21:18FromDiscord<Xydium> but I just added that and the compiler didn't start screaming so maybe...
06:21:31FromDiscord<Xydium> The last time I tried using var NimNode I got lots of errors
06:21:54FromDiscord<Xydium> But alas, it still does not fix the problem
06:22:31shashlickWhat did you change?
06:23:08FromDiscord<Xydium> `proc parseVars(node: var NimNode): (seq[string]) =`
06:23:26*Romanson joined #nim
06:24:45shashlickMaybe pop gives you a copy
06:24:50FromDiscord<Xydium> That's my guess yeah
06:24:55shashlickYou aren't really operating on the original node
06:25:05shashlickWhat's the queue even for
06:25:14FromDiscord<Xydium> Iterative tree traversal
06:25:20FromDiscord<Xydium> I really didn't feel like writing recursion
06:26:32shashlickOk anyway my suggestion would be to work on node directly to avoid some copy
06:27:03shashlickThe for loop could also be copying
06:29:37FromDiscord<Xydium> well, there is no way to work on the nodes directly
06:29:45FromDiscord<Xydium> the only way to get the nodes is putting them through that queue
06:29:59FromDiscord<Xydium> or rewriting recursively but that's its own mess
06:30:00*Hideki_ quit (Ping timeout: 265 seconds)
06:30:12FromDiscord<Xydium> Since I need to preserve each constraints var table at all levels of the tree
06:30:49FromDiscord<Xydium> I.e. given `X == Y and Y == Z`, X is always index 0, y is always index 1, etc, no matter how far down the recursion they are
06:31:00FromDiscord<Xydium> That's why I wanted to do it iteratively, to stay in one function scope
06:31:17FromDiscord<Xydium> but apparently Nim likes passing values too much
06:31:37FromDiscord<Xydium> It doesn't matter if the for loop makes copies
06:31:51FromDiscord<Xydium> I don't modify the nodes from the loop
06:32:16FromDiscord<Xydium> `var current = queue[^1]` doesnt work either
06:46:08*nsf quit (Quit: WeeChat 2.6)
06:56:35*dddddd quit (Ping timeout: 265 seconds)
06:57:05*gour joined #nim
07:00:58*voltist quit (Remote host closed the connection)
07:24:34*seerix_ joined #nim
07:25:02*seerix quit (Ping timeout: 260 seconds)
07:39:32FromGitter<Varriount> Xydium: Still around?
07:53:04*solitudesf joined #nim
08:00:00*gmpreussner quit (Quit: kthxbye)
08:02:56*solitudesf quit (Quit: Leaving)
08:03:13*solitudesf joined #nim
08:04:55*gmpreussner joined #nim
08:26:58*Hideki_ joined #nim
08:31:48*Hideki_ quit (Ping timeout: 260 seconds)
08:55:49*letto quit (Quit: Konversation terminated!)
08:57:50*letto joined #nim
09:01:39FromDiscord<funcmike> How to write a test and code in general in interface like style for ex. pass mocked auth service for test or have multiple storage implementations? Afaik there is no interfaces in Nim? Where can I find some code samples?
09:17:34FromDiscord<Rika> Concepts
09:17:41FromDiscord<Rika> Look at the experimental manual
09:17:50FromDiscord<funcmike> i'm not interested in experimental features
09:18:08FromDiscord<Rika> Inheritance
09:19:44FromDiscord<Rika> Check the manual or nim by example
09:21:50FromDiscord<funcmike> yeah i have checked them
09:22:24FromDiscord<funcmike> and I'm still confused
09:25:50FromDiscord<Milerius> is imariscal in one of the 3 channel ?
09:35:34FromDiscord<funcmike> Rika: Maybe some real world project example. I want to know how to build for something like this (I made it up) - for ex. TestService (it requires/dependencies IStorage for ex. save(s: Session) method and IAuthorization auth(l: LoginInfo): bool method and i want to test TestService with mocked storage and auth if I'm creating Session correctly based on LoginInfo data?
09:37:50FromDiscord<Rika> The best is to make a ref object with dummy methods, then inherit that object for every implementation
09:38:04FromDiscord<Rika> There is no multiple inheritance here
09:38:11FromDiscord<Rika> If you need that then use experimental
09:38:20FromDiscord<Rika> No other way about it AFAIK
09:38:28FromDiscord<funcmike> But why i haved to use inheritence ?
09:38:34FromDiscord<Rika> Well
09:38:37FromDiscord<Rika> You don't have to either
09:39:03FromDiscord<Rika> You can just make 2 objects, actual and mock, with the same procs and argument arity/type
09:39:28FromDiscord<Rika> But if you want the interfaces then I think concepts are the closest thing
09:40:21FromDiscord<funcmike> i dont want interfaces or concepts i want to know how do Nim programmers write code for those cases.
09:40:39FromDiscord<funcmike> langauge is quite old
09:41:13FromDiscord<funcmike> so if there is no interfaces, people are writing in different style and I want to know how they deal with this
09:46:58FromDiscord<funcmike> Is it idiomatic to create just 2 objects (mock and actual) or it's just if Your really need this You can... use this trick?
09:47:09FromDiscord<funcmike> Is it idiomatic to create just 2 objects (mock and actual) or it's just if You really need this You can... use this trick?
09:55:18FromDiscord<mratsim> You write a generator
09:55:31FromDiscord<mratsim> and then you used thse generated objects to test your code
09:57:34FromDiscord<funcmike> mratsim: can you refer me some project or link to code example?
10:11:31FromDiscord<mratsim> https://github.com/status-im/nim-stint/blob/master/tests/property_based_uint256.nim#L30-L37
10:12:08FromDiscord<mratsim> I generate random uint256 and test that the operations invariant are held
10:14:08FromDiscord<mratsim> same here to test neural networks: https://github.com/mratsim/Arraymancer/blob/a4d3fc11f337f0c1837fdb19a34c3b7b7fa6c65c/tests/nn_primitives/test_nnp_gru.nim#L85-L90
10:15:32FromDiscord<mratsim> and in blockchain: https://github.com/status-im/nim-beacon-chain/blob/9050db7b95c7f072a8048cc0f955cbf2a2c5c9e1/tests/spec_block_processing/test_process_attestation.nim#L29-L70
10:17:31FromDiscord<mratsim> the generator are more involved because we pass around mutable objects in blockchain but that's one of the issue of mutable state: https://github.com/status-im/nim-beacon-chain/blob/master/tests/mocking/mock_attestations.nim#L22-L129
10:17:32FromDiscord<funcmike> maybe im too stupid but i dont see how property based testing help me with case that i have described (i just want to know how to write for ex. network service that requires two statefull / impure / sideffect services and test the code that depends on them without knowing how there are implemented - mock them based on common interface)
10:18:35FromDiscord<mratsim> you have one-side that is mocked, and one side under test
10:18:49FromDiscord<mratsim> you need a generator for the mocked side
10:19:38FromDiscord<mratsim> thath just submit valid (or invalid) inputs to the interface
10:21:34FromDiscord<mratsim> once that works you can replace the generator by a fuzzer
10:23:01FromDiscord<mratsim> which is what we did here, for the "attestation" example: https://github.com/status-im/nim-beacon-chain/blob/master/nfuzz/libnfuzz.nim#L51-L69
10:24:23FromDiscord<funcmike> ok maybe i'will describe it that way, forget about tests, mocks, generators, fuzzer and stuff, what if i just want to write proc that requires "Db" and i want to pass to it sqlite or mysql or postgresql?
10:24:42*silvernode quit (Ping timeout: 260 seconds)
10:24:57FromDiscord<mratsim> known at runtime or compile-time?
10:25:10FromDiscord<funcmike> both cases
10:25:21FromDiscord<mratsim> if compile-time only you use generics
10:25:39FromDiscord<mratsim> if runtime you use object variants or inheritance
10:26:27*adeohluwa joined #nim
10:26:51FromDiscord<Rika> common_db
10:27:00FromDiscord<Rika> Or whatever that module was called
10:27:06FromDiscord<funcmike> 😉 its just example
10:27:13FromDiscord<Rika> https://nim-lang.org/docs/db_common.html
10:27:15FromDiscord<Rika> Oof
10:27:24FromDiscord<funcmike> i know this cases is in std lib
10:27:35FromDiscord<Rika> I guess you can look into the modules under db_common though
10:28:00FromDiscord<Rika> See what it did, and apply that to your usecase
10:28:11FromDiscord<funcmike> im writing generally using db as example im aware of nim std lib
10:28:18FromDiscord<mratsim> Example used in production: https://github.com/status-im/nim-eth/tree/master/eth/trie/backends
10:28:18FromDiscord<mratsim>
10:28:18FromDiscord<mratsim> backends are rocksdb, sqlite or LMDB
10:30:42FromDiscord<mratsim> or something I wrote yesterday to abstract implementations differences between windows and posix: https://github.com/mratsim/weave/blob/master/weave/primitives/barriers.nim#L8-L69
10:31:03FromDiscord<funcmike> mratsim: ok this looks like what im looking for (trie backends)
10:31:49FromDiscord<mratsim> basically you just create a wrapper that exports proc with the same name
10:32:33FromDiscord<mratsim> you can use "assumptions" in your other types proc using concepts: https://github.com/mratsim/weave/blob/master/weave/datatypes/prell_deques.nim#L10-L20
10:32:35FromDiscord<funcmike> but trie uses concept
10:32:56FromDiscord<mratsim> https://github.com/mratsim/weave/blob/master/weave/memory/lookaside_lists.nim#L11-L14
10:32:57FromDiscord<funcmike> concept is experimental
10:33:28FromDiscord<funcmike> is it safe to use?
10:34:09FromDiscord<mratsim> Concept is compile-time so any issues will be caught either by the Nim compiler or the C compiler
10:34:27FromDiscord<mratsim> it won't happen like 100hours after your deployed your program
10:34:46Zevvsealmove: you here?
10:34:59FromDiscord<mratsim> also experimental means that it might disappear or be changed, but if it's done there will be a migration path
10:35:14sealmoveZevv: heyyy good timing
10:35:30FromDiscord<mratsim> the simple usage, just ensuring that a proc or field is defined likely won't be changed
10:35:38livcdmratsim: i saw there are some perf issues with weave on windows. but you also mention it is not really a big problem
10:35:58FromDiscord<mratsim> the super complex usages that you can see in the experimental doc might be reworked
10:36:25FromDiscord<mratsim> @livcd, yes, windows memory allocator is really slow when doing trillions of allocations in a couple of milliseconds 😛
10:36:52FromDiscord<mratsim> It's not a problem because it's an extreme, that is made to measure tuntime overhead
10:37:18Zevvsealmove: Oi! so, I'm not sure where to go from here. Building grammars with enums is good and all, but I guess there should be some kind of sum type with a discriminator to match on instead
10:37:34FromDiscord<mratsim> It's most likely due to Windows VirtualAlloc allocating eagerly memory pages instead of on first touch like Linux
10:38:15FromDiscord<mratsim> normal workloads with some computation that takes at least a couple of microseconds are fine
10:38:43FromDiscord<funcmike> ok thanks for help 🙂
10:38:56Zevvdo you have a concrete vision on where this should go yet? If not, I'll just play around a bit to see how it fits what I think is useful
10:39:02livcdinteresting i wonder how does Go get around it or if at all
10:40:21FromDiscord<mratsim> Go is just slow for compute tasks
10:41:28sealmoveZevv: Even if there is a sum type, it's still about matching enums
10:41:50Zevvthat would suffice, right?
10:42:13sealmoveunless i am missing something, yeah
10:42:13ZevvSo npeg needs to know at least which field of the type is the discriminator
10:42:25*dmknght joined #nim
10:42:44FromDiscord<mratsim> I'll have to check more deeply into Microsoft's allocators, mimalloc and snmalloc. But in their paper they mentionned this big difference between Windows and the rest of the OSes
10:43:10sealmoveuser can build it, npeg doesn't need to know about the sum type, only the enums
10:43:21dmknghtHi everybody! Did anybody work with gintro before? I need a little help with spawn process and get output
10:43:50Zevvsealmove: but npeg needs to be able to compare two things to see if there is a match. So it needs to compare a specific field of the passed type
10:44:14Zevvso either I need to tell npeg the name of the field, or I need to pass some kind of callback function that does the work, like algoritm.sort
10:48:31*krux02 joined #nim
10:48:42sealmovelet's say the passed type is an enum (not a sum type). then the user can define his sum typ, pass it as state argument to the peg macro, and construct his sum type. That's how I have it in mind atm. What are you thinking? passing openArray[mySumType]?
10:49:24ZevvWell, I guess that openarray[mySumType] is what a lexer would spit out
10:49:31Zevvso that would be the least friction for the user
10:50:20Zevvthe npeg code blocks would then yield these things for the user to act on
10:50:29sealmovei see, yeah could be the next level ;)
10:51:11ZevvI don't see how I can get this done with enums only, unless npeg keeps track of the index in the subject and the user uses this to reference back to the lexed components
10:51:59ZevvI'm also afraid that the whole thing will blow up in complexity so for your average user it is no longer understandable.
10:52:58*adeohluwa quit (Ping timeout: 260 seconds)
10:53:45sealmovenah, what you shown on the issue discussion is already simple and useful
10:53:51sealmoveshowed*
10:54:03Zevvok, one step at a time then
10:55:20sealmovebut I agree, you can keep doing things for the user, but this might limit flexibility for him, and the api becomes more complex
10:56:37sealmoveaccepting tokens instead of char is not just a convenience-feature, it's essential for making 2-pass parsers
10:57:36sealmoveso my opinion is do the minimum to provide this choice
11:00:02*adeohluwa joined #nim
11:07:55*krux02 quit (Remote host closed the connection)
11:08:43*krux02 joined #nim
11:08:43*Zevv quit (Ping timeout: 260 seconds)
11:09:34*Zevv joined #nim
11:09:44ZevvArg power outage third time this week.
11:10:14*krux02 quit (Read error: Connection reset by peer)
11:10:53FromDiscord<funcmike> What project / resource its recommended to learn idiomatic nim code with simple and clean code without using all of metaprogramming and advanced language features - for newcomers ?
11:11:28sealmovei am not sure what "idiomatic nim code" means :P
11:12:03sealmovenim gives you freedom, you develop your idioms
11:14:41FromDiscord<exelotl> I mean there are still plenty of idiomatic things, like only using return where needed for flow control, or putting a relevant acronym at the start of your enum items (fmRead, fmWrite)
11:15:41adeohluwamaybe some conventions are in the docs like having types capitalized, variable names mostly camelCase e.t.c
11:16:06adeohluwayou will naturally pick that up over time
11:17:15Zevvdon't learn from the compiler source however
11:20:20FromDiscord<funcmike> Ok so maybe project that shows that this is how a good project with "modern nim" can look if you spend with language enough time
11:21:05sealmovejust pick up a project and learn alongside from the docs like adeohluwa said
11:21:15sealmovedoesn't have to be anything specific
11:21:47*adeohluwa quit (Remote host closed the connection)
11:22:20FromDiscord<funcmike> Ok so i will pick mratsim's weave and after a year maybe i will understand something :)
11:22:33lqdev[m]I remember Zevv saying that my WIP embedded programming language has pretty clean code. I still disagree, but you can read for yourself https://github.com/liquid600pgm/rod
11:22:46dom96In case anyone's interested, my book is 50% off (not sure for how long but I think the publisher is doing Xmas sales) https://www.manning.com/books/nim-in-action?a_aid=niminaction&a_bid=78a27e81
11:23:17sealmovethat's nice
11:24:15FromDiscord<funcmike> Yes i have read this book, its good but short
11:24:31Zevvlqdev[m]: given what it does it is pretty clear, but given what it does it is not really a starters codebase
11:25:10FromDiscord<funcmike> From twitter bot and chat app to real project is a long way
11:25:29Zevvsealmove: argh, half my lib ends up with procs now having [S,T]
11:26:00dom96funcmike: twitter bot? It's a twitter website. I'd say that's a pretty sizeable project
11:26:05dom96Especially for a book to cover
11:26:20sealmoveZevv: ¯\_(ツ)_/¯
11:26:44FromDiscord<funcmike> Dont understand wrong Yeah :) its really good book
11:27:04sealmovestill thinking about this sumType, if we come up with a simple interface it could be worth implementing
11:27:52*luis_ joined #nim
11:28:07lqdev[m]@funcmike my friend also told me that this codebase is pretty clean, but again I strongly disagree. it was written during a game jam, don't expect 100% clean code https://github.com/liquid600pgm/memrecall
11:28:52FromDiscord<funcmike> dom96: one of the best books that i have read imho and thank you for it :) i admit i downloaded it from illegal place :) i will buy legal copy
11:29:01dom96lol
11:29:01lqdev[m]it's still idiomatic Nim, because I'm too pedantic
11:32:25FromDiscord<funcmike> dom96: but in our work place we use go and extensive use of channels and gorutines so too convice other guys to try nim i have to find real projects with nim simillar to ours or rewrite some of the them to so im am searching for more then examples in book
11:33:04*tane joined #nim
11:33:37sealmoveZevv: so let's say it does accept seq[mySumType], then in a peg block, the token is $1 (or $2, etc). the user can do $1.someField etc. is this not nice enough? what did you have in mind instead?
11:38:01Zevvno that is what I had in mind indeed
11:38:06Zevvbut now token is only an enum
11:38:51FromDiscord<funcmike> dom96: for example how to tell them ehkem nim httpbeast server is really good (but does not support httpv2 (i appreciate your work) and we must write it our selfs when Go has this for free. So im preparing for many questions.
11:39:17sealmoveok, is there an issue with making a sum type then? more complex codegen?
11:39:35FromDiscord<Milerius> Hey, i have a seq[NimType] inside my NimType i have a string and i want to sort the sequence based on this String, what is the most idiomatic way to do that
11:39:55*luis_ quit (Remote host closed the connection)
11:39:56FromDiscord<Milerius> Can i do smth like : my_seq.sort(my_field) ?
11:40:05dom96funcmike: if you really need http 2.0 then you might just want to use nginx
11:40:07FromDiscord<Milerius> Can i do smth like : my_seq.sort(my_seq.my_field) ?
11:40:09sealmoveZevv: well, there is flex idea, use a union instead of sum type
11:40:15dom96or just put your site behind cloudflare and get that for free
11:41:07sealmovewhich temporarily holds the values for the currently-being-parsed token
11:41:21*luis_ joined #nim
11:41:35sealmovethis would solve the problem, but might introduce new ones, because the lexer and parser will have to work tightly together
11:41:35*luis_ quit (Remote host closed the connection)
11:42:33Zevvindeed.
11:42:42ZevvBut first I'm trying to get stuff working including captures
11:45:26FromDiscord<funcmike> dom96: grpc needs this so nigjnx and cf is not an option for me
11:46:22FromDiscord<Milerius> Hello there is a better to achieve: https://gist.github.com/Milerius/28754e3ba5158ff82ac7cfcd8c7412ac ?
11:46:53sealmoveZevv: you can force the user to always use `kind` as a name for the descriminator
11:47:15Zevvwell, currently I'm getting nowhere, so hold your horses :)
11:47:17sealmoveif detecting it is pita
11:47:27sealmoveok :D
11:47:30ZevvI keep bumping my head, blood all over the walls now
11:47:31lqdev[m]@Milerius first of all, remove the `destinations` variable and use `result`
11:48:17lqdev[m]also, you can use `sort` to sort in place instead of `sorted`
11:48:30sealmoveZevv: can you make a branch at least? so i can see what parts of the code base you touched?
11:48:32lqdev[m]https://nim-lang.org/docs/algorithm.html#sort%2CopenArray%5BT%5D
11:48:41*luis_ joined #nim
11:48:58Zevvthere is a breanch, it's called "bwhaah"
11:49:09sealmovehaha, ok great
11:49:15*luis_ quit (Remote host closed the connection)
11:50:18*luis_ joined #nim
11:50:35Zevvhttps://github.com/zevv/npeg/commit/b5c935bc2ec8d0e600192f82cef82b36b505ee3a
11:50:59*luis_ quit (Remote host closed the connection)
11:51:36*luis_ joined #nim
11:52:09*luis_ quit (Remote host closed the connection)
11:52:23FromDiscord<Milerius> what is result @lqdev ?
11:53:08*luis_ joined #nim
11:53:23FromDiscord<Milerius> according to the sort declaration, i cannot sort my custom type with it no?
11:54:09*nsf joined #nim
11:56:29sealmoveMilerius: i think you can
11:56:40FromDiscord<Milerius> i can i just do it !
11:56:47FromDiscord<Milerius> What is this result magic stuff ?
11:56:52FromDiscord<Milerius> it's funny
11:56:52lqdev[m]@Milerius result is an implicit variable that's returned at the end of the proc https://nim-lang.org/docs/manual.html#statements-and-expressions-return-statement
11:57:09FromDiscord<Milerius> 😮
11:57:09lqdev[m]it makes code a little cleaner, because you don't have to declare your own var
11:57:10FromDiscord<Milerius> thanks
11:57:16FromDiscord<Milerius> thanks a lot my friend
11:57:19FromDiscord<Milerius> i was not aware
11:57:31solitudesfhttps://nim-lang.org/docs/algorithm.html#sortedByIt.t,untyped,untyped
11:58:00*luis_ quit (Remote host closed the connection)
11:58:08FromDiscord<Milerius> there is a lambda/closure syntax in nim?
11:58:41FromDiscord<funcmike> lqdev[m]: thx for suggestions
11:59:14*luis_ joined #nim
12:00:03lqdev[m]@Milerius there's the `myProc() do (arg1: string, arg2: float) -> int: discard` notation
12:00:04sealmoveMilerius: there is anonymous proc
12:00:11lqdev[m]it's in the experimental manual
12:00:20lqdev[m]or as @sealmove suggested, anon proc
12:00:25FromDiscord<Milerius> ok thanks !
12:00:36lqdev[m]`myProc(proc (arg1: string, arg2: float): int = discard)`
12:00:41Zevvsealmove: I could greatly simplify things by restriting tokens to be numeric types only
12:00:48FromDiscord<Milerius> Nice
12:01:02Zevvthat would keep out alal these generics and allows me to just use int
12:01:18Zevvit would require more infrastructure provided by the user though
12:01:24sealmovehmm, so int instead of enum?
12:02:41sealmovewait...
12:02:56sealmovethis is what flex-bison does too
12:03:23sealmovetokens are just ints starting from a specific number (1000, 1001 etc)
12:07:23sealmoveyeah sure! the user can still define an enum but use it as int, that's fine
12:08:22FromDiscord<Milerius> i updated to https://gist.github.com/Milerius/28754e3ba5158ff82ac7cfcd8c7412ac @lqdev
12:08:25FromDiscord<Milerius> I hope it's better now
12:08:33*ikan-keli_ quit (Quit: ZNC 1.8.x-git-125-e415d9f5 - https://znc.in)
12:08:47*ikan-keli_ joined #nim
12:10:29sealmoveZevv: The infrastructure needed from the user is logical, I think generalizing it from seq[char] to seq[int] is already a great upgrade.
12:11:23sealmovenpeg won't provide a lexer -> parser api out of the box, but user will be able to build it, and we can make that api an external lib
12:12:42sealmoveso I am with you at this, should keep npeg code as clean as possible
12:18:41sealmovei think this is the correct direction to go, in the same spirit as nim, the lexer/parser api should be an external lib and not decided in npeg's core code.
12:20:31sealmoveso i was thinking this was almost already possible with seq[char], but you don't always have spair chars to use to represent tokens. just making it seq[int] solves the problem. i can write a seperate repo that implements an API externally.
12:20:49sealmovespare*
12:24:37ZevvWell, there is still the need to write readable parsers
12:24:54Zevvso the [Token] notation or similar would be handy still
12:25:32sealmoveat the start of your parser you will define the tokens
12:25:36*dmknght quit (Remote host closed the connection)
12:25:45sealmoveToken1 <- 1001
12:25:53sealmoveToken2 <- 1002
12:25:55sealmoveetc
12:26:04FromGitter<bung87> is there `asyncdispatch. addRead` example ?
12:26:24sealmoveor even better:
12:26:27Zevvalso a possibility, that would make things simpler because npeg does not need to know about any external types at all
12:26:32sealmoveToken1 <- myEnum.int
12:26:46sealmoveexactly
12:27:12Zevvand now for the output: what would a code block deliver, and how?
12:27:16Zevve.g. the captures
12:27:38sealmoveyeah, thinking about that
12:28:52*luis_ quit (Quit: luis_)
12:29:18sealmovewell, just like npeg currently provides string, it can provide seq[int] instead?
12:29:40sealmovei know, it doesn't seem useful, but will a helper library it can be
12:33:07Zevvsounds like the easiest to go
12:41:13sealmovenpeg should capture patterns anyway, not data
12:48:00Zevvtotally depends on waht you're using if for. It is pretty useful for me as it is already :)
12:49:37*krux02 joined #nim
12:50:35*krux02 quit (Remote host closed the connection)
12:51:15sealmoveZevv: https://play.nim-lang.org/#ix=257r
12:53:29Zevvthat makes sense. I don't like the requirement that I have to respecify all tokens in the grammar while they should be deducable from an enum instead
12:53:32ZevvDRY
12:57:29*Hideki joined #nim
12:57:52*Hideki is now known as Guest22245
12:59:05FromDiscord<mratsim> DRY is overrated
12:59:12solitudesfcan somebody explain me what's the difference between this c code http://ix.io/257u/c and this nim translation http://ix.io/257v/nim because i've fighting segfaults entire day
12:59:24FromDiscord<mratsim> DRYMTT is the future, don't repeat yourself more than twice 😉
13:01:48FromDiscord<mratsim> I don't see a difference, unless PDisplay is not a pointer
13:01:54*clyybber joined #nim
13:03:38clyybbersolitudesf: Where does the segfault occur?
13:03:42FromDiscord<mratsim> is that normal that I get a bunch of numbers though?
13:04:03lqdev[m]solitudesf: can you `nim c --debugger:gdb file`, `gdb ./file`, and `backtrace`?
13:04:07FromDiscord<mratsim> I don't get a segfault
13:04:22lqdev[m]s/`backtrace`/`run`; `backtrace`
13:04:40FromDiscord<mratsim> Hint: /home/beta/Programming/Nim/weave/build/disp [Exec]
13:04:40FromDiscord<mratsim> 0
13:04:40FromDiscord<mratsim> 0
13:04:40FromDiscord<mratsim> 0
13:04:41FromDiscord<mratsim> 4
13:04:41FromDiscord<mratsim> 4
13:04:41FromDiscord<mratsim> 0
13:04:42FromDiscord<mratsim> 2
13:04:44FromDiscord<mratsim> 4
13:04:45FromDiscord<mratsim> 2
13:04:46FromDiscord<mratsim> 0
13:04:47FromDiscord<mratsim> ...
13:05:36solitudesfyes, thats the minimal example, it doesnt segfault. but the output differs from c version and it shouldn't
13:08:04stefantalpalaruYou switched the order of those struct fields.
13:08:06*luis_ joined #nim
13:08:23clyybberyeah, but that shouldn't matter
13:08:46clyybberbut its the only thing I can spot either
13:09:02clyybberand maybe that the desc is `let` but that shouldn't matter either
13:12:10*Guest22245 quit (Remote host closed the connection)
13:12:55*Hideki joined #nim
13:13:18*Hideki is now known as Guest45353
13:13:55*luis_ quit (Remote host closed the connection)
13:14:14stefantalpalaruWhy the import exception? "import x11/xkb except X_kbGetMap"
13:15:35*luis_ joined #nim
13:16:17solitudesfbecause xkblib has XkbGetMap
13:17:14*Guest45353 quit (Ping timeout: 240 seconds)
13:17:48stefantalpalaruAnd why is keycode cast to an int16 when it's a regular int in C?
13:17:52*Hideki joined #nim
13:18:12solitudesfbecause that how procedure is declared in bindings
13:18:16*Hideki is now known as Guest5566
13:18:36stefantalpalaruThen you start debugging the bindings.
13:19:35solitudesfi commented version expanded from "macros", it doesnt convert anything, but is still incorrect.
13:23:42*luis_ quit (Remote host closed the connection)
13:24:51sealmoveZevv: I think it's nice because then your grammar includes everything, and you don't have the cognitive strain of looking for terminals in one place and non-terminals in other.
13:25:03*luis_ joined #nim
13:28:57sealmoveZevv: I have alternatives in mind, for example peg() macro can generate the enum, so you only have to specify it in your grammar, but i think it would make the code a bit more cryptic because as a user you would imagine the enum definition
13:29:17sealmovewould have to imagine*
13:30:12*luis_ quit (Ping timeout: 248 seconds)
13:33:37Zevvyeah, and ordering might be odd
13:36:19*luis_ joined #nim
13:37:44*luis_ quit (Remote host closed the connection)
13:42:20*luis_ joined #nim
13:43:45*luis_ quit (Client Quit)
13:44:04sealmovefwiw specifying tokens both outside and inside the grammar is what other tools (like bison) do
13:44:12*luis_ joined #nim
13:46:54*couven92 joined #nim
13:47:50*Vladar joined #nim
13:54:18*nsf quit (Quit: WeeChat 2.6)
13:54:57*luis_ quit (Remote host closed the connection)
14:00:46Zevvtrue. but for the captures: only getting the captures themselves is not what you want, you want indices to the subject there
14:01:10*NimBot joined #nim
14:03:24FromGitter<deech> How do I access flags passed to `nimble` in a `task`, eg. I'd like to do `task aTask, "A Task": let myFlag = options["myFlag"] ...`
14:04:13dom96no standard Nimble way to do this yet, but you can use `paramStr` IIRC
14:12:05sealmoveZevv: A capture can actually be just an index for subject; this suffices. The user just has to setup his lexer so that it outputs 2 seperates but parallel seqs, one for tokens and one for their values.
14:12:49sealmoveso a capture can be seq[int], where each int is an index
14:14:11sealmovein case you are parsing strings, the int represents a character directly, otherwise it represents an index from which you can get (token, value)
14:14:54sealmovecapture can be seq[int] for all cases ;)
14:14:56clyybberdeech: Do you know where to find a safe doubly-linked-list implementation in ATS?
14:15:45Zevvsealmove: right
14:16:19Zevvbut i'm not going to use 64 bit ints for chars :)
14:16:37sealmovechar|int then?
14:16:58sealmoveseq[char|int]
14:17:32FromGitter<deech> dom96 Great that worked. Do you see any issues with me relying on it for custom flags? There's always the risk that it'll stomp over something that's introduced in the future but other than that do you anticipate a problem?
14:18:07dom96deech: nope, should work fine for the foreseeable future.
14:19:32sealmoveor 2 peg() macros, one that accepts seq[char] and one that accepts seq[int]
14:20:07sealmoveone for lexing/(+parsing), one for parsing? ;)
14:20:40sealmoveI think seq[char|int] works though
14:21:26Zevvthat should do I think
14:25:22sealmovehmm, i think 2 seperate peg() macros are needed after all
14:26:04sealmovebecause otherwise current npeg interface would change
14:26:57ZevvI'll have to give it another try, the first three tries endedin the swamps
14:26:59sealmovebecause if there is 1 macro that accepts seq[char|int] you have no way of knowing if you should treat each element as char or as index to subject
14:28:12*PMunch joined #nim
14:28:52sealmovejust make a new peg macro that accepts seq[int] and uses `index` or `(token, index)` as captures
14:29:39sealmoveoh wait
14:29:42sealmovei have an idea
14:30:07sealmoveyou can just extend the current macro so that there is a way to reference the index
14:30:30sealmovefor example you can still do $1 to get the token, but can also do @1 to get the index
14:30:55sealmovethis will make a uniform api
14:33:22sealmovehow does this sound?
14:33:58FromGitter<bung87> ` owned(Socket)` means what ?
14:34:39sealmoveI think it's synonym with new(Socket) atm
14:36:21Zevvhm not bad sealmove. the only problem is that a capture would be a seq of indices
14:36:30Zevvjust as a string is a seq of chars
14:36:48sealmovethat's right
14:36:49Zevvbut i do like the offset id anyway, also usable for normal captures!
14:37:22Zevvi once reserved the @ there because $ has precedence issues
14:37:38sealmoveawesome!
14:38:01shashlickAny nimsuggest experts here?
14:38:08shashlickhttps://github.com/nimterop/nimterop/issues/144#issuecomment-568234296
14:38:09disbottoast results aren't cached with `nim check`
14:41:44FromGitter<bung87> @sealmove thanks!
14:43:23sealmovenp
14:44:42sealmoveZevv: I'll summarize the idea and write in the issue (#20) an example of how a lexer-parser will look like
14:44:43disbothttps://github.com/nim-lang/Nim/issues/20 -- 5GC leak
14:44:52sealmovenot this 20, npeg's :P
14:48:28sealmoveI think you will like it
14:48:29FromGitter<deech> @Clyybber https://github.com/githwxi/ATS-Postiats/blob/master/libats/SATS/dllist.sats
14:49:22FromGitter<deech> @Clyybber Those are the type sigs., the implementation is https://github.com/githwxi/ATS-Postiats/blob/master/libats/DATS/dllist.dats.
14:50:39FromGitter<deech> clyybber, For you ^^^, used your Gitter handle by mistake.
14:53:18clyybberthank you!
15:01:03*luis_ joined #nim
15:04:16*ng0_ joined #nim
15:06:43*ng0 quit (Disconnected by services)
15:07:15*ng0_ quit (Client Quit)
15:07:16*luis_ quit (Ping timeout: 248 seconds)
15:07:31*ng0 joined #nim
15:07:31*ng0 quit (Changing host)
15:07:31*ng0 joined #nim
15:19:56ZevvHow is Golden doing then?
15:21:56disruptekuh, good?
15:28:05Zevvand your ex-wife?
15:28:30Zevvsealmove: baaah Error: A nested proc can have generic parameters only when it is used as an operand to another routine and the types of the generic paramers can be inferred from the expected signature.
15:29:22disruptekthe ex-wife is pissed.
15:29:44clyybberyou flushed the parts?
15:29:56sealmoveZevv: eh, this is inconvenient. hold on, I am making a proof of concept demo.
15:29:59clyybbers/parts/limbs
15:30:09disrupteki did my best.
15:30:29dom960_o
15:30:33ZevvI like how "pissed" in english can be "angry as hell" or "drunk enough to make a fool of oneself"
15:41:24*dddddd joined #nim
15:43:12FromGitter<bung87> `socket.acceptAddr().addCallback proc (f:Future[tuple[address: string, client:asyncnet.AsyncSocket]]) =` what’s wrong with this?
15:50:13Zevv2/c
15:54:54*PMunch quit (Quit: leaving)
15:55:27FromGitter<bung87> `2/c` means what?
15:58:57sealmoveZevv: https://github.com/zevv/npeg/issues/20#issuecomment-568275146
15:58:58disbotFeature request: Parse from seq[Token]
16:01:50Zevvyeah that about sums it up. It's not very friendly but its flexible
16:01:57Zevvlet me see if I can get there somehow
16:03:54FromDiscord<exelotl> uhh I'm getting an error with varargs[untyped] when passing zero arguments
16:03:58FromDiscord<exelotl> https://play.nim-lang.org/#ix=258a
16:04:33FromDiscord<exelotl> (if you comment out line 9 it works fine)
16:05:26*luis_ joined #nim
16:05:30FromDiscord<exelotl> should I file an issue?
16:05:32FromDiscord<Xydium> I've narrowed down the possible problems with the macro I'm writing
16:05:41FromDiscord<Xydium> Somewhere a copy is being made that should not be made
16:05:56FromDiscord<Xydium> Either in parameter passing, creating a sequence, or removing from the sequence
16:06:30FromDiscord<Xydium> But none of those make sense, because NimNode is a ref object
16:07:23sealmovethe only issue I can see is that this approach requires global vars
16:07:36sealmovepersonally I don't mind that though
16:10:04ZevvWe'll see. I just ended up refactoring the codegen and I finally got rid of one of the nasty things I never knew how to fix. Not at all working on your feature anymore, but this might help
16:12:40sealmovesure, I am still playing around with the proof of concept example
16:13:12sealmoveshould only start implementing once we have a solid example of what we want the feature to look like
16:25:56*nsf joined #nim
16:27:32*Vladar quit (Quit: Leaving)
16:27:33yumaikaso/
16:28:34madpropsis nimble intended to work as a binary package manager too?
16:28:57dom96yep
16:32:58*luis_ quit (Quit: luis_)
16:33:02yumaikasdom96 how goes it?
16:34:22FromDiscord<Xydium> Is there a way to check whether two objects are the same object?
16:35:30sealmoveok, my example makes much more sense now: https://github.com/zevv/npeg/issues/20#issuecomment-568275146
16:35:30disbotFeature request: Parse from seq[Token]
16:36:36sealmovethe approach is as follows:
16:36:43sealmove- you define 2 globals seqs
16:36:43yumaikasXydium: I think you could use addr to compare addresses?
16:36:47FromGitter<deech> A number of functions listed in the `os` module are not available in NimScript but per the docs they should be: https://nim-lang.org/docs/nims.html
16:36:52sealmove- one has enums and it's just for helping peg() macro do the matches
16:36:59FromGitter<deech> `getCurrentDir()` is an example.
16:37:06sealmove- the other has actual Nodes
16:37:22sealmovethen you call the lexer which fills in both seqs
16:38:23sealmovefinally you call the parser which uses seq[myEnum] to do the matching and seq[Node] is used by the user in peg block, since he has the index with @1
16:38:31sealmovethe index works for both seqs
16:39:07FromDiscord<Xydium> Expression has no addr is the result
16:39:20sealmoveobviously the lexer will spil out a seq[Node] where all Nodes are terminals
16:39:32yumaikasXydium: I'm going to need more context then
16:39:38sealmoveor rather fill in* (not spil out)
16:40:07FromDiscord<Xydium> Now I'm attempting to make all of the `NimNode`s into `ref NimNode`s but I need to get a reference to a value in a sequence in another node
16:40:40*Guest5566 quit (Remote host closed the connection)
16:40:50yumaikasXydium: Why are you trying to find out if two Nim nodes are the same nim node?
16:40:59ZevvHmm anyone here with macro brains? I use genSym() to generate unique id's, but I can't use these when they happened to get used as proc param: "cannot use symbol of kind 'var' as a 'param'". When I generate the id myself with ident() there's no problem there
16:41:12*Hideki joined #nim
16:41:48*Hideki is now known as Guest69046
16:42:10*yumaikas doesn't have macro brains atm, has mostly been satisfied with templates
16:42:22*Romanson quit (Quit: Connection closed for inactivity)
16:43:02FromDiscord<Xydium> Because node trees are being passed by value **somewhere** and I need to figure out where/why
16:43:19sealmovegenSym: "Generates a fresh symbol that is guaranteed to be unique. The symbol needs to occur in a declaration context."
16:43:22FromDiscord<Xydium> I want to be able to modify the AST with a simple `parent[i] = newNode(...`
16:43:54FromDiscord<Xydium> But since the parent is always the wrong copy, it's impossible
16:44:09FromDiscord<Xydium> I posted a link to the code last night, I'll resend
16:44:47FromDiscord<Xydium> https://play.nim-lang.org/#ix=2566
16:44:49sealmovehmm ident(mySym) doesn't work?
16:44:53Zevvsealmove: yeah I know. it seems that genSym() attaches more info to the generated node, which I actually do not want there. But I now just do ident() and add some random digits - good enough for now
16:44:59FromDiscord<Xydium> The functions in question are parseVars and constrain
16:46:15FromDiscord<Xydium> Inside the macro: `var r = new(ref NimNode)` gets a Cannot parse VM Code error
16:47:03*Guest69046 quit (Ping timeout: 260 seconds)
16:47:53yumaikaswouldn't that be var r = newRef[NimNode]() ?
16:48:08yumaikasActually, probably not
16:49:33FromDiscord<Xydium> doesn't exist afaik
16:49:49sealmoveZevv: ident(genSym().repr)
16:51:47FromDiscord<Xydium> Yeah I can't use ref NimNode at all on the VM
16:51:55FromDiscord<Xydium> But I shouldn't need it, since NimNode is a ref object
16:52:19Zevvsealmove: Baaah! :)
16:52:20FromDiscord<Xydium> But somehow every single collection type in this language deep-copies NimNodes
16:54:05sealmovedunno, genSym() is weird: https://play.nim-lang.org/#ix=258w
16:54:19yumaikasXydium: I think that's on purpose?
16:54:30yumaikasAraq or dom96 would have a better idea tho
16:55:35FromDiscord<Xydium> Well it shouldn't be the case, it prevents doing quick tree substitutions with an iterative traversal
16:56:10FromDiscord<Xydium> I guess I could do recursion in a single scope by using a nested proc
16:56:33FromDiscord<Xydium> Since each statement needs one vartable at all levels of the tree, and passing that around is annoying
16:57:02FromDiscord<Xydium> But if I have a nested proc with no return type, can it access the result variable of its host?
16:57:10sealmovegenSym() must be used at CT but its results can only be used at RT
16:57:34FromGitter<mratsim> Just store your NimNode in another NimNode
16:57:46FromDiscord<Xydium> I've tried that
16:57:48FromGitter<mratsim> NimNode shallow copies as they are ref
16:58:41FromGitter<mratsim> One thing is that var NimNode don't properly update if you are passing a result
16:58:42FromDiscord<Xydium> constrain macro receives stmtlist, passes each statement to the parseVars proc, which should reference the original AST input
16:58:52FromGitter<mratsim> Create an intermediate var
16:58:57FromDiscord<Xydium> I've tried that
16:59:14FromDiscord<Xydium> I had parseVars make a deep copy of its input statement
16:59:18FromDiscord<Xydium> Then edit the copy
16:59:20FromDiscord<Xydium> Then return the copy
16:59:28FromDiscord<Xydium> And add that to a new statement list returned by the macro
16:59:41FromDiscord<Xydium> But because that copy still puts nodes through the queue,
17:00:00FromDiscord<Xydium> Somehow they get copied, and the edits don't apply to what I return
17:00:45*Hideki joined #nim
17:01:08*Hideki is now known as Guest20674
17:02:11sealmoveeeeh this is so confusing, I don't know how genSym() works at all
17:04:22*endragor quit (Remote host closed the connection)
17:05:05*_seerix joined #nim
17:05:16*Guest20674 quit (Ping timeout: 258 seconds)
17:07:47*seerix_ quit (Ping timeout: 260 seconds)
17:08:58*letto quit (Ping timeout: 265 seconds)
17:11:27*natrys joined #nim
17:13:28*letto joined #nim
17:18:08*couven92 quit (Read error: Connection reset by peer)
17:18:27*couven92 joined #nim
17:21:08*couven92 quit (Read error: Connection reset by peer)
17:21:28*couven92 joined #nim
17:21:57FromGitter<mratsim> @xydium is it related to this? https://github.com/nim-lang/Nim/issues/11637
17:21:58disbot{.compileTime.} var ref are not updated properly for implicit result
17:22:36FromGitter<mratsim> If you have a pastebin I can have a look (but probably tomorrow)
17:24:57*luis_ joined #nim
17:26:51*lqdev[m] uploaded an image: image.png (2KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/SQiXMRzpIafyEIEiqRiHSfPb >
17:27:06lqdev[m]nice to see nimsuggest stuck in a `while true` loop again.
17:27:12lqdev[m]this time, it's 3 instances, not 1.
17:29:32*luis_ quit (Client Quit)
17:29:43*Cthalupa quit (Ping timeout: 252 seconds)
17:30:00*luis_ joined #nim
17:30:39clyybber`if dumbInput: while true: discard`
17:32:25*Cthalupa joined #nim
17:32:41disruptek3 instances is 3 times the fun.
17:33:01disruptekwhere are my nimph bugs?
17:33:37*_seerix quit (Quit: Leaving)
17:34:08*seerix joined #nim
17:35:54*Hideki joined #nim
17:36:18*Hideki is now known as Guest81552
17:38:11*endragor joined #nim
17:42:53*endragor quit (Ping timeout: 268 seconds)
17:43:36lqdev[m]3 times the fun, 3 times the `free(): invalid size` `fish: “nvim mods/moddef.nim” terminated by signal SIGABRT (Abort)`
17:44:27lqdev[m]one `pkill nimsuggest` later, CPU usage's back to normal
17:44:42disruptekwell, it was fun while it lasted.
17:45:53FromGitter<deech> Is there a standard library function for strictifying an iterator into a `seq`, something that captures the `var res = @[]; for x in ... : res.add(x)`?
17:46:39disrupteksounds like you want the new collect macro.
17:47:12clyybberdeech: toSeq
17:47:35clyybberI think
17:48:01disrupteki think he wants to mess with x and not just add it.
17:49:27FromGitter<deech> clyybber, thanks just what I needed! Should have looked there first. :)
17:49:38FromDiscord<Xydium> @mratsim I figured it might be a bug like that, let me try not using the implicit result
17:50:56FromDiscord<Xydium> And nope, still the same problem
17:51:31*Guest81552 quit (Ping timeout: 268 seconds)
17:52:35FromDiscord<Xydium> Seems like the VM is pretty broken, I'll just suffer the recursive rewrite instead
17:53:11FromDiscord<Xydium> Then again, if the recursion is using the same `parent[i] = newNode(...` stuff, even that won't work
17:53:34FromDiscord<Xydium> Unless the copies are being created by the queue
17:54:10FromDiscord<Xydium> In fact, it must be the queue creating copies
17:55:07FromDiscord<Xydium> https://pastebin.com/eGhig2rr
17:55:41FromDiscord<Xydium> 1. parseVars proc gets each statement's AST from constrain macro
17:55:57FromDiscord<Xydium> 2. parseVars deep-copies the received statement and stores it in a heapqueue
17:56:22FromDiscord<Xydium> 3. Deep-copied Nodes from the tree are popped from the queue
17:56:42FromDiscord<Xydium> 4. Children are set on the popped node, this is confirmed working, as the treeRepr of current changes
17:57:04FromDiscord<Xydium> 5. These changes are not reflected back on the tree from which all nodes in the queue should be from
17:58:52FromDiscord<Xydium> And the VM forbids making the queue `HeapQueue[ref NimNode]`
17:59:19FromDiscord<Xydium> It makes sense that this is as broken as using a seq, since it uses a seq internally
17:59:37FromDiscord<Xydium> Is there a single collection in this language that doesn't make erroneous copies
18:00:01lqdev[m]ha, `nim.nvim: unable to connect to nimsuggest`. @leorize
18:00:27lqdev[m]seems like nimsuggest is stuck in a while loop again, eating up 100% of a CPU thread
18:05:13disruptektuples don't make erroneous copies.
18:05:45FromDiscord<Xydium> any **variable sized** collection
18:06:11disruptekif there is, we can patch it. 😁
18:06:18FromDiscord<Xydium> unless you mean I need `HeapQueue[tuple[whatMatters: NimNode, whatDoesnt: Lmao]]`
18:07:56disruptekgive me bugs or give me death.
18:10:50FromDiscord<Xydium> tuples still make useless copies
18:17:54FromDiscord<slymilano> In the nim forums, what does "Thread is moderated" mean? Only my thread has that: https://forum.nim-lang.org/t/5725
18:18:06FromDiscord<Xydium> is there some where to iterate the nodepaths of the tree and access the original tree directly?
18:22:05disruptekhttp://ix.io/259b/nim
18:28:17FromDiscord<niv> hi. im trying to read the outputhandle of a Process (osproc) async. i tried asyncfile, but that would block on readLine() despite promising otherwise. i tried the threadpool workaround mentioned here: https://github.com/nim-lang/Nim/issues/11564 but that would eventually error out with "too many open files". whats the canonical/best way to wrap a existing FD into async so i can await on input from it?
18:28:49disruptekniv: golden does this quite simply.
18:28:57disruptek!repo golden
18:28:58disbothttps://github.com/disruptek/golden -- 9golden: 11a benchmark for compile-time and/or runtime Nim 15 13⭐ 0🍴
18:29:28disrupteksee the invocation file, iirc.
18:29:45FromDiscord<niv> i'll take a look, thanks
18:30:07disruptekthe open files issue is probably due to this issue:
18:30:25disruptek!issue author:disruptek signal
18:30:26disbothttps://github.com/nim-lang/Nim/issues/12354 -- 3selectors API encourages signal file descriptor leak
18:30:54disrupteki think the golden code is pretty well commented to explain the solution.
18:31:23FromDiscord<niv> erghh. ok, thanks. i'll give it a good read.
18:31:51luis_Hi all, I am trying to add a nim kernel to rmarkdown... I have a very simple question, how do I pass a string to the nim compiler and get the command output from such string in the stdout?
18:31:57luis_Is there a way?
18:32:00FromDiscord<niv> oh, i didnt even know about the selectors module!
18:32:14disruptekhave fun. 😀
18:32:22FromDiscord<niv> i certainly will, ty
18:32:36FromDiscord<niv> though it would be nicer if nim would take care of all this yak shaving .. ;)
18:33:12luis_Something like nim c -r "echo 'cool'" does not work
18:33:26disruptekluis: save it to a file first.
18:34:15FromDiscord<Xydium> @disruptek NimNodes have no high/low definition
18:34:32FromDiscord<Xydium> If I replace high with len-1 and low with 0, it does not halt
18:35:04disruptekthat makes me sad.
18:35:08disruptekis it a bug in the walker?
18:35:13FromDiscord<Xydium> no clue
18:35:26FromDiscord<Xydium> I'll have to figure out how the walker works
18:35:36luis_Thanks. I understand this, but was hoping I could pass a string...
18:35:55disruptekit's pretty simple. just something i wrote to help stefan in an issue.
18:36:21FromDiscord<Xydium> my guess is that `while path.len > 0: if path.didAscend: continue` does not halt because,
18:36:39FromDiscord<Xydium> `path[path.high].index < 0` is never true
18:37:03FromDiscord<Xydium> and since it's never true, the path is never shortened
18:37:23FromDiscord<Xydium> So what is `path[path.high].node.low` supposed to mean?
18:37:46disruptekthe last node's first child.
18:37:53FromDiscord<Xydium> That's what I thought
18:38:05FromDiscord<Xydium> should it be greater?
18:38:12FromDiscord<Xydium> greater-than*
18:38:26disrupteki dunno, i wrote this code months ago. i don't even know if i ran it outside of the playground.
18:39:01disrupteki think you should fix it for us and post it in the forum thread about walking trees. pretty active right now.
18:39:41FromDiscord<Xydium> Sounds good, just hope it actually uses references correctly when I get it working lol
18:39:54FromDiscord<Xydium> Link to the post?
18:40:04FromDiscord<Xydium> Also does the predicate matter at all?
18:40:06disrupteki mean, i'm sure it compiles... it's not designed for write-while-read, though.
18:40:10disruptekpredicate doesn't matter.
18:40:23disruptekhttps://forum.nim-lang.org/t/5697
18:40:43FromDiscord<Xydium> oh that could be the problem, write-while-read
18:41:09FromDiscord<Xydium> Well, the thing is, the tree will only ever have terminals replaced with terminals or longer branches
18:41:17FromDiscord<Xydium> the longer branches should never be walked
18:41:31disruptekthen you should be fine. long as the indices aren't changing, obviously.
18:41:41disruptekjust make stuff mutable.
18:41:51disruptekand beware of this:
18:42:01disruptek!issue mutable iterator
18:42:02disbothttps://github.com/nim-lang/Nim/issues/12945 -- 3mutable iterator cannot yield named tuples 7& 4 more...
18:42:04FromDiscord<Milerius> What do you use when you need to share a table between thread ?
18:42:16disruptekthere's a sharedtables impl.
18:42:35FromDiscord<Milerius> yeah but Andres tell me it's unstable
18:42:43disruptekwell, you can use channels.
18:42:53disruptekthey aren't brilliant, but they are the best we have atm.
18:43:02shashlick!repo shared
18:43:03disbothttps://github.com/genotrance/shared -- 9shared: 11Nim library for shared types 15 3⭐ 0🍴 7& 12 more...
18:43:38shashlickOr maybe just use boehm
18:44:01*sealmove quit (Quit: WeeChat 2.6)
18:44:02FromDiscord<Milerius> i use bohem already yeah
18:44:08FromDiscord<Milerius> But let's say i'm using Tables
18:44:18FromDiscord<Milerius> I absolutely need to read/write from different thread into this table
18:44:28FromDiscord<Milerius> and it's should be non blocking
18:46:22FromDiscord<Milerius> (In fact i want to share a JsonNode between threads)
18:46:39FromDiscord<Milerius> This JsonNode represents my json configuration and threads/main thread need it
18:47:09luis_disruptek: solved that, now how do I hide all hint output from the nim compiler?
18:47:26disruptekyou can toggle hints in your nim.cfg or via the command-line.
18:48:02disruptekeg. in nim.cfg: hint[Processing]=off
18:48:03luis_do you recall the tag for this?
18:48:09luis_oh, thanks
18:49:04luis_for the command line, do you recall the flag?
18:49:33disruptekno, but `nim --fullhelp` should mention it.
18:49:39shashlickBoehm should handle multiple threads
18:49:48luis_--hints:on|off|list
18:49:51luis_thanks
18:49:52disruptekhints are defined in compiler/lineinfos.nim
18:51:59FromDiscord<Xydium> `Error: unhandled exception: 'sym' is not accessible using discriminant 'kind' of type 'TNode' [FieldError]`
18:52:10FromDiscord<Xydium> this is new
18:53:02FromDiscord<Xydium> I think I got the walker working now
18:53:14FromDiscord<Xydium> Ascent should happen when a node's index is zero
18:53:33FromDiscord<Xydium> The ascent loop should break when no ascent occurs
18:55:53luis_I am almost there, how do I take the first lines with the path of the code run from the output? https://i.imgur.com/jpTs6sv.png
18:56:56FromDiscord<Xydium> I need a predicate that skips any nodes added by the macro
18:58:04disruptekluis: probably some output is on stderr and some on stdout.
18:58:41disrupteki want a pragma that warns when there's a case statement with an else.
18:59:19luis_oh, ok, will try to hide stderr... but the package is ready... will announce here when I upload to github... we can now include nim code to rmarkdown files
19:02:01disruptekneat.
19:20:36*nsf quit (Quit: WeeChat 2.6)
19:31:05FromDiscord<Xydium> @disruptek The traversal almost works, aside from skipping the first child of the root
19:31:14FromDiscord<Xydium> But, it still doesn't allow me to return the modified tree
19:31:39disruptekdetails...
19:34:51FromDiscord<Xydium> I'm changing things to var T but it still doesn't help
19:38:36*silvernode joined #nim
19:43:29FromDiscord<Milerius> Is it possible if i have an `OrderedTable` that i want to share between threads, to return only a copy of This table since most of my Threads just need to read into this table ?
19:43:44disrupteksure.
19:44:03FromDiscord<Milerius> How can i specify that ?
19:44:21disrupteklet tableB = tableA
19:44:55*silvernode quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
19:46:43FromDiscord<Milerius> It's a copy or a reference in this case ?
19:47:11disruptekit's a copy if tableA is OrderedTable.
19:47:27FromDiscord<Milerius> Hmmm
19:50:40FromDiscord<slymilano> Hey guys, why does my user and my thread both say "Moderated" on the forums? https://forum.nim-lang.org/profile/sergio
19:52:27FromGitter<Willyboar> @narimiran ^^^
19:58:40*actuallybatman joined #nim
20:05:09*natrys quit (Quit: natrys)
20:16:39FromDiscord<Xydium> @disruptek I rewrote it recursively, and it ended up being far less annoying
20:16:56ZevvProbably another stupid question, but is there a way for nim to resolve an Enum value at macro time? So I have an identifier matching a valid enum member, and I want to get its value as intval.
20:17:20disruptekZevv: not a stupid question, it comes up every few months.
20:17:40Zevvsoooo - where is the FAQ?!
20:17:47disruptekactually, i think you asked it last time, didn't you?
20:17:56Zevvdang, did I?
20:17:59ZevvI'm not *that* old
20:18:04*Zevv greps
20:18:38Zevvwas 7/24 the last time?
20:18:43disruptekcould be.
20:18:52disruptekyou were younger, then.
20:19:03ZevvI asked - but noone answered
20:19:27Zevvworthless support on this channel, like always
20:20:07Zevvwell, nice job for sealmove to figure that out then
20:20:24disrupteklike always.
20:20:28disruptekat least we're consistent.
20:21:09Zevvhe requested the feature, he does the nasty parts
20:22:38disruptekfwiw, i think it's the same issue with booleans. so, maybe that'll help him find the solution.
20:23:54Zevvit's actaully simple: http://ix.io/259V
20:23:56FromDiscord<Xydium> Okay so now I need proc(x: varargs[T]): bool = `tree`, to correctly access the x param of the lambda
20:24:06Zevvbut it breaks somewhere in my chain of events, because `intval` is no longer there when I need it
20:24:10FromDiscord<Xydium> But the lambda param is some weird gensymNumbers
20:24:32Zevv" Error: node lacks field: intVal
20:24:33Zevv"
20:25:42disruptekyou must be playing, "hide the banana" over there.
20:26:23Zevvnot today, not today
20:27:33Zevvah, there it is: my NimNode is untyped
20:27:37Zevvthere it gets lost in translation
20:27:42Zevvsigh
20:28:03FromDiscord<Xydium> https://pastebin.com/3Vks8NT7
20:28:20FromDiscord<Xydium> This is the last thing I need to get working, but I havent the slightest idea how symbols work
20:28:51disruptekyou just bang them together and they make a big crashing, smashing noise.
20:29:09FromDiscord<Xydium> https://pastebin.com/e9xDMcWJ
20:29:20FromDiscord<Xydium> `Error: undeclared identifier: 'x'`
20:29:47FromDiscord<Xydium> Ident "x`gensym280440"
20:29:56FromDiscord<Xydium> That's what the lambda parameter becomes
20:30:09FromDiscord<Xydium> How do I link that to the x in the constraint subtree
20:31:11disrupteklet xarg = ident"x" .... proc(`xarg`: ...)
20:32:26FromDiscord<Xydium> causes a type mismatch, it can't figure out the type of x
20:37:17FromDiscord<Xydium> `Error: type mismatch: got <T, T>` on `x[1] * x[1]`
20:42:54muffindrakeStropping lets you use identifiers with spaces? Neat.
20:45:32disruptekthanks, i hate it.
20:46:02FromDiscord<Generic> is this code supposed to work with newruntime? https://play.nim-lang.org/#ix=25a1
20:46:23FromDiscord<Generic> because in this case a reference outlives the owned object
20:48:18*endragor joined #nim
20:49:51FromDiscord<mratsim> don't use generic macros @Xydium
20:50:00*natrys joined #nim
20:50:27FromDiscord<mratsim> it's not tested, and you don't need them
20:51:19FromDiscord<Xydium> Alright so how do I ignore the generics then
20:51:29FromDiscord<Xydium> Since it operates on a Problem[T]
20:51:58FromDiscord<Xydium> The lambdas given to the problem take varargs[T]
20:54:03*endragor quit (Ping timeout: 268 seconds)
20:54:11FromDiscord<mratsim> I use this to get the generic out of the a Tensor[T] type: https://github.com/mratsim/Arraymancer/blob/master/src/private/ast_utils.nim#L42-L44
20:54:39FromDiscord<mratsim> oh, it seems like i do have one generic macro
20:54:40FromDiscord<mratsim> https://github.com/mratsim/Arraymancer/blob/master/src/tensor/accessors_macros_read.nim#L20
20:54:54FromDiscord<mratsim> well, somehow it might work in corner cases then
20:55:37FromDiscord<Xydium> The issue I'm having is, once I replace the identifier in the lambda to not have the `gensymXXXXXX` thing, it complains about the types
20:56:55*eys joined #nim
20:56:57*eys left #nim (#nim)
20:56:58FromDiscord<mratsim> if you replace one node nnkSym by a fresh nnkIdent, you need to replace all the nnkSym with the same identifier by a fresh nnkIdent
20:57:12FromDiscord<mratsim> because nnkSym are already resolved and bound to something
20:57:21FromDiscord<mratsim> and with your replacement you deleted that something
20:58:37FromDiscord<Xydium> It's an identifier node though
20:58:44FromDiscord<Xydium> https://pastebin.com/e9xDMcWJ
20:59:14FromDiscord<Xydium> `IdentDefs >> Ident "x'gensym280440"`
20:59:34FromDiscord<Xydium> And I just replace the ident with Ident"X"
20:59:49FromDiscord<mratsim> that's strange that it has been gensymed then
21:00:00FromDiscord<mratsim> can you pass an untyped instead of a typed parameter
21:00:12FromDiscord<mratsim> that avoids the OpenSyymChoice and the creation of symbols
21:00:35FromDiscord<Xydium> `Untyped is only allowed in macros`
21:00:41FromDiscord<mratsim> if you have your code in your repo or something I can have a look at it
21:01:18FromDiscord<Xydium> `quote do: addConstraint('problem', proc(x: untyped): bool = 'tree', 'vars')`
21:02:11FromDiscord<Xydium> I have it in a paste from earlier
21:02:16FromDiscord<mratsim> before the quote do, do `let x = ident"x"`
21:02:16FromDiscord<mratsim> And then
21:02:16FromDiscord<mratsim> ```
21:02:17FromDiscord<mratsim> quote do: addConstraint('problem', proc(`x`: untyped): bool = 'tree', 'vars')
21:02:17FromDiscord<mratsim> ```
21:02:49FromDiscord<Xydium> https://pastebin.com/3Vks8NT7
21:02:51FromDiscord<Xydium> That's the old paste
21:03:01FromDiscord<Xydium> The ident"x" doesn't work either
21:03:20FromDiscord<Xydium> Still `Untyped is only allowed in templates and macros`
21:03:32FromDiscord<Xydium> Quote do is trying to output runtime nim code using untyped
21:03:32FromDiscord<mratsim> strange
21:03:46FromDiscord<mratsim> do you have the rest, problem[T] and parseVars?
21:04:00FromDiscord<mratsim> and addCOnstraint
21:04:28*nsf joined #nim
21:04:36FromDiscord<Xydium> https://pastebin.com/Gge6Nj9x
21:05:46FromDiscord<mratsim> looking, give me a couple of min (hopefully
21:07:24FromDiscord<mratsim> ittree is useful?
21:07:41FromDiscord<Xydium> I'm not using ittree anymore
21:08:08FromDiscord<Xydium> I replaced it with recursion that rebuilds the tree node by node, making substitutions where appropriate
21:08:22FromDiscord<Xydium> ~~because something thinks everything should be passed by value~~
21:08:32FromDiscord<Xydium> ~~because someone thinks everything should be passed by value~~
21:08:38FromDiscord<mratsim> oh but you are creating an untyped proc with your macro
21:08:41FromDiscord<mratsim> you can't
21:08:43FromDiscord<Xydium> Yeah
21:08:54FromDiscord<Xydium> That was one of your suggestions
21:09:04FromDiscord<mratsim> untyped macro, not proc
21:09:04FromDiscord<Xydium> It needs to be varargs[T]
21:09:07FromDiscord<mratsim> ok
21:09:15FromDiscord<Xydium> but,
21:09:29FromDiscord<Xydium> If it's varargs[T], then it does not get the correct type info for operators within the parsed tree
21:09:49FromDiscord<Xydium> the constraint `Y == X * X` tries to do `x[1] * x[1]` but still thinks x is type T
21:10:54Zevvsealmove: success: NPeg can now do two stage lexing and parsing! Thanks for helping out!
21:11:45disrupteknice job, zevv!
21:12:46FromDiscord<Xydium> Even using the getSubType thing to put the generic parameter into the varargs[] doesn't work for some reason
21:13:19FromDiscord<Xydium> wait... does my bracketexpression node need to encode the type of the array?
21:13:52FromDiscord<Xydium> https://nim-lang.org/docs/macros.html#callsslashexpressions-array-access-operator
21:14:00FromDiscord<mratsim> here you go: https://gist.github.com/mratsim/72d60d9376793a69bfe33aac95aa8e71
21:14:43FromDiscord<Xydium> thats all it needed? two extra ``? lmao
21:14:46FromDiscord<mratsim> the constcall x assign can reuse the x you already defined
21:14:55FromDiscord<Xydium> That assign is redundant
21:14:59FromDiscord<mratsim> I removed the generic macro as well
21:15:46FromDiscord<Xydium> oh I see that now
21:15:57FromDiscord<Xydium> and got the type info
21:16:00FromDiscord<mratsim> because I get T instead of the actual instantiation with the generic macro
21:16:47FromDiscord<mratsim> not too sure what a CSP solver is but it looks interesting
21:16:53FromDiscord<Xydium> thanks for the help, probably would've taken weeks for me to find the solution
21:17:07FromDiscord<mratsim> no problem
21:17:16FromDiscord<Xydium> CSPs are problems where the solution is expressed as a set of variables with values from domains
21:17:29FromDiscord<Xydium> A really complicated exam is circuit board trace layouts
21:17:33FromDiscord<Xydium> example*
21:17:42FromDiscord<mratsim> I did start an ILP solver here but never finished, it was for polyhedral loop optimization but in the end I will take another approach: https://github.com/mratsim/hydra/tree/master/hydra/ilp
21:18:23FromDiscord<Xydium> One of the classic examples of CSPs is setting colors of regions on (geographical) maps where no adjacent regions may have the same color
21:18:29FromDiscord<mratsim> the constraint are expressed like this: https://github.com/mratsim/hydra/blob/master/tests/test_sets.nim#L31
21:18:34FromDiscord<mratsim> I see
21:19:22FromDiscord<Xydium> Scheduling is another form of constraint satisfaction
21:20:19FromDiscord<Xydium> It differs from typical state-space search because a) the sequence of actions (variable assigns) does not matter and b) the path to the solution does not matter
21:22:44ZevvI will now take up disrupteks habit of naming my releases.
21:24:03disrupteki'm sorry my names for your releases are mostly 4-letter words. 🙁
21:29:05*nsf quit (Quit: WeeChat 2.6)
21:44:49*clyybber quit (Quit: WeeChat 2.7)
21:46:12*luis_ quit (Ping timeout: 248 seconds)
21:47:41Zevvoh who was is then
21:48:17*Hideki joined #nim
21:48:40*Hideki is now known as Guest43218
21:52:43*Guest43218 quit (Ping timeout: 260 seconds)
21:59:22disrupteki bestow emojis on releases named after members of the community. 😁
22:01:33disruptekmaybe the bot should show a release/date for repos/packages it finds.
22:04:54*luis_ joined #nim
22:05:49luis_Hi all, I would really like if someone with some R experience could test the nim rmarkdown engine for linux here: https://github.com/lf-araujo/nimrmarkdown
22:07:59*luis__ joined #nim
22:08:35*azed joined #nim
22:10:12*luis_ quit (Ping timeout: 248 seconds)
22:12:43disruptek!package diff
22:12:44disbothttps://git.sr.ht/~reesmichael1/nim-simplediff -- 9simplediff: 11A library for straightforward diff calculation
22:13:20disruptek!package diff
22:13:21disbothttps://github.com/mark-summerfield/diff -- 9diff: 11Library for finding the differences between two sequences
22:29:01*clyybber joined #nim
22:33:40*EvergreenTree joined #nim
22:45:09*natrys quit (Quit: natrys)
22:54:07*adeohluwa joined #nim
22:54:49*gour_ joined #nim
22:54:51*luis__ quit (Remote host closed the connection)
22:54:57*gour_ quit (Remote host closed the connection)
22:55:38*solitudesf quit (Ping timeout: 258 seconds)
22:55:55*adeohluwa quit (Remote host closed the connection)
22:58:37*gour quit (Ping timeout: 268 seconds)
23:04:29FromGitter<bung87> @alehander92 I notice you have create new repo for transpiling other language projects to nim
23:59:15FromDiscord<mratsim> @Clyybber, here you go on the state machine approach: https://github.com/mratsim/weave/pull/63/files
23:59:15FromDiscord<mratsim>
23:59:16FromDiscord<mratsim> No perf difference. I'm slightly unhappy about the fact that it doubled my number of lines here, will closely monitor as the codebase is transitioned.
23:59:16disbot[WIP] Refactor workers into state machines