Perl 6 - the future is here, just unevenly distributed

IRC log for #6macros, 2017-02-28

| Channels | #6macros index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
02:49 ilbot3 joined #6macros
08:41 * masak backlogs
08:42 masak Ven: IIUC, the splicing you're doing is something like "flatten this array into the quasi", yes?
08:43 masak Ven: the closest thing I've come to thinking about such things is that there should maybe be a looseness/forgiveness between things like ArgumentList and List
09:21 Ven joined #6macros
09:21 Ven masak: no, it's not flattening
09:22 Ven the first "obvious" thing to try would be ,,fields. with the macro called as in: (defstruct! s a b c), then fields is (a b c)
09:22 Ven so, the issue with ,,fields is that the generated code would be ,(a b c) – it sees it as a function!
09:23 Ven .oO( Homoiconicity gone wrong )
09:23 Ven so I need to requote it, that is ,',fields
09:23 Ven (I'm not too sure what you mean by flattening – ,@ ?)
09:23 masak yeah, probably meant that
09:24 masak I still have trouble sometimes reading Lisp quasi/unquoting syntax :)
09:24 masak seems frankly a lot of Lisp's syntax, proportionally, is spent on quasis and unquoting :P
09:26 Ven very true. say fields is '(a b c), then `(progn ,fields) gives (progn (a b c))
09:27 Ven however `(progn ,@fields) is (progn a b c)
09:27 masak right
09:27 masak with you so far
09:27 masak and it *really* helps to see examples like that -- thank you :)
09:27 Ven there's no such thing in our syntax that I'm aware of, which I could assimilate it with
09:28 masak in 007's syntax?
09:28 masak let's put together a use case so we can look at it in terms of 007
09:28 masak I mean, "flattening" might simply not be a thing in 007 because 007 does not do sexprs
09:29 masak oh! but you were talking about re-quoting, not flattening... :)
09:29 masak the ,', thing
09:29 Ven yes. but I think this ,', trick is mostly needed because of how lisp quasiquotes work.
09:29 Ven (as in: no hygiene)
09:29 masak that's my suspicion too
09:29 masak wonder how the same thing manifests in Scheme, then?
09:30 Ven ,fields would not find a "fields" variable, since it'd only look into current-quasiquote-minus-one
09:30 Ven (since each quasiquote level has its own lexical scope "level")
09:32 masak oh, right
09:32 masak not even sure how to render that as a 007 thought :)
09:56 Ven Right.
10:00 Ven One question still.
10:00 Ven quasi { quasi { x } } – how to unquote this one?
10:00 Ven unquote(unquote(a)) ?
10:00 masak I feel like fielding that one to TimToady
10:01 masak but according to his WoG from way back, you can only unquote once in such a situation, and it goes "all the way out"
10:01 Ven augh.
10:01 masak guess you can do more precise things using synthetics
10:01 Ven ?
10:02 masak new Q::Identifier { ... } and the like
10:02 Ven ah, yes
10:03 Ven (which reminds me that I started to work a bit on 007 regex, but with work+projects for school as a teacher+projects for school as a student, I just don't have the time for now)
10:04 masak I might task-steal that soon
10:04 masak as soon as I have the tuits :)
10:04 masak a few cool macro things are blocking on `is parsed`, which is blocking on more fleshed-out regexes
10:04 Ven well, is there any use to a not-fully-unquoted splice?
10:07 masak dunno
10:10 Ven I was thinking of *code walking* (*gasp!*)
10:11 masak go on...
10:11 Ven I was re-reading 50 years of lisp, as I mentioned earlier, and stumbled on codewaling as part of this
10:12 Ven walking*, sorry
10:12 masak nodnod
10:12 Ven the way CL does it is by injecting macros instead of manual code-walking
10:12 Ven so, in no particular order:
10:12 Ven 1) how hard would that be for us with our strict lexical rules?
10:13 Ven 2) does having an actual AST to manipulate (where we know what is what) make it easier to manipulate it correctly than the simplicity lisp has?
10:13 masak re 2, yes, possibly
10:13 Ven case in point for 2): (let ((x x)) x) => if you want to code-walk, you should only replace the 2nd x with whatever it is you want, nothing else
10:13 masak re 1, how hard would what be? injecting macros? or code walking?
10:13 Ven not sure, I'm going to off on 2) for now
10:14 masak I have an issue for code walking: https://github.com/masak/007/issues/26
10:14 masak nothing in theory to prevent us trying it out today in 007
10:14 Ven so, continuing – if we can inject a "lexical reference"(?), this is a non-issue in 007
10:14 masak could you elaborate on "lexical reference"?
10:15 Ven yes, I'm just slow at typing P)
10:15 masak sounds related to the .frame that identifiers have in 007
10:16 Ven because if we do code-walking, inject('x', macro :: { 5 }, quasi { my x = OUTER::x; { my x = OUTER::x; say x; } }) will only replace the first OUTER::x
10:16 Ven by the very definition of our lexical scopes
10:16 Ven (or { quasi x }, I guess. I suppose OUTER::x isn't the best way to examplify it, but it's the closest I have to (let ((x x)) x) in CL...)
10:18 Ven what's to be seen here is that there's a very clear difference between *code walking* ("ast walking" in our case, which is the style most of my pseudo-007 gists use)
10:18 Ven and *replacing an identifier to be a macro in some AST slice* (which is closer to what macrolet is)
10:19 Ven but if "my macro" works, I think `macrolet` already exists in 007
10:21 masak I'm trying to follow the example, but I'm confused
10:21 masak let's focus on "will only replace the first OUTER::x"
10:21 masak why? :)
10:24 Ven because that's how lexical scope works. inject('x', something) ("macrolet") creates a "my x". The subsequent ones don't refer to the same variable – the same lexical "reference"/variable
10:37 masak ok, I provisionally buy that
10:38 Ven so, the (let ((x x)) x) case that's so hard to work with in Lisp doesn't exist for us. Hygiene!
10:44 masak :)
10:53 Ven Code-walking like I usually do in my pseudo-007 gist doesn't seem to offer the same kind of safety however
11:01 masak did you check issue #26? any thoughts?
11:05 Ven looks somewhat like the one I "use"
11:06 masak \o/
11:07 Ven *looks for gists*
11:08 Ven https://gist.github.com/vendethiel/bff772fc084ca88bb253
11:09 Ven one of those
11:53 masak nodnod
15:08 cog_ does any of you has read Lisp in Small Pieces ? Is it any good ? Written by a Fench guy apparently. Cocorico !!
15:09 cog_ oops ven not there :(
15:16 masak I've read about a third of it
15:16 masak it's pretty good
15:19 masak it has all-5 reviews on amazon. I can kind of see why
15:19 masak they also point out that it ain't a beginners' book
15:19 masak I agree with that
15:19 masak I remember liking the early discussions about continuations (in ch3 or so), while my brain was also melting
15:22 masak sheesh. https://news.ycombinator.com/item?id=13754064
15:22 masak oops, ww :)
15:23 masak (except that macros will maybe make you a 100x programmer!) :P
17:16 cog_ yea, the subject is vast. Also, it seems that the new trend is to blend macros with type theory. Scala has many papers way over my head. My height does not help here :(
19:29 Ven joined #6macros

| Channels | #6macros index | Today | | Search | Google Search | Plain-Text | summary