🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku)
Set by lizmat on 23 May 2021.
lizmat weekly: p6steve.wordpress.com/2021/06/09/c...lace-html/ 09:05
notable6 lizmat, Noted! (weekly)
sjn title hints about a category error :-| 09:06
Altreus that's a useful term 09:07
I feel like I'm constantly spotting logical errors in things people do, and I'm always sure I'm not the first one to see this sort of thing but I have no idea how to express it! 09:08
lizmat I'd suggest reading the article 09:32
I guess a better title would have been: "Can writing Raku replace writing HTML" 09:33
do you agree?
Altreus Feels like one of several recent articles that are certainly interesting from an academic/learning exercise perspective, but I'm not sure I'd want to combine these worlds 09:37
TBH this is largely because whenever I write HTML it always turns out to be way more complex than I expected 09:38
lizmat Well, fwiw, Cro and specifically Cro::WebApp::Template *are* combining these worlds 09:39
I guess, starting with Computer Based Training in the late 70s, has made me more aware of the frontend aspects of programs than of the backend :-) 09:40
Altreus I have yet to find a templating system that I actually find helps me to write HTML! 09:43
But this is because most of them are actually *text* processing systems
and none of them acknowledges the structure of HTML and works with it
Altreus This HTML-in-Raku concept could definitely address that 09:43
moon-child I did a little lisp-syntax-ish html templating thing at one point 09:45
unlike other similar things, it didn't have a concept of interpolation. Instead, everything was represented using functions
lizmat What I like about Cro::WebApp::Template, is that it actually all becomes executable code at some point 09:46
moon-child e.g.: [p this [em is] text]. That calls the function 'em' with the word 'is' as an argument, then argues the words 'this ' '<em>is</em>' ' text' to 'p' 09:46
so you can also call normal (computational) functions, but it's completely uniform
lizmat this is essentially what the § term does in the article 09:47
moon-child yes but it's ugly, you have to put quotation marks around everything :) 09:47
lizmat you mean the <html> part ? 09:48
moon-child §<p>(:id<demoFont>, 'Your Message (required)'). There are quotation marks around 'Your Message (required)' 09:49
which makes it more of a pain to e.g. emphasize a single word in long-form prose 09:50
lizmat well, you could e.g. apply markdown semantics on strings in the § handler 09:52
§<p>(:id<demoFont>, 'Your Message (*required*)'). 09:53
or just do:
§<p>(:id<demoFont>, 'Your Message (<em>required</em>)').
perhaps ?
Altreus lizmat: Does that mean there is, in theory, scope for Cro::WebApp::Template to have a "Skip this tag" function? Such that, if you've already started a tag, and later you find it's not required, you can bail on the whole thing? 10:02
This is one of two features I really need any HTML template language to offer me
The other one is a wrap-this-tag-if-condition sort of feature
lizmat well, Cro::WebApp has <?$variable> ... </?> 10:03
but for wrapping something, you'd need two of them atm 10:04
afaik
Altreus: could you give an example, so we're on the same page ? 10:05
Altreus well basically what you said 10:08
I never want to have to do something like [% IF link %]<a ...>[% END %] <whatever> [% IF link %]</a>[% END %] 10:09
I would MUCH rather do <whatever>[% IF link %]wrap <a ...>[% END %]</whatever>
tt2 syntax cos I'm not familiar enough with cro's :) 10:10
But if your template language is for HTML and not just text in general, you can make use of the fact that you can assume a DOM
A good example would be something like: <foreach page><div><span><if page != current_page>wrap <a href="link-to-$page"></if><= page ></span></div></foreach> 10:12
then you get <a><span>page_number</span></a> except for the current page, as is common on many pagination navs
lizmat where does the <a> come from ? 10:13
or did you mean s/a/div ?
lizmat fwiw, I could envision something like: 10:15
<§div $condition>foobar</§> 10:16
generating "<div>foobar</div>" if $condition is true, and "foobar" if it is false
moritz another common thing is: generate an <ul> with a list of <li>s only if my @array is non-empty 10:20
Altreus <div><a><span> really, yeah
lizmat: yes perfect, except this section sign is something I've been holding my tongue about
lizmat that would be <§ul @choices><@choices><li><$_></li></@></§> 10:21
Altreus The first blog post said "it's up there in the <wherever> on your keyboard" and I've not been able to tactfully say "Yeah on your nonstandard Mac layout"
moritz: at least with that, there's only one if wrapping it
lizmat and then only on a standard US Mac layout :-)
Altreus I just have a pet peeve for languages that make me repeat the if to close the tag
<?$variable <ul ...>> # would this look as horrible as I feel it would? 10:22
or, worse, make parsing hard
I'd proritise keeping the parser simple
lizmat moritz: perhaps even better: <§ul @choices><@choices li><$_></@></§> 10:23
making the wrapping of each iteration with <li> </li> more automatics
*s
Altreus <@choices? ul><@choices<> li> 10:24
This <> was a quick placeholder
But the "unpack" idiom from raku felt nice in this context
is that the right term? unpack?
lizmat <@choices></@> is already idiom in CWT for iterationg on @choices
setting $_ on each iteration 10:25
Altreus is there any existing meaning for <$VARIABLE-HERE WORDS HERE>?
lizmat don't think so
Altreus If not then we wouldn't be treading on anything, and the basic meaning would always be to "use WORDS HERE as the HTML tag, and act on it based on VARIABLE" 10:29
I'll ask 10:31
stoned75 n 12:04
MasterDuke34 n+1 12:08
Altreus .. * 12:10
holly_ o.o 12:14
:o| 12:24
Geth ecosystem: stuart-little++ created pull request #592:
Add RakuRename to ecosystem
12:48
ecosystem: eed3caa44f | chirvasitua++ | META.list
Add RakuRename to ecosystem

