Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 03 2017 15:52
    @dom96 banned @Octopoda7
  • Feb 12 2017 23:57
    @dom96 banned @zzz125
  • Dec 23 2016 19:43
    @dom96 banned @Izrab
From IRC (bridge bot)
@FromIRC
<Araq> as macros are not supposed to look "up" in the syntax tree
<FromDiscord> <mratsim> I don't mind the parallel block
<FromDiscord> <mratsim> it's analyzing what is locals/what is defined in the outer scope that I want to do
<FromDiscord> <mratsim> because what is in the outer scope needs to be packaged in tasks
<FromDiscord> <mratsim> so that it can be shared between threads, or be stealable and so on
<FromDiscord> <mratsim> maybe I missed an obvious solution
<clyybber> if its a block
<clyybber> you could collect all var and let
<clyybber> so all variable declarations
<clyybber> and then to check wether its of an outer scope just check that its not in the previously collected set
<FromDiscord> <mratsim> But I need to design something that collects all symbols used in a block
<FromDiscord> <mratsim> I'm pretty sure it exists somewhere in the compiler that's why I wanted to piggyback on it
<FromDiscord> <mratsim> but for now explicit capture will be fine
From IRC (bridge bot)
@FromIRC
<wink> hello. I just tried choosenim and it fails to build on Ubuntu 18.04 - any ideas? https://gist.github.com/winks/7332db98eceb0678cffb95bf7d3ef0b8
<wink> "use --verbose" is a bit annoying if you have no means to use it.
<lqdev[m]> how can I take an enum in a macro and generate a string with all of its possible values? the enum is provided by the user in a nnkIdent
<lqdev[m]> and the macro is AST-phase (no typed params)
<Araq> lqdev[m], then it's impossible
<Araq> wink, do you have GCC installed?
<Araq> it's the "build-essentials" package for Ubu or something like that
<wink> Araq: yes, 7.4.0
<wink> right. I'll try that one
<FromDiscord> <mratsim> So I will do macros that do the following transformation: https://gist.github.com/mratsim/4d0ccfb89a0cec3fc12ec60eefa720ec
<Araq> strange, try the download from https://nim-lang.org/install_unix.html
<Araq> mratsim: that's my point
<FromDiscord> <mratsim> @lqdev: with getImpl
<Araq> the "variables from outer scope" must all be inside your 'parallel' block
From IRC (bridge bot)
@FromIRC
<FromDiscord> <mratsim> they are available, but they are not defined in there.
<FromDiscord> <mratsim> anyway I'll go with that for now
<FromDiscord> <mratsim> now I just need to find a name, parallel_for is verbose, parfor is strange, forEach misses the parallel part
<FromDiscord> <mratsim> ah, I could use for loop macros for in in parallel(0..10)
<disruptek> race
From IRC (bridge bot)
@FromIRC
<lqdev[m]> @mratsim not possible, I can't have typed parameters
<lqdev[m]> but I found a workaround
<clyybber> mratsim: Collecting all symbols in a block is not that hard, just recurse to nnkVarSection/nnkLetSection
<lqdev[m]> did this for the time being, maybe it can be improved somehow https://github.com/liquid600pgm/euwren/blob/162d4a680247fb7c2b13cb9eff8a6b6081d88507/src/euwren.nim#L884-L901
<FromDiscord> <mratsim> @clyyber, I know, I wrote the freshIdent macro that is used everywhere in sugar 😉
<FromDiscord> <mratsim> I just don't like reimplementing the compiler as macro
<disruptek> something we need to get used to.
<FromDiscord> <mratsim> explicit capturing also has benefits on safety and also on not copying consts
From IRC (bridge bot)
@FromIRC
<lqdev[m]> any ideas on how I could implement the syntax for this? liquid600pgm/euwren#4
<lqdev[m]> I was thinking about creating a [static] attribute, but then I remembered that's a keyword -_-
<FromDiscord> <mratsim> you can use [static] with quote
<FromDiscord> <mratsim> quotes allow you to use keywords
<FromDiscord> <mratsim> very useful for the block keyword and C interop
<lqdev[m]> yeah, but it looks pretty ugly
<lqdev[m]> maybe [exStatic] for 'explicit static'?
<FromDiscord> <mratsim> ecstatic
From IRC (bridge bot)
@FromIRC
<FromDiscord> <mratsim> or just CT?
<FromDiscord> <mratsim> or if it's for a constant, use constant or immut