Perl 6 - the future is here, just unevenly distributed

IRC log for #6macros, 2015-07-14

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

All times shown according to UTC.

Time Nick Message
01:25 vendethiel joined #6macros
04:25 vendethiel joined #6macros
05:57 vendethiel joined #6macros
07:10 vendethiel joined #6macros
07:39 vendethiel joined #6macros
08:09 vendethiel joined #6macros
08:36 vendethiel joined #6macros
09:33 vendethiel joined #6macros
10:56 Ven joined #6macros
14:14 vendethiel joined #6macros
14:39 vendethiel joined #6macros
17:52 masak so, I've been thinking.
17:52 masak (it's great that this channel exists, because these are only half-formed thoughts so far, and I don't want to have everyone reviewing them just yet)
17:53 masak hooks per grammatical category
17:54 masak something like "whenever we parse a function (and get a Qtree), also call this user-provided function/macro (which can inspect and manipulate the Qtree)"
17:54 masak among all the things we know we want to do, this wish seems the most straightforward.
17:55 masak my use case is from 007: someone wants to extend `my foo;` declarations to be able to handle type declarations: `my Int foo;`
17:56 masak oh, actually, that's an interesting but slightly too advanced use case to start with.
17:57 masak better to start with [Coke]'s idea of having checked exceptions from the other day. for that to work, some function (like above) would have to inspect each parsed sub to see if it throws a checked exception -- and if it does, make sure that the sub is marked up with an appropriate trait. (or die otherwise)
18:01 vendethiel interesting idea.
18:01 vendethiel that'd be lexically installed?
18:02 masak yes, that makes sense to me. like operators.
18:02 masak ...but exportable.
18:03 masak (disclaimer: 007 doesn't do exports in any form yet. nor does it have modules.)
18:03 vendethiel first thought: is there a way to opt-out from that, say, to generate subs from macros that will not respect this rule?
18:03 vendethiel well, I guess you can generate { no x; our sub ... }
18:04 masak hm.
18:04 masak I'm not sure I see the need. feels like it'd be better if the installed hook regulated what it applied to.
18:05 masak the downstream client code, in a sense, isn't supposed to care how it's being analyzed/mogrified.
18:06 vendethiel hence why I said "for generating a sub inside a macro"
18:06 vendethiel but let's drop that idea for now
18:13 masak ah, ok
18:13 masak don't understand, but will keep in mind that there may be a use case
18:13 masak certainly there are interesting timing issues involved.
18:14 masak for example (like with macros), I think that there should be no retroactive firing of hooks on already parsed things. too messy.
18:15 vendethiel right
18:15 vendethiel still feels like action-at-a-distance somewhat :P
18:15 vendethiel reminds me of jnthn++'s OO:: modules
18:16 vendethiel which used macros to check for the correct state declared in the "class"'s "is state(<...>)"
18:18 masak I'll have to re-check those and compare.
18:19 masak oh, it's definitely action-at-a-distance. so are source filters, though -- and I'd rather use what I'm proposing.
18:19 vendethiel no question here
18:34 vendethiel your "my T $a" seems like a really complicated use-case though
18:34 vendethiel the non-homoiconic syntax bites here
18:52 masak I was thinking about that one a bit more since I suggested it
18:54 masak in the best case, I'd simply like to be able to install a `rule statement:my-typed`, and it gets to compete in LTM with `rule statement:my`.
18:56 masak actually, the bothersome detail there -- and something I haven't quite figured out yet how to solve -- is that such a new rule would generate an AST, but what the rest of the compiler needs is a Qtree.
18:56 masak provisionally, the answer to that is "action methods should generate Qtrees".
18:56 masak oh, and coincidentally 007 does! neat :)
18:58 vendethiel the "AST" should really be the QTee
18:58 vendethiel r*
19:00 masak yeah.
19:01 masak well, the Perl 6 compiler is still allowed to generate something like QAST for later stages. but it shouldn't be user-exposed in the same way.
19:01 vendethiel right.
19:01 vendethiel I think the problem with typed-my is far deeper than that, though.
19:01 vendethiel you need to "install" stuff to handle "=" and all that
19:02 masak yes, I saw that from looking at the current `my`'s action method
19:02 masak basically, it's really hard to do this without incurring quite a bit of code duplication
19:02 masak I've sort of come to accept that
19:02 masak writing it down to the fact that we have no "lore" for how to extend grammars and action classes in this way yet
19:02 masak hopefully we'll get better at it
19:03 masak unlike with classes, there seems to be a much bigger temptation in grammars to open them up and mess around "in the middle".
19:06 vendethiel i'm not happy of where grammars are :)
19:06 masak Perl 6 grammars allow subclassing to extend into new behaviors. but I can't recall ever seeing a successful real example of that.
19:06 vendethiel they're both too far and too close
19:06 masak yeah
19:06 vendethiel example: your generation thingie
19:06 vendethiel I think the same about MMD
19:07 masak MMD I really like.
19:07 vendethiel Oh, I sure do as well
19:07 masak I can see a point where, for the sake of user-induced extensibility, I'd have to let go of the Perl 6 grammar in 007's parser.
19:07 vendethiel but I strongly think it should be first-class.
19:07 vendethiel they*
19:07 vendethiel well no, it. dumb me. it's still MMD i'm talking about
19:08 masak how would MMD look if it were first-class.
19:08 masak ?
19:10 masak you could do a dispatch, get an object from that, and then later use the object to actually call the method found?
19:11 vendethiel something like "match"
19:31 vendethiel I need to code something like "newtype" soon-ish
19:38 vendethiel I'm afraid of string programming etc taking over.
19:38 vendethiel and it seems like Perl6 is bound to see that happen
19:39 masak heaven forbid.
19:45 vendethiel well, that's how it's gonna happen
19:46 vendethiel maybe I should start from another angle?
19:47 vendethiel a context-sensitive template engine
19:47 vendethiel where you can not interpolate strings
19:47 vendethiel a "SafeString"-like thing, where you're sure you can't get XSS'd
19:48 masak good luck.
19:50 vendethiel it's not really about luckj
19:50 vendethiel -j
19:50 vendethiel it's about stopping complaining about how things are, and moving them where they could be, I guess
19:50 masak indeed.
19:51 masak well, good that, then. :P
20:05 vendethiel tough choice.
20:05 vendethiel how could I emulate typeclasses in perl6?
20:07 vendethiel I also don't want people to be scared if I write some kind of "scalaz-perl6", aka "siz"
20:14 masak please be more specific with "typeclasses". are roles with `...` methods enough?
20:19 vendethiel how do you give an implementation "from outside"?
20:20 masak oh, I see.
20:20 vendethiel Haskell has global instances (which leads to many issues)
20:21 vendethiel scala has "import"
20:21 masak only clumsily, I suspect. Adapter pattern and the like.
20:21 vendethiel we can't specialize a role after it's been defined in a module
20:24 masak no; roles are immutable after definition.
20:25 vendethiel exactly. sooo. :(
20:27 masak feels almost like subset types in Perl 6 are closer to what you want.
20:27 masak except they are not very static.
20:29 vendethiel yrzh
20:29 vendethiel yeah*
20:29 vendethiel i'm pretty aware of what subsets can do :P
20:29 vendethiel I've thought about it
20:32 * masak just hopes he can get 007 into a demo-able state in the next few weeks
20:36 * vendethiel checks if his talk has been accepted
20:36 vendethiel "Status Accepted" \o/
20:37 masak \o/
20:37 vendethiel now to write it...
20:38 vendethiel I think I sent you my draft already
20:38 masak I think you did.
23:02 Ven joined #6macros

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