See github.com/stuart-little/RakuRename
12:55
ecosystem: 766c4adbb9 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | META.list
Merge pull request #592 from stuart-little/RakuRename

Add RakuRename to ecosystem
Geth doc: 54b178d544 | (Stoned Elipot)++ | doc/Type/Num.pod6
Add missing 'method' words
13:46
linkable6 Link: docs.raku.org/type/Num
cnx hi, could sb remind me how to call a method with functional syntax? 15:41
cnx nvm i found it, it's call indirect invocant syntax, but why doesn't `add $*HOME: '.cache'` work? 15:50
moritz how does it not work? what does it do? what did you expect it to do? 16:26
greyrat Is the perf of raku better than perl? 17:05
moritz it always depends on what you do 17:15
there are cases where rakudo is faster than perl 5 (like tight loops with natively typed variables), and things where perl5 wins out hands down, like regexes 17:16
greyrat I was thinking of simple one-liners for data processing (`perl -lpe`) 17:24
It seems perl5 is still best there?
MasterDuke34 probably, raku's startup time is a bit slower than perl's 17:34
Altreus I would expect (he says, carefully) that you are more likely to run across unoptimised Raku than unoptimised Perl5 given an arbitrary thing
program 17:35
jdv compilation and relatedly regexes tend to be slow 17:55
m6locks www.youtube.com/watch?v=Kba9HqqBopA 18:02
colomon o/ 18:33
hi gang, I’m trying to figure out if the behavior I’m seeing in Hash.append is intentional or a bug
m: my %a = a => [1, 2, 3]; my %b = a => [4, 5, 6], b => [7, 8, 9]; %a.append(%b); say %a; %b<a>.push: 100; %b<b>.push: 200; say %a; 18:35
camelia {a => [1 2 3 4 5 6], b => [7 8 9]}
{a => [1 2 3 4 5 6], b => [7 8 9 200]}
colomon basically, when you do the append, if the original hash already has a member, then the values from the appended version are just pushed onto the existing array in the original. But if the original doesn’t have a member, the new member you get is just the original array. 18:37
I think I can work around it by prestaging, just wondering if I should have to or not; to me, the current behavior feels very inconsistent. 18:38
Altreus I guess the worst part of that is that the b array is copied by ref 18:39
codesections I'm not sure I followed, but aren't you describing the difference between .push and .append? 18:40
colomon @codesections nope 18:41
codesections m: say ^10 .grep: (:is-prime)
camelia (2 3 5 7)
colomon well, actually I think with push it would explicitly be a ref in both cases?
codesections rw
Altreus colomon: I guess I'm not sure what you want it to do 18:42
colomon I don’t want to have some of the arrays add their values and others a ref to the array 18:43
Altreus so the ref thing is the problem, not the recursive append? 18:44
colomon I don’t think it’s recursive?
Let me see if I can make a gist example which is clearer.
(we can still use evalbot with gists, right?) 18:45
m: gist.github.com 18:46
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3https:7⏏5//gist.github.com
expecting any of:
colon pair
colomon m: gist.github.com/colomon/1588c66596...83ab135fdf
camelia {a => [1 2 3 4 5 6], b => [7 8 9]}
{a => [1 2 3 4 5 6], b => [7 8 9 200]}
colomon The point being, even though I’ve done apparently the samy thing to %b<a> and %b<b>, only the change to %b<b> is reflected in %a, because %b<a> is added by values to %a, while %b<b> is added by ref. 18:47
obviously can be worked around by getting all the keys from %b and making sure they are also there in %a 18:48
but I can’t think of why you’d ever want append to behave the way it does? 18:49
codesections Interesting; I see what you mean 19:01
lizmat colomon: I think that qualifies as a bug 19:07
nine I think the displayed behaviour is consistent both internally and with the specification 19:14
codesections Without weighing in on whether it's a bug, I think you could get the behavior you want with %a.append: %b».clone 19:35
codesections (which is easier than fooling with checking the keys is %a) 19:36
S/is/in/
lizmat afk again&
raydiak do we have a way to search for modules by dependency? or any other way to know how much our modules are being used? noticed one of mine in some code in a conference talk, makes me wonder if I should pay more attention to some of them 20:05
I generally operate under the assumption that I'm off in a corner doing my own thing. If I thought any of it was being used by other people, I'd put more focus in those areas 20:08
MasterDuke34 jmerelo has created river diagrams before 20:15
raydiak any idea where I can see that, or the thing which generates it? even if it's outdated it'd at least be one data point 20:18
[Coke] be nice to get dependency searching on the web interface 20:19
MasterDuke34 i think it was in one of his personal repos. maybe just try looking in github
raydiak github.com/jmerelo shows zero public repos or even activity. maybe he'll see the mention here and chime in the next time he's around 20:23
oh wait, zef has rdepends. is that for installed modules, or the whole ecosystem? 20:24
[Coke] cd 20:24
raydiak seems to be for the whole ecosystem, cool 20:26
Geth doc: 31bad392f4 | (Stoned Elipot)++ | doc/Type/Num.pod6
Add Num.Num
20:27
linkable6 Link: docs.raku.org/type/Num
m6locks MasterDuke34: what about here github.com/JJ 20:29
MasterDuke34 yep, github.com/JJ/raku-river
raydiak cool, thank you 20:30
SmokeMachine Hi there! it seems Perl6::TypeGraph is required by Documentable, but ref can't find it... 20:31
usercontent.irccloud-cdn.com/file/.../image.png 20:32
m6locks aye getting the same error 20:35
raydiak it was renamed: github.com/JJ/Raku-Doc-TypeGraph/c...517cffe0e5
and there is an issue: github.com/Raku/Documentable/issues/155 20:38
thundergnat radiak: I use Image::Png::Portable quite a bit. I originally added the Barnsley fern example from Util's talk. 21:18
thundergnat So it's out in the wild. 21:19
Util_ thundergnat++
thundergnat Oh! hi Util++ Enjoyed your talk. 21:20
Util_ thundergnat: Thanks! I owed you a heads-up that I would be showing your code. I can only plead personal chaos for the failure. 21:21
thundergnat No problem, it's public code on a public site. I'm just glad there wasn't too much to dislike about it. 21:23
It was pretty much just a direct translation of the Perl entry. 21:24
[Coke] Util_: Hi there! 21:27
Looking forward to the next con where I can buy you a coffee or something. :)
Geth doc/real-coercers: 9fc1402f43 | (Stoned Elipot)++ | 2 files
Add Real.{Int,Num,Rat} coercers ref #3782

  ... and remove non-existent Numeric.{Int,Num,Real} ones
