Perl 6 - the future is here, just unevenly distributed

IRC log for #6macros, 2015-04-10

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

All times shown according to UTC.

Time Nick Message
06:56 Ven joined #6macros
08:26 Ven joined #6macros
12:13 Ven joined #6macros
13:15 Ven joined #6macros
13:28 Ven I actually have an "use case" for macros to post here
13:29 Ven It can actually be seen as pretty broad
13:29 Ven but basically, it's the idea of being able to do what C++er do with their templates
13:29 Ven most of what they do, we have bundled in the languages
13:30 masak I don't understand.
13:30 masak do you have a concrete example?
13:32 Ven_ joined #6macros
13:32 Ven_ okay, so, my internet crashed. but thanks lord for ilbot3  ;0
13:32 Ven_ s/0/)/
13:33 Ven_ I'll guess you can't read c++ template craziness?
13:33 Ven_ (or you really don't want to -- and that I'd understand)
13:34 masak somewhere inbetween those.
13:34 masak the more you can phrase the use case as Perl 6 syntax, the better :)
13:35 Ven_ but it's very interesting to see what they've done with their templates.
13:35 Ven_ say, enable_if, thanks to SFINAE (template substitution failure isn't an error)
13:35 Ven_ it's not even SFINAE
13:35 Ven_ it's just ... what they do in template parameter lists
13:36 Ven_ they basically define several template "overloads", each with a different enable_if, and if one enable_if fails, it goes on to the next overload candidate
13:36 Ven_ or just plainly fails
13:36 Ven_ something like
13:38 Ven_ role[::T where is_integral(T)] { constant HAS = true; } role[::T where is_boolean(T)] { constant HAS = true; }; # no other overload = will fail if not integral nor boolean
13:40 Ven_ Okay, so, they're ready to go to insanely great lengths with that
13:40 Ven_ basically, Boost is *the* crazy c++ template library
13:41 Ven_ they had reimplemented *LAMBDAS* using templates
13:41 Ven_ they even invented operator sections (boost.phoenix)
13:42 Ven_ and they have a compile-time parsing algorithm that's faster than most handrolled parsers (boost.spirit)
13:54 Ven_ and so
13:54 Ven_ (I'll just carry on :P)
13:54 Ven_ they built these incredible algorithms
13:54 Ven_ some of those are just made to compile your programs slower (like those I mentioned)
13:54 Ven_ even if, at times, they really can bring lots of runtime speed goodness
13:55 * masak backlogs
13:56 Ven_ but what interests me is *correctness*
13:56 Ven_ I have a very good example in mind, that was reminded to me by some #perl6 chat just now
13:57 Ven_ https://github.com/rbock/sqlpp11
13:57 masak :)
13:57 Ven_ this is what it allows you to do:
13:57 * masak looks
13:57 Ven_ for (const auto& row : db(select(foo.name, foo.hasFun).from(foo).where(foo.id > 17 and foo.name.like("%bar%"))))
13:57 Ven_ this is all statically checked.
13:57 masak cool.
13:57 masak yes, I want us to have things like that.
13:57 Ven_ yeah. imagine that
13:57 masak that seems to me to be a very, hm, Smalltalk sensibility
13:57 Ven_ they built this only with templates. and template templates
13:57 Ven_ and variadic templates
13:57 Ven_ and a good amount of madness =)
13:57 masak "it's just an AST. the interpreter decides what to do with it"
13:59 Ven_ not even an ast in this case
13:59 Ven_ hahaha
13:59 Ven_ they have mpl.monad, which is basically a small, pure interpreter
13:59 Ven_ using templates
13:59 Ven_ because, well, templates can't have side effects (or even variables!)
14:01 masak those C++ people :)
14:02 masak impressive in a deeply scary way
14:02 Ven_ right?
14:02 Ven_ they never stop to know if they should
14:02 Ven_ they just do it
14:02 Ven_ please do look at the sqlpp11 page, tho :)
14:02 Ven_ and remember, there's nothing like method_missing in c++ :P
14:03 masak right, it's all compile-time
14:03 Ven_ BUT in boost.phoenix, you have "things" like "arg1" where you can "lazily-apply" operations
14:03 Ven_ say
14:03 Ven_ filter(range, arg1 % 5 == 0);
14:03 Ven_ this works with boost::phoenix::arg1.
14:04 masak huh.
14:08 Ven_ right?
14:09 Ven_ this is how crazy they are
14:09 Ven_ I want that *power*
14:09 Ven_ but saner. far saner.
14:09 Ven_ basically
14:09 Ven_ I want the ring, without the eye nor the mordor
14:09 masak who doesn't
14:10 Ven_ ;-)
14:10 Ven_ sane people?
14:10 masak this "sane" thing you talk about... it sounds boring :P
14:11 Ven_ i know, right?
14:11 Ven_ I started learning c++ with c++11
14:11 Ven_ i have no idea how "normal" c++ code looks like.
14:11 Ven_ I only know the crazy c++ templates part
14:12 Ven_ (some would argue that "the rest" is C and I (mostly) know the sane part of C
14:12 Ven_ that is, the part without the ASM bits, the overflow behavior and all that, and some other dark and crazy corners)
14:15 masak I think us having total AST read/write access will take us fairly far in this direction.
14:15 masak my main job is to make sure the API for it all is sane and nice to use.
14:16 masak and that we don't step on any huge hygiene mines on the way.
14:18 Ven_ right :)
14:20 Ven_ I really think scala macros are the closest to ours
14:20 Ven_ but I'll stop throwing names around
14:20 Ven_ doesn't give you anything
14:21 masak I've emailed a bit with the scala macros guy
14:22 masak we were both a bit confused about differences in runtime model and terminology
14:22 masak but aside from that, we had a fruitful conversation
14:22 Ven_ oh?
14:23 Ven_ I'd love that to be posted somewhere :D
14:24 masak heh.
14:24 masak not right now, but I'll see what I can do
14:26 Ven_ amazing!
14:26 Ven_ must be very interesting conversations
14:27 masak don't get your hopes up too much
14:28 Ven_ I'm not ;-)
15:48 Ven joined #6macros
20:53 vendethiel joined #6macros
21:03 * vendethiel friendly reminds masak about said email exchanges
21:04 vendethiel but then, it's 11pm, I'm finally home after 14 days of school with crazy times, so I might get some rest first
21:06 masak :)
21:08 vendethiel that, or the last part when 4 people tried to destroy our project that really made me tired at once
21:08 vendethiel "why don't you try nodejs" "ruby sucks" "freenode has as much people talking as twitch" "lol, rails can't scale, even twitter swapped it out" and so on so forth
21:12 masak vendethiel: https://gist.github.com/masak/b269ed2bb30e43ca80a7
21:12 masak tried to clean it up a little as I pasted it
21:12 vendethiel the quasi/hygiene question is interesting
21:12 masak keep in mind that this whole correspondence is from three years ago
21:13 vendethiel oh :P
21:13 vendethiel i'm always late to parties...
21:13 masak with all that means for later insights and stuff
21:15 vendethiel cool beans, als
21:15 vendethiel this guy is a crazy macro guy :P
21:17 masak yeah, I love how he took the time to understand Perl 6's model
21:17 vendethiel right? I expected disdain for perl, gotta admit
21:17 masak some people are suitably open-minded
21:18 vendethiel .oO( I'd love to be one of these )
21:19 masak :P
21:21 vendethiel or those. probably those.
21:21 vendethiel it's funny, the distinction between "this"/"that" and "these"/"those" only became apparent to me when I started learning spanish
21:21 vendethiel (spanish actually has a 3rd variant, tho...)
21:22 masak wicked
21:23 vendethiel .oO( This Guy Learns Something... You Won't Believe What Happens Next! )
21:26 masak :)
21:26 vendethiel masak: did you read that paper, btw?
21:26 vendethiel I feel bad everytime I'm throwing stuff at you
21:26 masak "that paper"? could you be more specific? don't feel bad.
21:26 masak I need to read papers.
21:27 masak I'm not uninterested, just busy-ish.
21:27 vendethiel I know that feeling, but I know I'm slacking as well
21:27 masak today I've been slacking by blogging about heredocs :)
21:27 masak feeling pretty good about that
21:28 vendethiel I read it!
21:28 vendethiel found it on r/perl, actually, totally randomly
21:28 masak I'm kinda veering towards spending 30 minutes on 007's custom-ops branch before going to bed
21:28 vendethiel the paper in the gist you linked me, in the exchange with eugene
21:29 vendethiel also -- I feel bad because it doesn't make sense to give you 34252534 links you can't possibly read
21:29 masak I *think* I read that paper
21:30 masak but I should probably read it again, because I'm probably dumb in a completely different way than I was three years ago
21:30 vendethiel my problem as well!
21:32 vendethiel I think I mentioned it already
21:33 vendethiel I don't know what side effects should be allowed inside macros
21:33 vendethiel probably mutation
21:33 masak mutation, of the program AST?
21:34 vendethiel that one's one of our banes :P haha
21:34 vendethiel no, rather
21:34 vendethiel cross-macros "global variables" mutation.
21:34 masak I see no problem there.
21:34 masak that's already possible, and will remain so.
21:34 vendethiel one use case I found myself having
21:34 vendethiel while writing my ADT.ex macro
21:34 masak this is Perl, after all.
21:35 masak we can't predict the beneficial ways you choose to shoot yourself in the foot... so we allow most of them.
21:35 vendethiel is that I couldn't provide exhaustiveness checking
21:35 vendethiel (since it uses SSA)
21:35 vendethiel I really want exhaustiveness checking.
21:35 masak that deduction wasn't clear to me (SSA => can't exhaustiveness check)
21:36 vendethiel SSA => can't mutate variables => can't store the different alternatives for one ADT
21:36 vendethiel => can't provide a macro that will over exhaustiveness checking
21:37 masak oh, ok
21:37 vendethiel offer*
21:37 vendethiel my brane is really tired, sorry
21:37 masak get thee to bed, vendethiel ;)
21:38 vendethiel maybe I should
21:39 vendethiel I wanted to play some starcraft to feel the weekend,  but at that point I probably won't be able to see my units, hah
21:39 masak :)
21:40 masak starcraft will be there for you tomorrow
21:40 vendethiel oh, sure, everything will, probably
21:43 vendethiel I'll probably just go and read some more of my perl5 book
21:48 masak :)

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