🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
sampersand makes sense 00:01
let me try to explain it so you dont have to read it through
So to learn new programming languages, i implement this dumb little language I've dubbed `Knight` . I've designed the language spec in such a way that it's easy to implement the language in anything i want. 00:03
summerisle sampersand: are there samples anywhere? 00:03
sampersand So, in Raku, I thought it might be cool to do it with grammar
yeah, i have it implemented in about a half dozen languages by now
summerisle i want to make a lisp-like language that spits out qast to mix with raku 00:04
sampersand <github.com/sampersand/knight/tree/raku> the C, haskell, perl, php, python, ruby, rust, AWK, and posix-compliant SH examples all work 00:04
with the asm, raku, and quest versions each almost done.
sampersand i want to finish the raku version this weekend, complete with comments. (I have only commented the C, php, and perl impls so far...) 00:07
though of the languages ive explored so far, raku's my favourite and the one ill probably continue after my quest is over 00:08
Doc_Holliwood How do we handle this? medium.com/@alex.birsan/dependency...5d60fec610 00:36
Dependency Confusion: How I Hacked Into Apple, Microsoft and Dozens of Other Companies
summerisle i know Zef has to run a build step for native stuff. i suppose that step could be as isolated as possible using something like bwrap on linux, whatever on bsd, etc... 00:39
seeing as the build would need access to system dependencies for headers, libraries, and tooling 00:40
guifa2 .tell Doc_Holliwood we had actually been talking about that for a while. The main thing is ensuring that people use :auth<foo>. IIRC, zef already will only use a github source owned by github user foobar given :auth<git:foobar> 01:33
tellable6 guifa2, I'll pass your message to Doc_Holliwood
guifa2 local libraries via (use 'lib') are also always preferred over. But ugexe is definitely the expert on the topic 01:35
sampersand ok so ive been hacking at this on my own for a while 02:14
but i still cant completely crack it 02:15
so, i have a role `Value`, which everything in Knight implements—numbers, functions, identifiers, strings, everything. Every type has an "assign" method, but it simply convert that type to a string, then an identifier: `= (+ "__ast_" ast_level) 3` . As such, my `Value` type has a function called `assign`: `method assign(Value $value, --> Value) { 02:18
Identifier.new($.Str).assign: $value }` . However, since `Identifier` `use`s `Value`, im getting a circular import
any ideas?
summerisle pretty sure raku doesn't currently have import aliasing (without modifying EXPORT in the desired package), or am I missing something? 06:43
guifa2 summerisle: correct. The author of the package would need to set up a way for things to be aliased 06:46
elcaro summerisle: for a name that gets imported automatically, you can crete your own alias, but of course, the original name is still in your namespace 06:52
eg. my &slfn := &super-long-function-name; slfn('foo')
guifa2 ^^ yeah that's true, I figuerd he wanted to avoid the original and only have the custom one 06:53
elcaro unfortunately, Raku makes it easier to for module writers to pollute the users namespace than do selective imports 06:54
my `Exportable` module attempts to make that easier 06:56
ideally, `is export` should have made subs _available_ for import, and only exported by default when you do `is export(:DEFAULT)`
interestingly, I believe this is how Damian's `Perl6::Export` module for perl5 does it 06:58
guifa2 wishes that the `use` passed *both* positionals *and* named to the EXPORT sub. I think I could od some more interesting things there
elcaro I mentioned this last time this topic came up, but this is all things i complain-blogged about a couple years ago here: 0racle.info/articles/exportation_exploration 06:59
in that article, I also show a hackjob way of doing import aliasing (with the syntax `use Foo \[ foo => 'bar' ]; # imports &foo as &bar`) 07:00
but the EXPORT sub needs to support it, of course
as mentioned in the second part of that article, the "sane" way of supporting aliasing, is to have you subs `our` scoped, and import nothing by default 07:05
summerisle my question comes more from a place of concern about symbol fighting, e.g. if Foo::Bar has `sub frobnicate() is export` and so does Foo::Baz, and I need to include them both - it seems like there will either be some runtime error, or `use` order will become significant.
elcaro `module Foo { our sub bar { ... } }` can be imported as `use Foo; my &foobar := &Foo::bar; foobar(...)`
summerisle other than that, namespace pollution isn't a terrible concern if it's not obtrusive. 07:06
elcaro yeah, it's a problem, but there are work-arounds
since `use` is lexical, you can import inside a block, aliase to a name outside the block
something like `my &foobaz-frob = do { use Foo::Baz; &frobnicate }` 07:07
I think... the syntax is something like that
summerisle well, of course that works
but it's still working around a language semantics issue 07:08
albeit a somewhat theoretical one
elcaro well, yeah, at least there's a relatively simple work around. As mentioned, I really wish implicit exports weren't the path of least resistance... but I think the ship has sailed on any changes to that now 07:09
unless something like `is exportable` (similar to my module) is added to core, and strongly recommended by the community 07:10
summerisle i could see it happening
i'd be more interested in matcher/grammar optimizations though - i should look at the guts for that 07:11
elcaro yes, when I said "ship has sailed" i mean, we can't change the semantics of `is export` now... it's too late, but we can offer a better alternative. it's do-able
summerisle has anyone done a writeup on nativecall overhead? i'd be interested in reading that 07:14
elcaro NativeCall is a bit above my pay-grade. Never wrote C in my life 07:23
summerisle big C fan here 07:32
Doc_Holliwood yawns 16:06
tellable6 2021-02-14T01:33:59Z #raku <guifa2> Doc_Holliwood we had actually been talking about that for a while. The main thing is ensuring that people use :auth<foo>. IIRC, zef already will only use a github source owned by github user foobar given :auth<git:foobar>
tbrowder .ask lizmat can i add my blog test site to planet.raku.org without interfering with your generation of the raku weekly news? 16:39
tellable6 tbrowder, I'll pass your message to lizmat
atroxaper Hello, #raku 16:43
lizmat tbrowder: yup :-)
tbrowder thnx 16:44
atroxaper lizmat: Hello. I wrote a post about howto contribute in Raku (in Russian). Maybe you will want to add it in the weekly. twitter.com/atroxaper/status/13609...4992924674 16:46
lizmat atroxaper: cool, what would be an english title ? 16:47
asking rather than Google mangling it
atroxaper lizmat: Contributing to Raku for the little ones 16:48
lizmat thanks! 16:49
atroxaper ^^ 16:50
guifa2 Jeez. Unit formatting is a LOT more complicated once you get to compound units. This actually might be worthy of a blog post 19:18
perry guifa2, units? I assume you don't mean the mathematical kind? 19:57
SmokeMachine .tell vrurg have you seen the new experimental feature from Red? (github.com/FCO/Red/issues/463#issu...778821143) 20:23
tellable6 SmokeMachine, I'll pass your message to vrurg
SmokeMachine elcaro: have you seen the update for that post? 0racle.info/articles/exportation_e...ion_update 20:31
sorry, I saw the link and sent the message...
vrurg SmokeMachine: thanks a lot! Gonna test it now. I was about to do write a workaround of my own. 21:18
tellable6 2021-02-14T20:23:24Z #raku <SmokeMachine> vrurg have you seen the new experimental feature from Red? (github.com/FCO/Red/issues/463#issu...778821143)
guifa2 perry: the measurement kind. 21:23
perry And unit formatting as in unit typesetting? 21:24
I know a thing or two about that, if so.
guifa2 format-unit(3, 'meter') --> "3 meters"
problem gets when you have something crazy like 21:25
perry Ah.
guifa2 format-unit(4.5, 'kilogram-meters-per-millisecond') or something crazy 21:26
Unicode's devised a system that lets you go pretty crazy, even if the units make no sense
perry :D
guifa2 simple units are easy 21:28
github.com/alabamenhu/IntlFormatUn...t/Unit.pm6
but it'll be a nice blog post because it really can take advantage of grammars 21:29
Unicode provides a grammar that took all of about one minute to convert to Raku's format. Add in some action classes to create some nodes that link back to the original data and boom. Raku makes something complicated easy. 21:30
Trick is I haven't added the grammatical meta data into CLDR yet haha
elcaro SmokeMachine: Yes I saw it... I wrote it! 22:21
SmokeMachine elcaro: yes, of course… I’ve sent the link before really reading that, sorry 22:27
elcaro SmokeMachine: np. Thanks again for your input on that :) 23:07
I still feel foolish for missing the obvious solution 23:08