<< 23-10-2018 >>

00:16:22*PrimHelios joined #nim
00:34:13*PrimHelios quit (Quit: Leaving)
00:35:00*zachk quit (Quit: Leaving)
00:58:47*abm quit (Ping timeout: 240 seconds)
01:16:46*endragor joined #nim
01:19:22*vivus quit (Remote host closed the connection)
01:21:06*endragor quit (Ping timeout: 252 seconds)
02:03:43*stefanos82 joined #nim
02:05:00*banc quit (Quit: ZNC - http://znc.in)
02:09:09*ftsf joined #nim
02:20:40*banc joined #nim
02:21:22*endragor joined #nim
02:26:59*ftsf quit (Remote host closed the connection)
02:27:19*ftsf joined #nim
02:31:13*darithorn joined #nim
03:00:24*gangstacat quit (Quit: Ĝis!)
03:04:43*gangstacat joined #nim
03:18:41*dddddd quit (Remote host closed the connection)
03:21:15*smt quit (Read error: Connection reset by peer)
03:28:37*chemist69_ joined #nim
03:31:27*chemist69 quit (Ping timeout: 240 seconds)
03:34:44*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
03:43:11*ftsf quit (Remote host closed the connection)
03:43:21*ftsf joined #nim
04:27:27*crem quit (Ping timeout: 250 seconds)
04:29:34*crem joined #nim
04:46:41*ftsf_ joined #nim
04:49:02*ftsf_ quit (Remote host closed the connection)
04:49:32*ftsf_ joined #nim
04:50:07*ftsf quit (Ping timeout: 240 seconds)
04:53:36*nsf joined #nim
05:02:10*darithorn quit ()
05:13:58*narimiran joined #nim
05:27:14*kapil____ joined #nim
05:41:09*ftsf_ quit (Read error: Connection reset by peer)
05:58:38*narimiran quit (Quit: Konversation terminated!)
06:11:16*krux02 joined #nim
06:53:17FromGitter<xmonader> Any idea how to use variables for (alignments and such) in `fmt`
06:53:49FromGitter<yyyc514> can i have a proc generate code at compile time or does it absoultey hace to be a macro at that point?
06:54:05leorizexmonader: it's not supported IIRC, there is an open issue for it
06:54:33leorizeyyyc514: generate code at compile time? isn't that a macro/template? :P
06:55:03FromGitter<yyyc514> well i was trying to do most of the work in a proc and then just push off the compile time piece to a template
06:55:15FromGitter<xmonader> @leorize you think i can get around with a template or macro to generate it?
06:55:26FromGitter<yyyc514> feel like i need the equiv of “eval” in other languages
06:55:39leorizexmonader: no idea, try it
06:55:48FromGitter<timotheecour> https://github.com/nim-lang/Nim/issues/9199 ; feel free to upvote to raise awareness :
06:56:00FromGitter<xmonader> yup thanks
06:56:01leorizeyyyc514: you mean you want to build the AST in a proc then push it out later?
06:56:28FromGitter<yyyc514> https://gist.github.com/yyyc514/f354f8ff2e8204a8221cadeba24dbe41
06:56:54FromGitter<yyyc514> i’d like to know the best way to mix this stuff… only one TINY part of that needs to be a macro
06:57:23leorizeoh, and you don't need `quote` in template
06:57:31leorizeuse {.inject.}
06:58:07FromGitter<yyyc514> huh?
06:58:59leorizeis that your own `quote`? :P
06:59:13leorizeI mistook it for `macros.quote`
06:59:31FromGitter<yyyc514> no i was being silly :)
06:59:39FromGitter<timotheecour> regarding eval: for runtime eval see evalString (i added it to https://github.com/timotheecour/Nim/blob/56606db7bf0bfc8d84c5a26ef957ee9392caa61a/tests/compilerapi/tcompilerapi.nim) ; for compile time eval: your macro can be a thin wrapper around a regular proc
06:59:42FromGitter<gogolxdong> Is there a comparison between .nims and Ninja?
06:59:52leorizeyou can't
07:00:24*mech422_ joined #nim
07:00:52FromGitter<yyyc514> @timotheecour ok i dont actually need eval() i need evalLater :-)
07:01:38FromGitter<yyyc514> i was just trying to psuh the macro part deeper inside to the only part that actually NEEDS the macro stuff
07:01:43FromGitter<yyyc514> instead of making the whole templat egeneration macro
07:01:57FromGitter<yyyc514> which i could just do
07:02:01leorizezero idea of what you're doing :P
07:02:32FromGitter<yyyc514> var html = textarea("person","name", opts = {"rows": "23"})
07:02:36FromGitter<yyyc514> trying to make that work
07:02:52FromGitter<yyyc514> WITHOUT the whoel textarea function being a macro
07:03:23*mech422 quit (Ping timeout: 268 seconds)
07:03:35FromGitter<timotheecour> again, u can have a thin wrapper macro: ⏎ `proc fooImpl(…): auto = …; macro foo(…): untyped = fooImpl(…)`
07:03:48leorizeyyyc514: it already looks like working...
07:04:03FromGitter<yyyc514> it’s not because person.name needs to be compiled
07:04:10FromGitter<yyyc514> to get the value
07:04:31FromGitter<yyyc514> from a person object
07:05:46leorizeuse a template with `astToStr()`
07:06:10leorizethen it could become: var html = textarea(person, name, opts = {})
07:06:43FromGitter<yyyc514> templates can’t run code
07:06:50FromGitter<yyyc514> i need to loop over opts and turn it into html
07:08:09FromGitter<yyyc514> Error: request to generate code for .compileTime proc: textarea
07:08:51leorizeso basically you want that `for` loop to run in compile time
07:09:13leorizetried a `static:` block?
07:09:31FromGitter<yyyc514> lol, never even heard of it
07:09:33*FromGitter * yyyc514 looking
07:11:29FromGitter<yyyc514> Error: cannot evaluate at compile time: result
07:11:32FromGitter<yyyc514> interesting
07:11:50*sagax_ joined #nim
07:11:52leorizeremember that in `template` there's no `result`
07:12:20FromGitter<yyyc514> i was trying to part part of the proc static just to see how it work
07:14:58FromGitter<yyyc514> ha it doesn’t blow up but it doesn’t output the value either
07:15:10FromGitter<yyyc514> oh wait
07:16:06FromGitter<yyyc514> yeah that one thing doesn’t work, i feel like i just have to make the whole thing a macro and then write some string helpers for macros
07:16:24leorizewell let me try writing a template version for it
07:16:35leorizebased on what I know abt this function of yours :P
07:16:41FromGitter<yyyc514> ok
07:16:48FromGitter<yyyc514> you have the full code :)
07:17:50FromGitter<yyyc514> check html == """<textarea name="person[name]" rows="23">Bob</textarea>"""
07:17:51FromGitter<yyyc514> and test
07:18:05FromGitter<yyyc514> well assuming the persons name is bob :)
07:20:34FromGitter<yyyc514> the runtime version was easy and i could drop to a macro just for the one part that fetches the value
07:21:41FromGitter<yyyc514> adding runtime version to gist
07:22:32FromGitter<yyyc514> maybe i just should have gone straight to macro vs template for the inner side
07:24:49FromGitter<yyyc514> ah the problem is proc isn’t going to have access to the outside scope anyways, is it?
07:25:17FromGitter<yyyc514> i just got it “working” with a macro but of course person has no meaning inside the proc
07:25:32FromGitter<yyyc514> still curiosu to see what a template form might look like
07:25:38FromGitter<yyyc514> right now it feels like the whole thing needs to be a macro
07:25:45FromGitter<yyyc514> (or template)
07:26:14leorizethe compiler doesn't like my code (yet) :P
07:30:12leorizeah, method call syntax limitation
07:30:18leorizenever thought I'd actually trip it :P
07:30:43FromGitter<yyyc514> congrats? lol
07:30:43*Widdershins left #nim ("WeeChat 2.2")
07:40:16*Jesin quit (Ping timeout: 264 seconds)
07:40:58*Jesin joined #nim
07:41:59leorizeyyyc514: maybe it's better of with a macro
07:42:44leorizeI wrote a working template version, but the loop only runs at runtime :(
07:43:20FromGitter<yyyc514> still would like to see
07:45:58leorizewait a second
07:46:00leorizeI've an idea
07:47:44leorizeit worked!
07:50:54leorizeyyyc514: https://ptpb.pw/hfoV/nim
07:51:09leorizeif you look into the `nimcache`, you'll find the string inlined :D
07:57:33FromGitter<yyyc514> what the heck kind of node is HiddenSubConv
07:59:47FromGitter<yyyc514> hmmm
08:02:23FromGitter<yyyc514> that whole inline proc idea is pretty neat
08:03:20*floppydh joined #nim
08:04:02leorizeinitially I was binding it with `{lit}`, which (hopefully) would avoid that inline `proc`
08:04:44leorizebut `{lit}` triggered the symbol binding pass, so `name` was treated as invalid :(
08:28:54*abm joined #nim
08:31:30*PMunch joined #nim
08:40:00*Perkol joined #nim
08:47:58FromGitter<yyyc514> does nim have a line continuation char?
08:48:22Araqno, it does not need it
08:48:41Araqcommas and binary operators are line continuations
08:48:58FromGitter<yyyc514> yeah i was wanting to do a prefix style
08:49:17FromGitter<yyyc514> blah ⏎ << more blah ⏎ << more etc
08:49:30FromGitter<yyyc514> works with << on the end but it’s not readable imho
08:49:46FromGitter<kayabaNerve> ... prefix style looks ugly as hell IMO.
08:50:02FromGitter<kayabaNerve> Postfix says there's more. Prefix says you thought the line was over but PSYCH
08:50:30FromGitter<narimiran> i didn't know we can use binary operators as line continuations without enclosing everything in parentheses
08:50:39FromGitter<narimiran> but i'm not sure i'll adopt that :)
08:51:57FromGitter<yyyc514> lol
08:52:16FromGitter<yyyc514> luke: i guess it depends on whether you’re reading blocks or lines
08:52:25FromGitter<yyyc514> the point of prefix i to make the BLOCK more readable
08:52:31FromGitter<yyyc514> for postfix also lies
08:52:38FromGitter<yyyc514> if you’re only looking at a single line
08:52:53FromGitter<yyyc514> it’s just whether you want to require the user to look forward or backward it seems is the question
08:53:39FromGitter<yyyc514> i think for some things (like templating) there is no harm with “add one line, add another line” it’s still very understanable
08:53:42FromGitter<yyyc514> templating is my context :)
08:54:49FromGitter<alehander42> well, it's not supported
08:55:09FromGitter<yyyc514> yeah :) now i know
08:59:04FromGitter<yyyc514> https://gist.github.com/yyyc514/5fb452ce471cfb52d9d0f810f44c4b93
08:59:08FromGitter<yyyc514> any nice way to clean up the dup <<
08:59:30FromGitter<yyyc514> i tried to do chaining but that gets upset when you don’t chain because then you have to discard
08:59:36FromGitter<alehander42> @yyyc514 are you working on a different template system?
08:59:46FromGitter<alehander42> because this looks very similar to karax/emerald to me
09:00:05FromGitter<yyyc514> this is definitely not emerald :)
09:00:27FromGitter<alehander42> so that's a helper
09:00:45FromGitter<yyyc514> yep
09:00:46FromGitter<alehander42> the cool thing about the DSL-s is that they support this for all tags
09:01:06FromGitter<alehander42> so if you want this opts behavior for other helpers
09:01:15FromGitter<alehander42> you might want to reuse it somehow
09:01:39FromGitter<yyyc514> which DSL are you referring to?
09:01:42FromGitter<alehander42> (e.g. you'll probably need to pass attributes to other helpers, right)
09:01:59FromGitter<yyyc514> well the ops stuff would be abstracted
09:02:06FromGitter<yyyc514> so you’d call tag()
09:02:11FromGitter<alehander42> emerald / karax
09:02:36FromGitter<alehander42> well literally that: `tagName(attr=value, otherAttr=value..):`
09:02:48FromGitter<alehander42> ok
09:03:14FromGitter<yyyc514> for my templates mostly it’ll be static HML
09:03:19*gmpreussner_ quit (Ping timeout: 244 seconds)
09:03:25FromGitter<yyyc514> the programatic stuff is really only needed for dynamic stuff like form helpers, etc
09:03:33FromGitter<yyyc514> if you just nede to write <div> you’d just write <div> :)
09:03:42FromGitter<yyyc514> in HTML
09:03:44*gmpreussner joined #nim
09:03:49FromGitter<alehander42> if you just need to write <textarea> you'd just write <textarea> :)
09:03:54FromGitter<alehander42> but you have a helper :P
09:04:01FromGitter<yyyc514> except that you need it bound to an object
09:04:13*druonysus quit (Ping timeout: 245 seconds)
09:04:17FromGitter<yyyc514> i mean i guess you’re saying you could just do it at a very low level
09:04:31FromGitter<yyyc514> <textarea><%= blah.value %></textarea>
09:04:33FromGitter<alehander42> you mean that textarea is one of the form helpers
09:04:49FromGitter<alehander42> ok
09:04:51FromGitter<yyyc514> yes textarea is a form helper like all the inputs, etc
09:05:10FromGitter<yyyc514> but now you got me wondering why that is lol :)
09:05:26FromGitter<yyyc514> rails started turning everything into a helper so soon i don’t know how to write sa styleheet tag anymore
09:05:33FromGitter<yyyc514> it’s just stylesheet(blah) :-)
09:05:38FromGitter<yyyc514> which i kind of get
09:05:39FromGitter<alehander42> exactly
09:05:59FromGitter<alehander42> the thing I like about the dsl-s is that normal tags and helpers have the same syntax (<name>(props))
09:06:28FromGitter<alehander42> so extensions look more natural to me
09:06:30FromGitter<yyyc514> yeah, not a goal here :)
09:06:40FromGitter<yyyc514> at least not for ERB style templates
09:06:49FromGitter<alehander42> I know, I know
09:07:00FromGitter<yyyc514> but you do have me wondering about going the other direction
09:07:16FromGitter<alehander42> adding fake tags?
09:07:26FromGitter<yyyc514> i think part of the value was for automatic errors and such things… with progamatic generation of the form fields you can easily add classes and such
09:07:31FromGitter<yyyc514> <input class=“hasError”) etc
09:07:41FromGitter<yyyc514> that’d be hard to do otherwise
09:08:00FromGitter<yyyc514> so it makes it easier to build out things like that
09:08:24FromGitter<yyyc514> i’m still just trying to work ont he best/prettiest way to write the code for this kind of templating engine
09:08:45FromGitter<yyyc514> creating a tempalte object i can just pass AST pieces too is a big help
09:08:56FromGitter<yyyc514> then you just << everything and call toAST when you’re done
09:09:02FromGitter<yyyc514> but i’m wondering if it can be better still
09:17:10*Vladar joined #nim
09:17:12FromGitter<alehander42> perfect is the enemy of good
09:19:21FromGitter<yyyc514> lol true
09:19:26FromGitter<yyyc514> not trying for perfect though :)
09:19:29FromGitter<yyyc514> not sure it’s good yet
09:29:28*Perkol quit (Quit: Leaving)
09:31:54FromDiscord<PusiteGA> hmm is nim good for game server?
09:32:31FromGitter<yyyc514> hmmmm, no built in table merge?
09:32:35FromGitter<yyyc514> other than count table?
09:32:48FromGitter<alehander42> hahaha yesterday there was a long discussion about table merge
09:33:07FromGitter<alehander42> not yet, but I guess somebody will PR it soon
09:33:31leorizePusiteGA: Nim is good for everything, except when it isn't :)
09:33:41FromGitter<alehander42> for now you can make your own util, it's 3 lines
09:33:54FromGitter<yyyc514> yeah just asking before i went off and wrote it :)
09:34:28FromDiscord<PusiteGA> game server should handle a 500+ connection in and sync the, so my guess it has to be greate at parraler , and i duno if it is
09:35:34FromDiscord<PusiteGA> whenewer i google nim vs others, rust pops up with some rayon thing whining how Nim paraler sux
09:35:48FromGitter<yyyc514> yep 3 loc :)
09:35:58FromGitter<mratsim> 500 connections is nothing and Rayon is about data parallelism not task level parallelism
09:36:17FromGitter<alehander42> hm I checked and my own util merge is 5, better fix it :D
09:36:22*banc quit (Quit: ZNC - http://znc.in)
09:38:10FromGitter<mratsim> Also I don’t expect Rayon to be faster than OpenMP. Source: I’m doing high performance computing at the moment and in Rust there is no way to pass info about pointer aliasing, data alignment and i.e. SIMD usage is so-so
09:39:23FromDiscord<PusiteGA> i am newbi but from what i get i need to , recive client info and sync it on server and then send to other players, my only issue is from what i read is that it duplacates data per thread or meybe i am wrong
09:39:53FromDiscord<PusiteGA> i dont know rust anyway, my plan was if Nim cant do i can try C++
09:41:15FromGitter<mratsim> data parallelism is processing an array in parallel: same operation on different data. For a webserver each threads are processing different things, and it’s not always on shared memory data structure.
09:42:47FromGitter<mratsim> You have several solutions for communication between threads, one is channel, it indeed requires deepcopy, but it’s thread safe. The other is shared memory by using raw pointers. It’s very performant but you will have the same issue as in C and C++, data races, pointer invalidation and such.
09:42:48*banc joined #nim
09:44:33FromDiscord<PusiteGA> ty you cleared some stuff for me , anyway will reaserch little more
09:48:26PMunchmratsim, have you ever tried the shared data structures?
09:49:28PMunchAs in the shared* modules here: https://github.com/nim-lang/Nim/tree/devel/lib/pure/collections
09:56:19*kapil____ quit (Quit: Connection closed for inactivity)
10:16:07*dom96_w joined #nim
10:33:52*couven92 joined #nim
10:36:29FromGitter<mratsim> not at all
10:36:53FromGitter<mratsim> For now, besides Nim in action, I only used parallelism on tensors
10:37:23*elrood joined #nim
10:39:55PMunchHmm, I'm curios on how well they work.
10:41:49*smt joined #nim
10:41:59FromGitter<yyyc514> hmmmm does macro have no way to autogen a new ident?
10:45:00leorizegenSym?
10:48:10FromGitter<yyyc514> perfect thanks!
10:56:44FromGitter<kaushalmodi> leorize: "remember that in template there's no result" I need to make a note of that. Thanks.
10:58:59Araqactually we have with .guard some ways of fighting data races
10:59:38Araqbut the pieces are only now coming together IMO, thanks to destructors shared memory is much easier to deal with
11:00:06Araqand while seqs and strings are still not destructor based, you can write your own seq that uses allocShared etc
11:13:58*Snircle joined #nim
11:39:03FromGitter<zacharycarter> PMunch: they work - but there are only a few
11:39:06FromGitter<zacharycarter> string I think and queue
11:39:12FromGitter<zacharycarter> maybe dequeue
11:39:56PMunchlist, string, and tables according to GitHub
11:41:04FromGitter<zacharycarter> ah okay
11:41:20FromGitter<zacharycarter> I find queue to be the one I really need
11:41:36FromGitter<zacharycarter> but there's a github repo out there named tart - and I also pulled a lot of code form it for the new iteration of FRAG I plan on working on
11:41:59FromGitter<zacharycarter> he has a lot of shared data structures - although the code needs to be updated to use unchecked arrays instead of whatever container it's currently using
11:42:35FromGitter<zacharycarter> https://github.com/sheosi/tart
11:42:49FromGitter<zacharycarter> https://github.com/sheosi/tart/tree/master/tart/structures
11:42:57PMunchHmm, interesting
11:50:37FromGitter<zacharycarter> think my next laptop is - https://www.amazon.com/MSI-GS63VR-Stealth-Pro-229-i7-7700HQ/dp/B01N1WRY0Q?SubscriptionId=AKIAJ76EIXAV3V6D6JEQ&tag=globalnetwork-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01N1WRY0Q&th=1
11:50:50FromGitter<zacharycarter> to replace the macbook pro I have from work - which I'll have to give back soon I"m hoping
11:53:12PMunchThat's quite a machine
11:54:20PMunchI actually like the one I've got for work
11:54:27PMunchFujitsu U747
11:56:18FromGitter<zacharycarter> well - I want it for game development
11:56:39FromGitter<zacharycarter> so I need a gfx card and lots of ram
11:56:45FromGitter<zacharycarter> and a ssd - and a large HD
11:57:23FromGitter<zacharycarter> the only thing I don't like about that one - is no trackpad buttons
11:57:42FromGitter<zacharycarter> but the one that has them is SOOOOO much bigger and weighs 5+ lbs
11:58:23FromGitter<zacharycarter> this one is just under 4
11:58:23PMunchYeah, for game-dev it's probably a good machine
11:58:28FromGitter<zacharycarter> yeah
11:58:42PMunchAt least if you're doing heavy games
11:58:48FromGitter<zacharycarter> I'd go with a desktop - but I'm doing the whole digital nomad thing
11:58:53FromGitter<zacharycarter> well - I'm going to be working on my own engine
11:59:00FromGitter<zacharycarter> which is going to be doing PBR rendering - etc
11:59:04FromGitter<zacharycarter> so I'll need a decent machine
11:59:58PMunchI've always stuck to 2D, but then I've been developing on really underpowered hardware :P
12:00:29FromGitter<zacharycarter> I get bored quickly of 2d
12:00:33PMunchI mean my desktop is decent enough (it's starting to need an upgrade as well though), but my laptops are pretty shit
12:00:45FromGitter<zacharycarter> and 3d opens so many more opportunities IMO for creativity
12:01:54PMunchWell, since I don't have a team and don't really do 3D graphics myself all my little hobby project games are limited to what I can do myself. And I find that sticking with 2D means I spend more time thinking about cool concepts and not just cool graphics
12:03:38livcdI am switching to Windows desktop soon as I cant justify spending that much on mbp. Am a bit worried about sw bloat :/
12:03:51FromGitter<zacharycarter> is also super nice - but almost 3k
12:03:52FromGitter<zacharycarter> https://www.amazon.com/Zephyrus-8th-Gen-IPS-Type-i7-8750H-processor/dp/B07BSKLV3K/ref=pd_rhf_ee_s_cp_1_8?_encoding=UTF8&pd_rd_i=B07BP9LSVS&pd_rd_r=2cc2fcd1-1d06-40f4-aa4c-5800982888ca&pd_rd_w=D0q9M&pd_rd_wg=TJENf&refRID=RWK1KP6ZQHBWYK383ARH&th=1
12:04:02livcdI need to contain software in docker containers or VMs
12:07:24livcdWindows is a pain. I want to be restricted in Mac :-(
12:08:23FromGitter<narimiran> livcd why are you not considering linux?
12:09:01FromGitter<narimiran> (btw all this is offtopic, isn't it? ;))
12:09:29FromGitter<zacharycarter> let's not get all strict about off-topicness when there is no on-topic conversation going on
12:09:44FromGitter<zacharycarter> I mean - we'r ea all nim devs talking about computers / OS's
12:09:49FromGitter<zacharycarter> we could be way way more off topic
12:09:59livcdso we move to #nim-offtopic ?
12:10:30livcdnarimiran: because linux on desktop is a mess
12:11:04FromGitter<vegai> yeah. I used Linux from 1996 and moved to Apple this year
12:11:06PMunchAs long as we don't bother anyone here then it's normally fine
12:11:38FromGitter<vegai> which doesn’t of course mean that I don’t use any Linuxes anymore, but I really rather would not use it as my desktop anymore
12:11:45PMunchI still use Linux, another thing to take into consideration when getting a lap-top
12:12:14PMunchvegai, why the change?
12:12:23*vlad1777d_ joined #nim
12:12:31livcdI personally dont want to care about those little things that are just so painful. Like updating and finding out that all of a sudden you need sound/graphics working and it just does not
12:12:41FromGitter<vegai> PMunch: not sure. I think I just got old :P
12:12:43FromGitter<yyyc514> any way to get a bacck stacktrace for compile time errors?
12:12:49livcdalso I do not care about updating all the software at once. I do not need that. I do not want that.
12:12:52FromGitter<vegai> “I’m too old to deal with all this shit” -type of scenario
12:13:17PMunchyyyc514, you'll need a dev build of Nim for that
12:13:38leorizeyyyc514: if compiler crash then use `./koch temp` to generate a debug build
12:13:43PMunchvegai, I can see that. Some distros are quite hard to maintain
12:13:54FromGitter<vegai> PMunch: :)
12:13:56PMunchOnly one I've tried that I really like is Manjaro
12:14:12PMunchStill has left to horribly mess something up on that
12:14:29FromGitter<vegai> my gaming box is running Arch, though. If you just stick to i3 and minimal configurations, everything pretty much works
12:14:44FromGitter<yyyc514> pmunch: it’s not a compiler crash it’s just a compile error
12:14:45FromGitter<vegai> I might go back to that world some day, who knows
12:15:14FromGitter<yyyc514> have compiler errors been much improved since the last release?
12:15:45PMunchyyyyc514, not quite sure what you mean by compiler errors
12:16:33FromGitter<yyyc514> errors compiling the source
12:16:38FromGitter<yyyc514> "compile errors”
12:16:39FromGitter<yyyc514> ?
12:17:26PMunchDo you have an example?
12:18:41FromGitter<yyyc514> ../../../../.brew/Cellar/nim/0.19.0/nim/lib/core/macros.nim(476, 7) Error: undeclared field: 'n'
12:18:52FromGitter<yyyc514> it’d be ncie if that would actually stack trace back into what caused it
12:18:59FromGitter<yyyc514> but i only get that one line
12:19:24PMunchOh yeah, those errors suck :P
12:20:13FromGitter<yyyc514> talk about it :)
12:20:27FromGitter<zacharycarter> well it's a compile time error no?
12:20:36FromGitter<zacharycarter> you can get a stack trace using koch temp
12:20:55FromGitter<zacharycarter> but it doesn't sound like a runtime error - it sounds like you're referencing an undeclared field on an object
12:20:58FromGitter<zacharycarter> with the name `n`
12:21:07FromGitter<zacharycarter> error makes perfect sense to me
12:21:27FromGitter<zacharycarter> and you have a line number to see exactly where it's happening - 476, col 7
12:22:32FromGitter<yyyc514> it’s in parseStmt, which would be nice if the compiler even mentioned that vs JUST the line number
12:22:35FromGitter<yyyc514> i’m not asking for help with the error
12:22:44FromGitter<yyyc514> i’m asking if there is a way to get better stack traces for such errors
12:22:45PMunchin macros.nim..
12:23:07*kapil____ joined #nim
12:23:08PMunchYeah it would be nice to see where in your own code called something that triggered macros.nim to error out
12:23:16FromGitter<yyyc514> exactly
12:24:10FromGitter<zacharycarter> hrm - the only way I know to get a stack trace from the compiler is using koch temp
12:25:36FromGitter<zacharycarter> I'm not sure if that will help though :(
12:48:53FromGitter<yyyc514> *sigh*
12:48:57FromGitter<yyyc514> so streams doesn’t work with VM?
12:49:35FromGitter<yyyc514> should the module dos maybe mention which modules work inside the VM and which don't
12:51:48*anamok joined #nim
12:51:50anamokhello
12:52:52anamokWith `-d:release`, debug info is removed. However, with `strip exe` we can further reduce the size of the exe. So what does strip do that -d:release doesn't?
12:55:27PMunchStrip removes symbols IIRC
12:55:49*seni joined #nim
12:57:07*vlad1777d_ quit (Ping timeout: 240 seconds)
12:58:14anamokPMunch, and the release mode? What does it remove? Just the debug info?
12:59:18FromGitter<kaushalmodi> anamok: `-d:release` does these things: https://github.com/nim-lang/Nim/blob/16c3d4332fac56b275ca3c66dcf12573738bdc91/config/nim.cfg#L55-L70
13:00:21anamokI see. Thanks.
13:01:21FromGitter<alehander42> @yyyc514 what are you using streams for on compile time? probably there is an alternativ
13:02:01FromGitter<alehander42> just reading the file?
13:16:32*endragor quit (Remote host closed the connection)
13:28:25FromGitter<yyyc514> template parser
13:28:41FromGitter<yyyc514> i mean i can write my own streams stuff, but just seems like i hit this all the time trying to do stuff at compile time :)
13:40:10*endragor joined #nim
14:06:58*endragor quit (Remote host closed the connection)
14:07:23*PrimHelios joined #nim
14:08:38*vivus joined #nim
14:08:53vivusHi all. How do I specify the output folder for my compiled program?
14:09:18FromGitter<kaushalmodi> vivus: You cannot specify an output folder AFAIK
14:09:28FromGitter<kaushalmodi> but you can specify the output binary file with path
14:09:43vivusexample?
14:09:54FromGitter<kaushalmodi> so you can do `mkdir -p foo && nim c src/blah.nim -o:foo/blah`
14:10:16FromGitter<kaushalmodi> `nim --fullhelp | grep out`
14:11:08vivusso if the folder already exists then: `nim c myfile.nim -o:/path/to/myfile`
14:11:51FromGitter<kaushalmodi> try it
14:11:53FromGitter<kaushalmodi> :)
14:21:27*PrimHelios quit (Ping timeout: 240 seconds)
14:37:10*PrimHelios joined #nim
14:45:12stefanos82vivus: you don't need to create a folder
14:45:42vivusstefanos82: ? can you explain a bit more?
14:45:46stefanos82personally I prefer using .nims file with the following option: switch("out", "bin/foo")
14:46:13stefanos82whereas foo is your binary name you want to give to your program
14:46:45vivusswitch() is a programming parameter? where do I use it?
14:46:55FromGitter<kaushalmodi> stefanos82: You're correct
14:47:09stefanos82vivus: what is the name of your .nim file?
14:47:10FromGitter<kaushalmodi> looks like `-o:` creates dir hierarchy if not present
14:47:30FromGitter<kaushalmodi> I got confused with the behavior of `nim doc -o:..` where the dir does not get created
14:47:31vivustest.nim
14:47:37FromGitter<kaushalmodi> \*consistency
14:47:58stefanos82vivus: very nice. create a test.nims right next to it and place in there the aforementioned switch() command
14:48:09stefanos82then run your nim command
14:48:37stefanos82my project skeleton is: project_name/{bin,src,tests}
14:48:43vivusI was wondering if you made a typo there. so .nims is a file recognized file format also
14:48:46FromGitter<kaushalmodi> correcting myself.. looks like `nim doc` creates the required missing dir hierarchy too
14:49:04FromGitter<kaushalmodi> I much be confusing with something else, or this got fixed on devel some time
14:49:10stefanos82.nims is for nimscript
14:49:44stefanos82@kaushalmodi: possibly both lol
14:50:29Araqhttps://akrzemi1.wordpress.com/2014/06/02/ref-qualifiers/
14:50:44Araqhttps://docs.microsoft.com/en-us/dotnet/csharp/reference-semantics-with-value-types
14:50:55stefanos82there he is :)
14:50:59Araqooh look, other languages are growing new feature
14:51:02Araqs
14:51:24Araqin fact, replicating a bit what Nim is getting with sink and lent
14:52:07Araqfeels like we're converging to single ideal PL
14:52:40Araqand that is Nim, ofc :P
14:52:57stefanos82Araq: I have noticed we have reached a peak point with programming languages that most of them look much alike, which eventually they will become one, semantically speaking
14:53:41PMunchhttps://github.com/dom96/choosenim/issues/98 <- choosenim should really do some cleanup
14:54:15FromGitter<kaushalmodi> Hello PMunch! I just added a PR to run toml-test for parsetoml
14:54:40FromGitter<kaushalmodi> great to see that it already passes 100/113 tests!
14:55:34Araqkaushalmodi: what is the state of the nightlies?
14:56:18PMunchtoml-test?
14:56:49PMunchHmm, did something change there
14:56:50stefanos82PMunch: my Nim repo is 1.6G :S
14:56:59PMunchLast I ran it it passed 100%
14:57:11stefanos82just the tests consume 171MB
14:57:12PMunchstafanos82, how did you managed that? :P
14:57:42stefanos82a Nim local repo
14:57:47PMunchkaushalmodi, try to run it on the 0.5.0 branch
14:57:55stefanos82so I guess it's full of git deltas
14:58:05FromGitter<kaushalmodi> Araq: Looks like they are happening fine: https://github.com/nim-lang/nightlies/releases Waiting for today's travis cron to start
14:58:24FromGitter<kaushalmodi> yest was a mess (as you see the last release in that link) because of GitHub issues
14:58:51stefanos82ugh...csources are 481M
14:59:10FromGitter<kaushalmodi> stefanos82: I run this script to build Nim: https://ptpb.pw/sV74/bash
14:59:26FromGitter<kaushalmodi> see line 182 onwards to see the cleanup I do
15:00:02FromGitter<kaushalmodi> My build dir size is 180MB, while the installation size is 37MB
15:00:17PMunchYeah, choosenim should really do something similar
15:00:46stefanos82@kaushalmodi: quite unnecessary for me this script of yours. all I do is: git -C csource pull && sh build_all.sh
15:01:30Araqer, excuse my ignorance, do you have write access to nightlies?
15:02:03FromGitter<kaushalmodi> stefanos82: It's built very much to my requirements: build in stow hierarchy; ability to switch branches, do extra cleanup, add workarounds for config.nims presence bug, etc.
15:02:19stefanos82Araq: me?
15:02:21FromGitter<kaushalmodi> Araq: I do.. I already committed
15:02:57stefanos82I committed once as well
15:03:05stefanos82about a docs typo
15:03:10FromGitter<kaushalmodi> Araq: the builds show failures because of Appveyor fails
15:04:05Araqwhat does Appveyor say?
15:04:23Araqthough ... maybe use the new travis on windows for nightlies
15:05:28FromGitter<kaushalmodi> Araq: I thought of using windows, but may be someone else is more experienced with travis windows builds
15:06:14FromGitter<kaushalmodi> https://ci.appveyor.com/project/Araq/nightlies/builds/19696990/job/i7a9w7c4k17e4thv
15:09:18FromGitter<kaushalmodi> Araq: Also this needs your attention: https://github.com/nim-lang/nightlies/issues/4
15:09:22FromGitter<kaushalmodi> the compiler.ini is outdated
15:09:36FromGitter<kaushalmodi> so koch testinstall is failing to find testament/
15:09:43*sagax_ quit (Remote host closed the connection)
15:09:52FromGitter<kaushalmodi> \* compiler/installer.ini
15:10:52*PrimHelios quit (Ping timeout: 264 seconds)
15:15:07anamokOn the page https://nim-lang.org/docs/os.html I don't find getEnv, but os.getEnv does exist.
15:15:42vivus@kaushalmodi I tried to run it, but it tells me: Error: arguments can only be given if the '--run' option is selected
15:16:24vivusmy command I ran was: `nim c -d:release test.nim -o:/home/path/to/test`
15:17:31vivusanamok: check the nim code and see if any comments exist for `getEnv`. I think the documentation is within the code
15:18:01FromGitter<kaushalmodi> vivus: yeah, put the nim file arg as the very last
15:18:11FromGitter<kaushalmodi> all switches need to come first
15:18:18vivusoh I thought as much
15:19:12anamokvivus: getEnv is used in os but not defined
15:20:05anamokvivus: however, on top of os doc, getEnv is under Exports, in a list. I don't know what it means.
15:20:13PMunchkaushalmodi, did you try to run it on the 0.5.0 branch?
15:20:18FromGitter<kaushalmodi> yes
15:20:26PMunchResults?
15:20:36FromGitter<kaushalmodi> PMunch: https://travis-ci.org/NimParsers/parsetoml/builds/445177784?utm_source=github_status&utm_medium=notification
15:20:51FromGitter<kaushalmodi> that should be failing any time soon
15:21:00FromGitter<kaushalmodi> but I tested the same fails to happen locally
15:21:53Araqkaushalmodi: the appveyor problem seems to be still my incompetence to write scripts
15:22:07PMunchHmm, strange
15:22:20FromGitter<kaushalmodi> PMunch: let's continue the conversation here :P
15:22:32FromGitter<kaushalmodi> so my merging step introduced quite many diffs
15:22:40FromGitter<kaushalmodi> so 0.5.0 was never merged into master
15:23:12FromGitter<kaushalmodi> PMunch: that branch failed: https://travis-ci.org/NimParsers/parsetoml/builds/445177784#L2035
15:23:18shashlick@kaushalmodi: is there any plan to post the nightly binaries as well?
15:23:39FromGitter<kaushalmodi> shashlick: they are already posted
15:23:59shashlickthere's only xz files which need to be compiled
15:24:00PMunchI think I merged 0.5.0 into master, just not with the exact same commits. I cherry-picked them over and squashed them with some other changes IIRC
15:24:48FromGitter<kaushalmodi> shashlick: ah, yeah, not compiling binaries ATM
15:25:32FromGitter<kaushalmodi> will need to then deal with a big matrix of 32/64 bits vs OSes
15:25:35shashlickthat will be useful - can eventually add to choosenim so that you can simply install nightly
15:25:53shashlickmusl it man 🙂
15:26:22FromGitter<kaushalmodi> won't musl builds too need 32 vs 64 bit?
15:26:40Araqanamok, it's listed in the "exports" section because it comes from ospaths originally
15:27:03shashlickyes but probably won't need for each Linux distro
15:27:35shashlickeventually, will be cool to have a linux release binary as well, like we do for windows
15:27:55anamokAraq, under https://nim-lang.org/docs/ospaths.html I can't find it either
15:28:59Araqthat's a bug :-)
15:29:19Araqthe new docgen surely has terrible bugs, 0.19.2 will come soon
15:29:32anamokOK :) Thanks.
15:31:37PMunchHmm, this is very strange kaushalmodi
15:31:57PMunchI'll check once I get home if I have some changes that I forgot to push or something
15:32:07PMunchI checked the toml-test repo and it hasn't changed
15:32:18*PrimHelios joined #nim
15:33:14PMunchBecause I'm pretty sure all the tests should pass
15:34:05PMunchI mean I even have a commit that states that it should pass all the tests..
15:34:40stefanos82Araq: now that you are here, I wanted to ask: how can anyone distinguish user-defined pragmas from standard pragmas that Nim offers by default?
15:34:48vivusmy awesome nim code is now on the interwebz XD
15:35:41*dom96_w quit (Changing host)
15:35:41*dom96_w joined #nim
15:36:23dom96_wchoosenim grabbing nightlies would be beautiful
15:37:05FromGitter<kaushalmodi> PMunch: checkout the run-toml-test branch (the one PR'd) and add missing commits if any to that one.
15:37:19PMunchWill do
15:37:30PMunchIf not I'll fix the issues
15:37:34FromGitter<kaushalmodi> Once passing the `nimble run_toml_test`, you can merge it and bump the version
15:37:44FromGitter<kaushalmodi> Awesome, thanks!
15:38:49*PrimHelios_ joined #nim
15:41:07*PrimHelios quit (Ping timeout: 240 seconds)
15:41:14Araqstefanos82, well not really but iirc it's impossible to override the builtin pragmas and they are mostly documented
15:41:32Araqoccasionally we find undocumented pragmas :P
15:42:01Araqbut new ones are always documented and so it's getting rarer
15:42:13stefanos82Araq: I see. It would be a nice concept if builtin pragmas had a different set of braces than the user-defined
15:43:02shashlickdom96: can you please merge PR #91 and #97 on choosenim?
15:43:03stefanos82Araq: for instance, builtin pragmas: {. foo .}, user-defined (. .), template pragmas [. .]
15:43:05FromGitter<yyyc514> so there is currentSourcePath, is there any type of callingSourcePath?
15:43:06AraqI disagree
15:43:17Araqstefanos82, that should just be a highlighter feature
15:43:28Araqkeywords are in bold and so could be builtin pragmas
15:43:34dom96_wshashlick: when I get home, possibly
15:43:45stefanos82Araq: another option would be a label right next to each custom pragma
15:43:48shashlickcool thanks
15:44:12stefanos82Araq: for instance, {. user-defined: foo .}
15:44:20leorizeplease don't make them harder to use
15:44:30stefanos82leorize: pragmas?
15:44:46leorizeyes, we have `{.async.}` for example
15:45:04leorizeit wouldn't be nice to do `{. user-defined: async .}`
15:45:17stefanos82yeah, you are right
15:45:20stefanos82hmm...
15:45:40leorizeis there really a need to distinguish them?
15:46:00stefanos82well, how can we figure out which pragma is user-defined or not?
15:46:00*platoff joined #nim
15:46:11Araqstefanos82, the builtin list is fixed
15:46:16leorizewhy would we need to do that?
15:47:02Araqand new pragmas will be written as __Uppercased, oh no, that was that other lang ... :P
15:47:16stefanos82Araq: lol
15:47:26*darithorn joined #nim
15:47:39dom96_wPython decorators are pretty nice... *cough*
15:47:58stefanos82that's another story dom96_w
15:50:06dom96_wwow, this channel is only 2 people off the record
15:50:16FromGitter<kaushalmodi> PMunch: Looks like that last toml-test PR for extra tests introduced the new fails: https://github.com/BurntSushi/toml-test/pull/48
15:51:57AraqUnlink of file '.git/objects/pack/pack-132fec132a642d32c02f754401210b0d1c2864fa.idx' failed. Should I try again? (y/n) n
15:52:04Araqyay, git fun on Windows
15:52:04PMunchHmm, I might've run the tests at home with an old copy of the repo then
15:52:06*nsf quit (Quit: WeeChat 2.2)
15:52:18PMunchkaushalmodi ^
15:52:27PMunchI'll look at it later
15:52:30FromGitter<kaushalmodi> thanks
15:52:33PMunchdom96_w, which record?
15:52:42dom96_wThis channel's user count record
15:52:43dom96_wIt's 170
15:53:01FromGitter<kaushalmodi> what's the "_w"?
15:53:16PMunchOh right
15:53:17FromGitter<alehander42> @dom96_w I sometimes wish pragmas used the @name syntax :D
15:53:30FromGitter<alehander42> @yyyc514
15:53:35PMunchOh well, you're going to be down one now :P
15:53:37PMunchBye
15:53:39*PMunch quit (Quit: Leaving)
15:53:46FromGitter<yyyc514> @alehander42 ?
15:53:48FromGitter<alehander42> you can still just readFile a template source and parse it
15:53:59FromGitter<alehander42> maybe I am missing something
15:54:33FromGitter<yyyc514> I'm using walkDir and it’s very picky about dirs
15:54:46FromGitter<yyyc514> i just moved my code and now it doesn’t work, grrrr
15:55:06FromGitter<yyyc514> since the templates were relative to the controller, not the library itself
15:56:29stefanos82Araq: are you using Cmder on Windows?
15:56:36FromGitter<alehander42> I mean I don't know why do you need IO streaming for parsing them
15:56:45Araqstefanos82, yes
15:56:52stefanos82Araq: awesome
15:57:28stefanos82any progress with the tiny c REPL implementation?
15:57:37FromGitter<alehander42> @yyyc514 I actually started using `for view in walkDir(path, relative=true):` again in my view lib
15:57:46FromGitter<alehander42> and it seems to work fine in a different repo
15:57:49FromGitter<alehander42> for me
15:58:24FromGitter<alehander42> (my templates are relative to the controller that invokes the macro which has walkDir)
15:59:36FromGitter<yyyc514> yeah i’m playing with relative agian now
16:00:12FromGitter<alehander42> no, relative=true is just for the resulting paths in `view` I think
16:00:34FromGitter<alehander42> I meant that path is relative (if you meant that too, sorry, kinda confusing)
16:01:41FromGitter<yyyc514> yeah, but my staticRead isn’t working then… i think becaue it’s in a different file
16:03:08FromGitter<yyyc514> nope… did you use static read with relative paths?
16:04:53FromGitter<alehander42> that's what I do https://github.com/alehander42/view-loader/blob/master/src/view_loader.nim
16:06:22FromGitter<alehander42> the template lib which is invoked with render does a staticRead
16:06:29FromGitter<alehander42> and it seems to work with relative paths
16:06:38FromGitter<yyyc514> where do you load the file
16:06:44FromGitter<yyyc514> hmmmm
16:07:17FromGitter<alehander42> well, in my template function
16:07:26FromGitter<alehander42> which does
16:07:28FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bcf4740600c5f6423f66cb2]
16:07:52FromGitter<alehander42> renderBase is also relative (it's the view folder in my case)
16:08:04FromGitter<alehander42> so e.g. staticRead("./views/main_view.nim")
16:09:56FromGitter<yyyc514> pwd seems to be the same, no idea why mine isn’t working
16:09:57FromGitter<kaushalmodi> Araq: https://github.com/nim-lang/Nim/issues/9451 is related to that installer.ini fix
16:10:14FromGitter<kaushalmodi> The installer.ini is references many outdated/non-existing files
16:13:17FromGitter<yyyc514> yeah the `pwd` effectively is NOT the same always for slurp vs walkDir
16:20:16FromGitter<yyyc514> can i set a constant in one file and have it carry across the entire project / all the child imports?
16:22:31FromGitter<alehander42> `const NAME* = ..` ?
16:26:46FromGitter<yyyc514> nope
16:27:03FromGitter<yyyc514> i’m wanting it to flow downwards not up
16:27:06FromGitter<yyyc514> i know how import works
16:27:27FromGitter<yyyc514> i want to set something like APP_ROOT and have it available everywhere
16:27:58FromGitter<alehander42> well, you can have a compileTime var
16:28:10FromGitter<alehander42> but you need to define it in some kind of base file that is imported
16:28:17FromGitter<alehander42> everything flows downwards
16:28:38FromGitter<yyyc514> to me import is upwards
16:28:49FromGitter<alehander42> ok, then upwards
16:28:50FromGitter<alehander42> :D
16:29:12*PrimHelios_ quit (Ping timeout: 244 seconds)
16:29:26FromGitter<yyyc514> i guess i could do that with the include feature of the compiler though
16:33:29*Trustable joined #nim
16:34:22FromGitter<alehander42> sounds good, but I think it will work only for the directly included file
16:37:23FromDiscord<bentech> How well does nim do web stuff?
16:54:24anamokbye
16:54:27*anamok quit (Remote host closed the connection)
16:58:08FromGitter<xmonader> It was smooth for a pre-release ⏎ https://github.com/threefoldtech/zos
16:59:52*dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:03:19*nsf joined #nim
17:04:21FromGitter<tim-st> why is it deprecated?: `import unicode; echo "ÜU".isUpper(skipNonAlpha=false)`
17:04:38FromGitter<kaushalmodi> loooong history
17:04:56FromGitter<tim-st> `Deprecated since version 0.20 since its semantics are unclear;`
17:05:15FromGitter<tim-st> not sure where the semantics are unclear here
17:06:08leorizethere is an issue dedicated to it
17:06:08FromGitter<kaushalmodi> history: https://github.com/nim-lang/Nim/issues/7963
17:07:05FromGitter<tim-st> ok, but with the parameter the semantics should be clear
17:07:27FromGitter<tim-st> otherwise I'm not sure which proc to use instead for this
17:07:52FromGitter<kaushalmodi> yeah, now you need to "roll your own"
17:08:13FromGitter<kaushalmodi> to get the v0.18.0 behavior, simply run a for loop and return on false
17:08:41FromGitter<tim-st> that's pretty bad, I think the deprecated warning should be removed, maybe just add it as a comment
17:09:32FromGitter<kaushalmodi> here's my implementation that I think should have been the right fix for 7963: notes
17:09:45FromGitter<kaushalmodi> hehe, trying again: https://scripter.co/notes/string-fns-nim-vs-python/#better_islower_isupper
17:10:07*SenasOzys joined #nim
17:10:17*SenasOzys quit (Remote host closed the connection)
17:11:31FromGitter<tim-st> I think the current implementation with forced bool parameter is ok, I just dont understand what to use instead if that is removed one day
17:21:33*nolan_d left #nim ("User left")
17:26:18Araqtim-st: never seen a convincing usecase and I like the stdlib bloat-free
17:32:25Araqmystr.allIt(isUpper(it)) seems to do the same
17:33:00Araqor the check x == toUpper(x)
17:34:19Araqunless you really want the containsAtleastOneUpperAndNoLower semantics in which case isUpper() is a terrible name for this...
18:07:41FromGitter<timotheecour> the only reason isUpper exists in python is because they don’t have a character type, `”foo”[0]` has type str, so they can’t have a dedicated isUpper just for chars; another limitation of dynamic languages which we really don’t need to inherit.
18:18:49FromGitter<yyyc514> does nim have strtr or equiv?
18:18:53FromGitter<yyyc514> to translate chars?
18:20:32*Arrrr joined #nim
18:22:31leorizeanyone know how to insert `NULL` with `db_sqlite`?
18:23:42FromGitter<yyyc514> NULL doens’t work?
18:24:02FromGitter<yyyc514> or are you using the binding stuff?
18:25:19FromGitter<alehander42> @yyyc514 yes, it's called replace
18:25:47FromGitter<alehander42> (strutils)
18:25:47FromGitter<yyyc514> it has a TR mode?
18:25:54leorizecertainly not when you use `db.exec(sql"insert into table (col) values (?)", "NULL")`
18:26:01FromGitter<yyyc514> or you just mean call it multiple times?
18:26:34FromGitter<yyyc514> leorize: read the C API and see if there is a magic value
18:26:39FromGitter<alehander42> @yyyc514 what is TR mode
18:26:55FromGitter<yyyc514> http://php.net/manual/en/function.strtr.php
18:27:01FromGitter<yyyc514> translate
18:27:12FromGitter<yyyc514> i already wrote my own :)
18:27:14FromGitter<kaushalmodi> @yyyc514 may be `multiReplace`
18:27:16leorizeyyyc514: well the thing is `db_sqlite` auto quotes those thing...
18:27:38leorizeand without nil string it's not possible to tell it to insert null :/
18:27:44FromGitter<kaushalmodi> @yyyc514 https://nim-lang.org/docs/strutils.html#multiReplace%2Cstring%2Cvarargs%5B%5D
18:28:39FromGitter<alehander42> well, it just replaces a character by other char
18:28:54FromGitter<kaushalmodi> leorize: may be it needs Option[string] support
18:28:56FromGitter<alehander42> i think this "translate" naming is very .. bizarre
18:29:14FromGitter<alehander42> you can replace substrings of course
18:29:23FromGitter<kaushalmodi> @alehander42 that's what the Unix `tr` utility does
18:29:31FromGitter<kaushalmodi> and also what @yyyc514 wants, I believe
18:29:33FromGitter<alehander42> and multiReplace is useful if you want to replace different strings in the same pass
18:29:43FromGitter<alehander42> otherwise, normal replace should be enough
18:30:15FromGitter<yyyc514> multireplace looks like it could work
18:30:18FromGitter<alehander42> I see
18:30:25FromGitter<alehander42> yeah sounds like multireplace
18:30:33FromGitter<alehander42> now the tr name makes sense
18:31:38FromGitter<kaushalmodi> for completeness, as @alehander42 said, this already works: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bcf690a600c5f6423f76c88]
18:38:17FromGitter<yyyc514> rigth i just needed multiple replacements :)
18:38:22FromGitter<yyyc514> one could also chain replace if one was lazy :)
18:40:02FromGitter<kaushalmodi> above led me think.. below doesn't compile.. but is it possible to do so using the right syntax? ⏎ ⏎ ```import strutils ⏎ const ⏎ tr = strutils.replace ⏎ ...``` [https://gitter.im/nim-lang/Nim?at=5bcf6b021c100a4f29d194fe]
18:40:31FromGitter<kaushalmodi> the compilation error is "cannot generate VM code for replace"
18:40:42*voiceftp joined #nim
18:40:43*voice_ftp joined #nim
18:41:22*voiceftp quit (Client Quit)
18:41:30*voice_ftp quit (Remote host closed the connection)
18:41:47*voiceftp joined #nim
18:41:53*voice_ftp joined #nim
18:44:45*voice_ftp quit (Client Quit)
18:45:15*PrimHelios_ joined #nim
18:48:07FromGitter<yyyc514> interesting didn’t know you could do taht
18:48:12FromGitter<yyyc514> maybe you can’t :)
18:51:40FromGitter<kaushalmodi> it kinda works. "kinda" because you need to specify all types, it seems: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bcf6dbc82893a2f3b2b2b97]
18:53:37FromGitter<kaushalmodi> hmm, this works too: ⏎ ⏎ ```template tr(a, b, c: auto): auto = replace(a, b, c)``` [https://gitter.im/nim-lang/Nim?at=5bcf6e3182893a2f3b2b2ecc]
18:55:43FromGitter<yyyc514> any splat syntax? to turn an object into vargs just based on all it’s fields?
18:56:59FromGitter<kaushalmodi> no idea.. I am discovering this just today with you
18:57:11Araquse a macro for splat()
18:57:57FromGitter<kaushalmodi> I tried `template tr3(args: varargs[auto]): auto = replace(args)` but that doesn't work
18:58:14Araqmacros.unpackVarargs
18:59:55FromGitter<yyyc514> ah
18:59:56FromGitter<yyyc514> nice
19:00:16FromGitter<kaushalmodi> it worked!
19:00:19FromGitter<kaushalmodi> ```template tr3(args: varargs[untyped]): auto = replace.unpackVarArgs(args)```
19:00:49FromGitter<kaushalmodi> now we need a macro for that so that we can do: ⏎ ⏎ ```alias: ⏎ tr3 = replace``` [https://gitter.im/nim-lang/Nim?at=5bcf6fe11e23486b9307a44a]
19:00:52FromGitter<kaushalmodi> any takers?
19:01:12Araqif you understand why f(*args) can't work but unpack(f, args) can, you have understood Nim
19:01:38Araqor to make it more obvious, why f(unpack args) can't but unpack(f, args) can
19:01:44FromGitter<kaushalmodi> because Nim resolves type of each arg, one at a time?
19:02:10Araqno.
19:02:24FromGitter<kaushalmodi> oh well, was worth a try
19:02:30FromGitter<kaushalmodi> I was looking at https://github.com/nim-lang/Nim/blob/master/lib/core/macros.nim#L1431-L1432
19:02:49FromGitter<kaushalmodi> and thought that breaking down in that for loop was important
19:03:19*narimiran joined #nim
19:03:19Araqno, that is the "why unpackVarags cannot be template" lesson
19:05:53Araqany takers?
19:07:21*stefanos82 quit (Quit: Quitting for now...)
19:08:41FromGitter<kaushalmodi> I have only understood, not written, just one Nim macro so far
19:08:52FromGitter<kaushalmodi> so I am certainly not a taker
19:09:00*TheLemonMan joined #nim
19:09:03narimiranand i have written, not understood, one macro :D
19:09:51Araqmacros cannot go "up" in the AST, that's why
19:10:21Araqwhen you have f(unpack args) the unpack cannot influence the 'f'
19:11:34Araqthere is no NimNode "kind" that unpack could create to cause f(a, b, c)
19:12:05Araqunless TheLemonMan patches Nim to support nkArgList everywhere
19:12:11TheLemonMannkArgList?
19:12:18TheLemonManhah, you beat me to that
19:12:47TheLemonManthe idea was to use nkBracket everywhere though
19:13:01Araqwhat's the scheme name for this?
19:13:15FromGitter<kaushalmodi> emacs uses `apply`
19:13:18AraqI forgot but iirc it has the same
19:14:10TheLemonManapply
19:14:23FromGitter<kaushalmodi> https://www.gnu.org/software/emacs/manual/html_node/elisp/Calling-Functions.html
19:14:54Araqnot what I meant
19:15:10AraqI thought scheme has its own variant of nkArgList
19:15:49TheLemonMan...a list? scheme has nothing but lists
19:16:40TheLemonManand no argument lists, you just have curried lambdas taking a single argument :)
19:19:38AraqI was sure at least Clojure had the same but I'm unable to find it
19:19:45Araqso it was probably just a dream
19:28:27FromGitter<Quelklef> Araq, is there any possibility if allowing args to climb up the AST in the future?
19:28:40FromGitter<Quelklef> I understand that the idea in and of itself is kind of ugly
19:28:52Araqunlikely
19:28:55FromGitter<Quelklef> Since it breaks the nice recursive and "clean" structure of trees
19:28:58FromGitter<Quelklef> Darmn
19:29:09FromGitter<Quelklef> It'd allow for some really cool stuff
19:29:39Araqwell never say "never" but I think it would be too much
19:29:45*zachk joined #nim
19:29:49TheLemonManAraq, should `let _ = something` just be rewritten as `=destroy`(something)? (Instead of the usual sink + destroy @ scope end)
19:29:57FromGitter<Quelklef> Yeah, I can understand that
19:30:04*PrimHelios_ quit (Ping timeout: 264 seconds)
19:30:05FromGitter<Quelklef> Maybe an experimental feature? :-)
19:30:16AraqQuelklef: workaround, proc foo() {.mytransf.}
19:30:41FromGitter<Quelklef> Right, but enclosing it in a macro "context" is kinda what I want to avoid
19:30:44AraqTheLemonMan, not in my opinion
19:31:09*zachk quit (Changing host)
19:31:10*zachk joined #nim
19:31:19Araqand I like to settle the scope vs proc end question with a codesize benchmark
19:32:11Araqmy nose says that the table-based exception cleanup code is heavier for scope than it is for proc ends
19:34:21TheLemonMannumbers please, noses have no places in benchmarks heh
19:34:52Araqwell it's 1 exception "safepoint" vs N
19:35:24Araqand I don't have any numbers yet
19:35:47TheLemonManthe `let _` pattern is nice if you only care about the side effects and it may be nice not to have an un-addressable object persist troughout the function
19:36:13TheLemonManI'd expect the cpp codegen to perform much better there
19:36:33AraqI said "code size", not performance
19:37:05FromGitter<kayabaNerve> TheLemonMaan why the hell would you do `let _`? Isn't that just `discard`
19:37:33TheLemonMancode size and performance, I have enough faith in the cpp compiler to be quite smart at compiling those parts
19:37:48FromGitter<kayabaNerve> But isn't it just discard?
19:38:16*dddddd joined #nim
19:38:26FromGitter<kayabaNerve> And wouldn't discard be even better?
19:39:12FromGitter<kayabaNerve> Please correct me if I'm wrong because I do believe you're the superior Nim developer.
19:39:13FromGitter<kaushalmodi> talking about that earlier supposedly `alias` macro, would it look something like this? https://ptpb.pw/c7rS/nim
19:39:19FromGitter<kaushalmodi> can someone help finish it?
19:40:26TheLemonMansure thing, they're equivalent but even `discard` doesn't get rid of the object asap
19:41:09TheLemonMankayabaNerve, you never confirmed if #9357 fixed your problem with threadvars on windows!
19:44:44*joibll joined #nim
19:46:05FromGitter<kayabaNerve> :( Now I feel bad
19:46:23FromGitter<kayabaNerve> It takes me literally around an hour to build on Windows
19:46:41FromGitter<kayabaNerve> And then I need to keep my 0.19.0 build intact
19:47:05FromGitter<Vindaar> @kaushalmodi yeah, that's almost it. All those `# ?? Ident "x"` you can replace by `ident"x"`. Using quote do makes this a little easier to read though
19:47:24FromGitter<kaushalmodi> after that, I got to https://ptpb.pw/lCSc/nim
19:47:29FromGitter<kaushalmodi> but doesn't compile
19:47:42FromGitter<kaushalmodi> error: alias.nim(69, 15) Error: attempting to call routine: 'nnkIdent' ⏎ found 'nnkIdent' of kind 'enumfield'
19:48:37FromGitter<kayabaNerve> TheLemonMan I'll try to get it
19:49:13*Trustable quit (Remote host closed the connection)
19:49:16FromGitter<kaushalmodi> @Vindaar I get `ident` is deprecated
19:49:23FromGitter<Vindaar> You need to either create a tree of a certain node kind (as done in the previous paste of yours for `nnkTemplateDef` for instance), or for some types you can use procs like `newIdentNode` or `newEmptyNode`
19:49:30TheLemonManno worries, take your time as long as you manage to give an answer before 0.20 :)
19:51:10FromGitter<Vindaar> @kaushalmodi Maybe it is. Although the documentation is a little weird regarding that. Under `newIdentNode(string)` it says it's an alias for `ident(string)` so, shrug
19:52:35FromGitter<Vindaar> for a single alias and using quote do, you can do: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ of course it's easy to wrap a for loop for multiple statements (as you already do) [https://gitter.im/nim-lang/Nim?at=5bcf7c0382893a2f3b2b8908]
19:53:35FromGitter<kaushalmodi> @Vindaar that looks so much better!
19:53:40FromGitter<kaushalmodi> let me try that
19:53:52FromGitter<kaushalmodi> so we don't need to dissect each and every identifier
19:54:12FromGitter<kaushalmodi> and expectKind is a special form of doAssert I suppose
19:54:53FromGitter<kaushalmodi> looked at the source, it has a better error message
19:55:05FromGitter<Vindaar> as far as I understand it, if you put a so far unknown identifier into `quote do` it'll just call `genSym` on it. And normal identifiers like `untyped` are just supported
19:56:49TheLemonManquote do takes your expression, wraps it in a template and then expands it in the current scope
19:57:10FromGitter<Vindaar> see, let him^ speak :D
19:58:09FromGitter<Vindaar> I've looked at that at some point, but the details of that compiler code were way over my head at the time
19:58:33FromGitter<Vindaar> (and probably still are)
19:59:01TheLemonManAraq, why do you pack all the temporaries in a `:d` object?
19:59:56FromGitter<alehander42> I remember you could use a different symbol than `
20:00:14FromGitter<alehander42> for quoting, but this seems like something you should do as a last resort
20:00:53TheLemonManyou can, but you're still bound by the rules imposed by the lexer
20:01:32AraqTheLemonMan, there is no good reason, I need to change this
20:01:45Araqwas easier to write it this way
20:01:56FromGitter<kaushalmodi> thanks @Vindaar! This works!! https://ptpb.pw/J40K/nim
20:02:23FromGitter<kaushalmodi> now the only thing.. what should `ident` be replaced with?
20:02:29TheLemonMansuch an object may produce suboptimal code since alignment and stuff come into play
20:02:44Araqyeah, I know it's bad.
20:02:56AraqI also want to change how "sink" parameters work
20:03:20Araqthey should be consistent with everything else, if the compiler cannot prove it's the last read, it copies
20:04:05TheLemonManisn't that the current behaviour?
20:04:47FromGitter<Vindaar> @kaushalmodi once again, glad to help. No idea why, but you always ask the most interesting questions (that I can answer) :D
20:05:49*Jesin quit (Quit: Leaving)
20:05:53FromGitter<kaushalmodi> you are my macro goto guy it seems
20:06:00FromGitter<Vindaar> haha
20:06:06FromGitter<kaushalmodi> btw fixed that warning with ⏎ ⏎ ``` # toWrap = ident(e[1]) # deprecated ⏎ toWrap = newIdentNode($e[1])``` [https://gitter.im/nim-lang/Nim?at=5bcf7f2e6e5a401c2dbc28f3]
20:06:24FromGitter<kaushalmodi> the deprecated syntax was certainly nicer
20:06:37FromGitter<kaushalmodi> Araq: Is there a better way to write the above? ^
20:07:21AraqTheLemonMan, no, it raises an exception MoveError instead. iirc.
20:07:43*Jesin joined #nim
20:08:39Araqhttps://monoinfinito.wordpress.com/series/exception-handling-in-c/
20:08:48Araq/ Loop through each entry in the CS table
20:08:49Araq while (lsda < lsda_cs_table_end)
20:09:07Araqmy way keeps the CS table shorter
20:14:02TheLemonManhow much shorter and how big the impact on the binary size is? That's what matters
20:15:59*Vladar quit (Remote host closed the connection)
20:27:14*xet7 quit (Remote host closed the connection)
20:30:13*xet7 joined #nim
20:30:20FromGitter<yyyc514> hmmm
20:35:53FromGitter<yyyc514> is there an equiv of `` if iw ant to use parseStmt instead of quote?
20:36:14*PMunch joined #nim
20:38:15*nsf quit (Quit: WeeChat 2.2)
20:39:40*narimiran quit (Ping timeout: 264 seconds)
20:43:23AraqTheLemonMan, non-trivial lifetime extension of temporaries in C++ also matters :-)
20:47:33TheLemonManoh, right, it's C++ we're talking about
20:47:46TheLemonManC++17 added even more rules, it seems
20:49:10Araqthe lifetime extension exists for a reason
20:49:23*poopBot joined #nim
20:49:31Araqbut it's not yet clear if we need the same.
20:50:39FromGitter<kaushalmodi> Araq: What does nnk prefixes in macro kinds mean? "n n kind"? But what is "n n"?
20:50:41poopBotPMunch, am back i think i figured out what i need to use for to make gtk window look like i want, anyway i just tryed to nimble install gtk3genui but it crys package not found, i tryed link directly to github installed it bug get erros
20:50:52poopBotexpression cannot be cast to GCallback=proc (){.cdecl.}
20:50:56TheLemonMann node kind
20:51:13poopBoton genui: 8 row, i just compy pasted example
20:51:25FromGitter<yyyc514> how do i convert from time to DateTime
20:51:29FromGitter<yyyc514> utc isn’t seeming to work
20:51:40PMunchHuh, apparently only gtkgenui was added to nimble for some reason..
20:51:45FromGitter<yyyc514> utc(t297493)' has no type (or is ambiguous)
20:51:50FromGitter<kaushalmodi> TheLemonBoy: thanks. What's the first n then?
20:52:23PMunchhttp://ix.io/1pSw
20:52:30PMunchI can install it just fine from direct link
20:52:30TheLemonManNim (I guess)
20:53:01Araq"Nim node kind"
20:53:14TheLemonManthe sk* compiler enum is also exported as nsk* for the macros to use, the N prefix is there too
20:53:41FromGitter<kaushalmodi> Ah oh course thanks
20:53:49Araqthe first N exists so that I can import "macros" within the Nim compiler... :D
20:54:01FromGitter<kaushalmodi> The node type is `NimNode`
20:54:08poopBothmm meybe vscode bugging will try to comple
20:54:31Araqnowadays with semi-pure enums we could just use IfStmt, Asgn etc as enum field names
20:55:40poopBotPMunch, https://hastebin.com/fujonebugi.coffeescript
20:56:09poopBoti can install too from direct link but example shoots erros
20:56:33PMunchpoopBot, that's because it tries to call example.destroy (line 11) but the file isn't named example.nim
20:56:52PMunchTry to change example.destroy to <whatever your nim file is called>.destroy
20:57:04*gmpreussner quit (Ping timeout: 264 seconds)
20:57:09PMunchOr rename destroy to something else and call it without a prefix
20:57:51TheLemonManAraq, "XXX toptree crashes without this workaround. Figure out why" -> it doesn't crash anymore :D
20:57:52poopBotPMunch, lol sorry :)
20:58:26poopBotit was even marked red, tought i stoped at first line of error dident even look next
20:58:33poopBotanyway now it works sorry again
20:58:54PMunchHaha, no problem :)
21:05:48*gmpreussner joined #nim
21:07:57AraqTheLemonMan, the compilation pipeline changed
21:08:04Araqthat's probably why
21:11:33*vlad1777d_ joined #nim
21:12:40*xet7 quit (Ping timeout: 264 seconds)
21:13:27*xet7 joined #nim
21:27:22*PrimHelios joined #nim
21:27:32TheLemonManAraq, that's it, `genOp` creates a nkHiddenAddr with no type
21:28:31TheLemonManyou have to be extra careful and make sure every node you generate has a proper type
21:28:44krux02sombody messed with the internal structure of types and aliases
21:28:58krux02my macros to resolve aliases is now broken
21:29:04krux02it was a lot of work to implement it
21:30:07Araqkrux02, that's bad but why isn't this STILL not covered by tests? they seemed excessive
21:30:28krux02I don't know
21:30:59krux02it used to be when there is a generic T, I can use getImpl
21:31:06krux02now getImpl returns nil
21:31:13krux02nnkNilLit to be precise
21:31:39krux02and from the type kind I know that it is a float32 type
21:32:08krux02I don't get to the symbol int32 anymore
21:33:06krux02maybe there were tests, and they have been "fixed"
21:33:06TheLemonManand you can drop `emptyNode` and replace it with `graph.emptyNode`
21:33:26Araqsure
21:35:11Araqyou also need to fix my DFA
21:35:41AraqI'm sure it's wrong in some subtle fashion, but I couldn't create a test case to break it
21:36:23dom96joibll: nimforum implements auth. It's a little bit rough but might help you out, simply search for usages of the functions exported here: https://github.com/nim-lang/nimforum/blob/master/src/auth.nim
21:36:27krux02well the problem I mentioned isn't the problem I just figured it out, but the problem remains, my algorithm to normalized away the stupid T that I would never need for anything doesn't work anymore
21:36:38Araqthis abstract interpretation pass without explict 'join' opcodes seems doomed
21:37:31krux02what do you mean with 'join'?
21:38:39*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
21:40:09*PMunch quit (Remote host closed the connection)
21:41:36Araqfork+join control flow
21:42:26Araqaka "structured programming" vs "goto"
21:44:18*Arrrr quit (Quit: Arrrr)
21:47:02shashlickAraq: adding -d:mingw to nim.cfg to cross compile from Linux/OSX to Windows easily - will submit a PR if there is no objection
21:53:35krux02yay I fixed it
21:55:26Araqok
21:59:25FromGitter<kaushalmodi> Araq: Delighted to see fork/join lingo here :)
21:59:49FromGitter<kaushalmodi> In SystemVerilog, we use fork/[join/join_any/join_none]
22:04:59FromGitter<kayabaNerve> Can Nim handle C++ Exceptions?
22:05:54FromGitter<kayabaNerve> I'm not saying it can get the exception type or message. I'm saying if I put a C++ call in a `try` statement, and the call throws, will Nim crash or go to `except`? I assume the latter.
22:06:08FromGitter<kayabaNerve> And I wouldn't be surprised if it could get the Exception data.
22:06:45Araqindeed but I don't know the details
22:06:59Araqbut there is interop with C++ exceptions
22:11:12FromGitter<iffy> If I have an Objective-C source file next to my Nim file, how do I include that file? I'm reading this which includes the Obj-C source inline in an emit: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importobjc-pragma
22:12:45*elrood quit (Quit: Leaving)
22:15:20FromGitter<zacharycarter> compile pragma maybe?
22:15:34FromGitter<iffy> Yes, I guess I'm asking which one
22:16:24FromGitter<iffy> (my C, C++ and Obj-C knowledge is very limited)
22:21:18FromGitter<iffy> could I `include myfile.mm` but emit it like in an `emit` pragma?
22:21:31FromGitter<zacharycarter> I'm not sure - I don't think so
22:21:53FromGitter<zacharycarter> I've only done interop with C involving bindings / using the compile pragma once
22:22:07FromGitter<zacharycarter> I'll be quiet and let someone more knowledgeable in that area try to help you
22:22:22FromGitter<iffy> oh, you said "compile" pragma -- you were telling me a specific one. derp
22:23:47FromGitter<iffy> {.compile: "myfile.mm".} seems to do the trick :)
22:23:54FromGitter<iffy> thanks @zacharycarter
22:24:59FromGitter<zacharycarter> np!
22:25:02FromGitter<zacharycarter> glad I could help!
22:44:55FromGitter<iffy> hmm.. well it's close, but doesn't actually seem to work. The docs say that the `compile` pragma is for C/C++ so maybe Obj-C is not supported
22:46:33*poopBot quit (Remote host closed the connection)
22:46:48FromGitter<zacharycarter> damn
23:06:11AraqObj-C is supported, try an .m extension
23:08:32Araqso ... nimpretty is getting into shape, enjoy
23:08:46FromDiscord<treeform> I have started using nimpretty
23:08:57FromDiscord<treeform> its mostly complains about the over 80 line stuff
23:09:33ryuohow does Nim handle other architectures like ARM?
23:09:34FromDiscord<treeform> I guess my code now will conform, I hate this limitation, but I like standardization more...
23:09:45ryuos/does/well does/
23:09:57FromDiscord<treeform> My friend does Pi development in nim.
23:10:15FromDiscord<treeform> He made a docker thing to build nim on the PI everyday.
23:10:31ryuoI see.
23:10:59FromDiscord<treeform> this: https://hub.docker.com/r/monofuel/nim/
23:11:17FromDiscord<treeform> I would say it works "pretty well"
23:11:45*krux02 quit (Remote host closed the connection)
23:32:08*kapil____ quit (Quit: Connection closed for inactivity)
23:50:27FromGitter<iffy> Araq: nim is magical; thank you! (Also, I'll try to come up with a concrete example of {.compile.} with obj-c not working for me)
23:56:05*vivus quit (Remote host closed the connection)