21:29
doc: stoned++ created pull request #3896:
Add Real.{Int,Num,Rat} coercers ref #3782
21:30
raydiak thundergnat: thanks for the feedback! I'll have a look at it, make sure it's current, start versioning it properly, all that. Let me know if you have any requests 21:31
thundergnat radiak++ 21:31
raydiak Util++ good talk, I enjoyed it 21:32
thundergnat err raydiak++ (on mobile ) 21:32
[Coke] someone have a link to the talks? 21:33
(are they on YT yet?)
domm www.youtube.com/yapcna 21:34
codesections They were/are streamed live (the last set of lightning talks is going on now)
[Coke] ... that seems like an obvious link now that I see it. Thanks. :) 21:35
codesections and then are posted with a bit of a delay
[Coke] I think we need to agree to pronounce it like R(www.youtube.com/watch?v=gX13o7sovaY) 21:40
SmokeMachine @codesections is there a link to épée? 22:08
raydiak hah, I like it
SmokeMachine that's not slack... sorry...
codesections: is there a link to épée?
codesections There isn't yet. I hope to release an alpha version soon – I had a usable version, but it required you to write too much JS, and I decided to re-do a portion of the API before presenting it in public 22:12
(which is why I wasn't planning to talk about it at the conference)
Util_ raydiak: thanks! 22:22
leont Released the Raku version of my module 30 minutes before my lightning talk, JIT conference-oriented programming 😅 22:40
raydiak m: say Int.does: Numeric; say int.does: Int; say int.does: Numeric; 23:02
camelia True
True
False
raydiak is that right?
codesections Hmm, that doesn't look right. 23:09
m: say int.does: Cool; say int.does: Real
camelia True
False
raydiak I thought maybe it's because Numeric (and Real) are roles composed into parent classes of int, but that shouldn't be it either because this works: 23:11
m: role R {}; class A does R {}; class B is A {}; say B.does: R
camelia True
moon-child a guess: some cheating going on with native types
codesections Maybe it's something to do with the auto boxing for natives
yeah, that
m: my int $i = 1; say $i.does: Numeric 23:12
camelia True
raydiak ah...hm
m: my int $i = 1; say $i.WHAT 23:13
camelia (Int)
raydiak m: my int $i = 1; say $i.VAR.WHAT 23:14
camelia (IntLexRef)
raydiak m: my Int $i = 1; say $i.VAR.WHAT 23:15
camelia (Scalar)
raydiak now I'm in over my head :)