notviki | m: say now - 1 | 01:42 | |
camelia | rakudo-moar a96292: OUTPUT«Instant:1482198165.690788» | ||
notviki | m: say now-1 | ||
camelia | rakudo-moar a96292: OUTPUT«===SORRY!=== Error while compiling <tmp>Undeclared routine: now used at line 1. Did you mean 'not', 'HOW'?» | ||
notviki | m: say rand - 1 | ||
camelia | rakudo-moar a96292: OUTPUT«-0.950830785771641» | ||
notviki | m: say rand-1 | ||
camelia | rakudo-moar a96292: OUTPUT«-0.833198465193581» | ||
japhb | .tell ugexe I'm switching over from panda to zef in my "rebuild the world" scripts, and I'm running across a testing problem. When a test crashes with a compile time error (===SORRY!===) such as a missing include, zef's testing framework reports 'No subtests run' and then 'All tests successful.' and later 'Testing [OK] for <dist>'. An example of this is the tests for META6. | 02:24 | |
yoleaux2 | japhb: I'll pass your message to ugexe. | ||
ugexe | japhb: does that happen if you run with --/tap-harness? I'm guessing its a bug with TAP::Harness6 - if that option works that would confirm | 03:33 | |
yoleaux2 | 02:24Z <japhb> ugexe: I'm switching over from panda to zef in my "rebuild the world" scripts, and I'm running across a testing problem. When a test crashes with a compile time error (===SORRY!===) such as a missing include, zef's testing framework reports 'No subtests run' and then 'All tests successful.' and later 'Testing [OK] for <dist>'. An example of this is the tests for META6. | ||
japhb | .tell ugexe Good catch; --/tap-harness fixes the problem (which is to say that it correctly fails the tests on a compile-time error). | 04:22 | |
yoleaux2 | japhb: I'll pass your message to ugexe. | ||
japhb | .tell ugexe As a side note, the backtrace of zef itself after "Aborting due to test failure: META6:ver('0.0.11'):auth('github:jonathanstowe') (use --force to override)" just seems confusing, not terribly helpful to the end user (maybe only show it with a debug option? | 04:24 | |
yoleaux2 | japhb: I'll pass your message to ugexe. | ||
ugexe | reverted zef back to using perl5 prove as the default tester | 04:45 | |
yoleaux2 | 04:22Z <japhb> ugexe: Good catch; --/tap-harness fixes the problem (which is to say that it correctly fails the tests on a compile-time error). | ||
04:24Z <japhb> ugexe: As a side note, the backtrace of zef itself after "Aborting due to test failure: META6:ver('0.0.11'):auth('github:jonathanstowe') (use --force to override)" just seems confusing, not terribly helpful to the end user (maybe only show it with a debug option? | |||
[Tux] | This is Rakudo version 2016.12-37-ga96292882 built on MoarVM version 2016.12 | 07:17 | |
csv-ip5xs 3.152 | |||
test 13.425 | |||
test-t 6.145 | |||
csv-parser 14.028 | |||
samcv | [Tux], help | 07:53 | |
[Tux] | how? | ||
samcv | oh you aren't a bot? | ||
[Tux] | nope | ||
samcv | oh ok | ||
well not hard to see why, you always say the same thing at like intervals of whatever time :P | 07:54 | ||
samcv waves | |||
lizmat | Files=1155, Tests=53962, 197 wallclock secs (11.21 usr 4.74 sys + 1187.30 cusr 125.45 csys = 1328.70 CPU) | 08:45 | |
and good morning, #perl6-dev! | 08:46 | ||
DrForr waves. | 08:50 | ||
lizmat | news.ycombinator.com/item?id=13216924 # labster's advent post on HN | 08:58 | |
m: my @a <== 0..Inf; dd @a # this feels incorrect to me, am I right ? | 09:22 | ||
camelia | rakudo-moar a96292: OUTPUT«Array @a = []» | ||
lizmat | Zoffix: re rakudo.org/2016/12/17/lexical-module-loading/ , added it to the list of things nine did last week | 09:26 | |
$ 6 'my @a <== 0..Inf' | 09:27 | ||
Cannot push a lazy list onto a Array | |||
is more what I expected. jnthn notviki moritz ^^^ opinions ? | |||
moritz | sounds OK | 09:28 | |
timotimo | lizmat: but the advent post is by tadzik :) | 09:29 | |
lizmat | aaaaahhhhh | ||
oops | |||
why doesn't it say "tadzik" as the author then :-) | |||
labster was the one who posted it on HN | 09:30 | ||
timotimo | "ttjjss" is also the name of his own blog | 09:31 | |
lizmat: but awwaid didn't post the thing to HN either ... it was labster :) | 09:34 | ||
i suggest a nice cup of tea :) | 09:35 | ||
lizmat | eh... where did I say it was awwaiid ? | ||
tadzik | yeah, my wordpress username is different | 09:41 | |
lizmat | tadzik++ # elves :-) | 09:45 | |
afk& | |||
timotimo | um, you didn'. | 09:46 | |
i suggest a nice cup of tea for myself, then | |||
jnthn chuckles at [Tux] passing the inverse Turing test in the backlog :) | 09:52 | ||
tadzik | :D | 09:57 | |
notviki | samcv: don't believe him! That's what all bots want you to think! | 11:46 | |
samcv | !!! | ||
notviki | lizmat: I know nothing about feeds | ||
mst | FEED ME SEYMOUR | ||
samcv | the bots are taking over | 11:47 | |
lizmat | m: my @a <== 0..Inf; dd @a # jnthn masak this feels incorrect | 11:48 | |
camelia | rakudo-moar a96292: OUTPUT«Array @a = []» | ||
dalek | kudo/nom: 99e33fc | lizmat++ | src/core/Array.pm: Another batch of fail -> throw conversions To prevent a Failure from becoming a one element list. This breaks one spectest: my @a <== 0..Inf This used to "work" (resulting in an empty @a), it now throws: Cannot push a lazy list onto a Array I think the new behaviour is correct and the test is actually faulty. |
11:52 | |
awwaiid | what hmm? | 12:25 | |
oh, I just replied | 12:26 | ||
dalek | kudo/nom: ece2c69 | lizmat++ | src/core/ (2 files): Abstract xx * Seq logic into R:I:RepeatValueIterator Part of an array_slice refactor I'm working on |
12:37 | |
p: 0c9f07f | (Pawel Murias)++ | src/vm/js/ (3 files): [js] Implement nqp::ctxcallerskipthunk and nqp::ctxouterskipthunk. |
13:13 | ||
p: c43f720 | (Pawel Murias)++ | t/qast/01-qast.t: Test nqp::ctxouterskipthunk and nqp::ctxcallerskipthunk. |
|||
kudo/nom: 5d084a7 | lizmat++ | src/core/ (2 files): R:I:RollerIterator should return an Iterator, not a Seq Also use a more general name of source variable, as this should work on any object that has a .roll method. |
13:19 | ||
kudo/nom: af1501a | lizmat++ | src/core/ (3 files): Remove a few is-lazy methods: the default in Mu§ is False |
13:37 | ||
notviki | betlu/L | 13:45 | |
lizmat | znif\O | 13:46 | |
notviki | I guess now/time are keywords and rand does have a sub variant | 14:00 | |
m: say time-1 | |||
camelia | rakudo-moar af1501: OUTPUT«===SORRY!=== Error while compiling <tmp>Undeclared routine: time used at line 1» | ||
notviki | m: say time -1 | ||
camelia | rakudo-moar af1501: OUTPUT«1482242448» | ||
notviki | m: say rand-1 | ||
camelia | rakudo-moar af1501: OUTPUT«-0.671731379135938» | ||
notviki | The, ahem, "kok" token doesn't let keywords be followed by '-' | 14:01 | |
dalek | kudo/nom: ba7be97 | (Jimmy Zhuo)++ | src/vm/moar/ops/perl6_ops.c: Add missing MVMROOT in finddispatcher. |
14:10 | |
kudo/nom: af6c681 | (Jimmy Zhuo)++ | src/vm/moar/ops/perl6_ops.c: use MVMROOT correctly |
|||
kudo/nom: 8998646 | jnthn++ | src/vm/moar/ops/perl6_ops.c: Merge pull request #956 from zhuomingliang/patch-9 Add missing MVMROOT in finddispatcher. |
|||
kudo/nom: bd4e1f4 | lizmat++ | src/core/List.pm: Make sure List.roll always returns a Seq and throws Failures rather than potentially masquerading them as a single element list. |
14:42 | ||
notviki still feels like exploding failures like that severely limits usefulness of Failure mechanism... :/ | 14:57 | ||
m: given Failure.new { .elems.say for .Slip, .kv, .keys, .values, .pairs, .antipairs, .pick, .roll, .iterator, .classify(%), .categorize(%), .rotor(1), .reverse, .combinations, .permutations, .nodemap({;}), .duckmap({;}), .deepmap({;}), .tree }; | 15:02 | ||
camelia | rakudo-moar bd4e1f: OUTPUT«1211111111111211111» | ||
notviki | Are we gonna make all of these throw too? Feels very wrong. | 15:03 | |
lizmat | well, that was my interpretation of TimToady's stance on this | ||
notviki | Yeah, mine too. | ||
And it feels wrong :) | 15:04 | ||
lizmat | there's always rule 2 | ||
notviki | :) | ||
lizmat | notviki: fwiw, the changes don't cause any regressions (except on suspect tests :-) | 15:09 | |
notviki | m: dd Failure.new.duckmap({;}) | 15:10 | |
camelia | rakudo-moar bd4e1f: OUTPUT«(Nil,)» | ||
notviki | Actually the above "all of these" example is not good, some of those return failures and it's just the .elems method that hides them | 15:12 | |
dalek | kudo/nom: 0745ae0 | lizmat++ | src/core/ (2 files): Rename R:I:RepeatValueIterator to UnendingvalueIterator It describes what it does better. With "Repeat" one would expect a fixed number of repetitions |
15:15 | |
notviki | m: use MONKEY; augment class Failure { method elems { self } }; given Failure.new { .elems.say for .keys, .pairs, .antipairs, .pick(5), .roll(5), .iterator, .classify(%), .categorize(%), .rotor(1), .reverse, .combinations, .permutations, .nodemap({;}), .duckmap({;}), .deepmap({;}), } | 15:18 | |
camelia | rakudo-moar bd4e1f: OUTPUT«111151111121111» | ||
notviki | Time will tell, I guess. There's always 6.d :) | 15:19 | |
lizmat | hmmm.... interesting idea | ||
I mean, why don't we let Failure.elems do the throwing ? | |||
notviki | Well, it could just propagate it, but all of the other methods above would need to be added to Failure too, since they return something other than Failure | 15:20 | |
So there's a lot of method adding involved, but we'll maintain the Failure mechanism even for listy things | |||
m: Failure.^mro.say | 15:21 | ||
camelia | rakudo-moar bd4e1f: OUTPUT«((Failure) Nil (Cool) (Any) (Mu))» | ||
notviki | m: Failure.^methods(:all).elems.say | 15:22 | |
camelia | rakudo-moar bd4e1f: OUTPUT«274» | ||
notviki | well, that's the upper bound. Many of them likely work good as is | ||
or generate them automatically during compilatio? method $method-name(|) { self } | 15:23 | ||
lizmat | notviki: that feels getting dirtier and dirtier | 15:25 | |
notviki | hehe | ||
Well, but we made List.roll throw now, so it no longer propagates failures, but the problem is still half-fixed since Failure.new.roll(5) still hides the failure | 15:26 | ||
lizmat | notviki: it does ? | ||
]ah | |||
ah | 15:27 | ||
notviki | m: Failure.new.roll(5).elems.say | ||
camelia | rakudo-moar bd4e1f: OUTPUT«5» | ||
lizmat | ok, sorry, it does... | ||
m: (^Inf).roll(5) | |||
camelia | rakudo-moar bd4e1f: OUTPUT«Cannot .roll from a lazy list in block <unit> at <tmp> line 1» | ||
lizmat | that actually throws now | ||
m: my $a = (^Inf).roll(5) | 15:28 | ||
camelia | rakudo-moar bd4e1f: OUTPUT«Cannot .roll from a lazy list in block <unit> at <tmp> line 1» | ||
lizmat | star-m: my $a = (^Inf).roll(5) | ||
camelia | ( no output ) | ||
notviki | I mean that if you call .roll(5) on something that you think is a list, but is actually a Failure, it doesn't throw. | ||
lizmat | yeah, gotcha | ||
dalek | p: 2302a03 | (Pawel Murias)++ | src/vm/js/nqp-runtime/ (2 files): [js] Implement serialization and deserialization for the NFA repr. |
15:54 | |
p: c624649 | (Pawel Murias)++ | t/serialization/01-basic.t: Test serializing and deserializing a NFA repr. |
|||
ugexe | nine: is there a 1 liner / single file way to demonstrate lexical module loading working? | 16:36 | |
nine | m: { use NativeCall; } my $p = Pointer.new; | 16:37 | |
camelia | rakudo-moar 0745ae: OUTPUT«===SORRY!=== Error while compiling <tmp>Strange text after block (missing semicolon or comma?)at <tmp>:1------> { use NativeCall; }⏏ my $p = Pointer.new; expecting any of: infix infix stopper stat…» | ||
nine | Yep, if it explodes, everything is fine. | ||
notviki | m: { use NativeCall; }; my $p = Pointer.new; | ||
camelia | rakudo-moar 0745ae: OUTPUT«===SORRY!=== Error while compiling <tmp>Undeclared name: Pointer used at line 1» | ||
ugexe | er, i mean I want to show 2 different versions of something being used | ||
nine | oh, thanks notviki | 16:38 | |
ugexe | not sure if thats easily doable without having 2 physical distributions | ||
nine | Err...we'd need something with 2 different versions installed | ||
ugexe | would it theoretically be possible if 2 different Distribution were dynamically generated and loaded? | 16:39 | |
nine | Of course. That would just be a very long 1 liner :) But a cool demo nevertheless | 16:50 | |
japhb | .tell ugexe Current zef seems to be doing the right thing around compile-time test failures, thank you. However, now I'm noticing that zef doesn't seem to be pulling the latest from github for github.com/jonathanstowe/META6 , which specifically includes a fix for the lexical import error I'm still seeing when I do a from-scratch rebuild and reach the `zef install` stage for that module. | 17:04 | |
yoleaux2 | japhb: I'll pass your message to ugexe. | ||
ugexe | japhb: that distribution was updated but the version was not bumped, so the cached copy doesn't know its stale | 17:18 | |
yoleaux2 | 17:04Z <japhb> ugexe: Current zef seems to be doing the right thing around compile-time test failures, thank you. However, now I'm noticing that zef doesn't seem to be pulling the latest from github for github.com/jonathanstowe/META6 , which specifically includes a fix for the lexical import error I'm still seeing when I do a from-scratch rebuild and reach the `zef install` stage for that module. | ||
ugexe | `zef --/cached install META6` should work in that scenario | 17:19 | |
the cache is stored at ~/.zef, so it persists between zef reinstallations | 17:20 | ||
you can also store a copy of the resources/config.json in ~/.zef/config.json to modify the default behavior, such as removing the cache all together. But technically this is the correct behavior given the version number has not changed | 17:24 | ||
japhb | ugexe: Ah, OK, gotcha. | 17:30 | |
That option name sounds funny in my head: "dash dash slash cached" | 17:31 | ||
ugexe | you can change the option name if you want as well heh github.com/ugexe/zef/blob/master/r...g.json#L13 | 17:32 | |
japhb | ugexe: :-D | 17:34 | |
lucasb | lizmat: hi, you don't have a 32 bit machine, per chance, do you? :) | 17:42 | |
I commented in rt.perl.org/Public/Bug/Display.htm...xn-1440487 | |||
^^ with a snippet that segfaults on my 32 bit machine... | |||
I hope someone can confirm it still segfaults on their machine | 17:43 | ||
for 64 bit users, I guess raising the "f(839)" value to something bigger should help trigger the segfault (I forgot to mention this in the comment) | |||
notviki | lucasb: yup | 17:44 | |
"-833 -834 -835 -836 -837 -838 Segmentation fault" | |||
lucasb | notviki: thanks! | ||
noticed the ranges? starts in 839 and segfaults in -838. funny | |||
notviki | Doesn't segfault if I turn off the optimizer | 17:45 | |
with --optimize=off | 17:46 | ||
And adding MVM_SPESH_DISABLE=1 causes it to segfault after -837 | 17:47 | ||
lucasb | hm, interesting. I expected to be something related to the optimizer... | 17:50 | |
it's those kinds of bugs that only triggers after some threshold of iteration or allocation, idk :) | 17:51 | ||
dalek | p: d0b1381 | jnthn++ | tools/build/MOAR_REVISION: Get MoarVM with deep recursion fix. |
17:56 | |
ast: 275f7a2 | jnthn++ | integration/deep-recursion-initing-native-array.t: Test to cover RT #130294. Gets its own test file, because it's rather fussy about actually blowing up prior to the fix. (The first version of this test that took the code directly from the RT was worthless, since adding `use Test` hid the crash!) |
17:57 | ||
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=130294 | ||
notviki | jnthn: would adding a comment inside that file indicating that it should be kept alone be acceptable (as far as repoing the crash goes)? | 17:58 | |
jnthn | notviki: Yeah, that could be a good idea | ||
notviki | 'cause I can see the potential for it being merged into something else one day, since we currently are considering possibility to reorganize the roast some time in the future | ||
jnthn | I don't think that'd do enough to hide it | ||
I can check ;) | |||
Yeah :) | |||
lucasb: heh, what timing...looks like the RT you're looking at is the one I spent a couple of hours hunting down this afternoon :P | 17:59 | ||
notviki | \o/ | ||
jnthn | Just giving it a spectest run before doing a version bump, just in case. | 18:00 | |
Hm, I get a failurein t/spec/S03-feeds/basic.rakudo.moar | 18:12 | ||
Anyone know about that? | 18:13 | ||
notviki | Yup | ||
jnthn: that's from lizmat's change: irclog.perlgeek.de/perl6-dev/2016-...i_13771524 | |||
I don't see the spectest being updated since that comment | |||
lizmat | before updating the spectest, I would like to know if we are in agreement on the test being faulty | 18:14 | |
afk again& | 18:15 | ||
notviki | jnthn: yeah, there was a question on that: irclog.perlgeek.de/perl6-dev/2016-...i_13771060 | 18:16 | |
jnthn | notviki: bah, sto the answer is "we can have a short comment without hiding the SEGV" :P | ||
dalek | ast: 6c23a08 | jnthn++ | integration/deep-recursion-initing-native-array.t: Comment on why a distinct test file. |
||
notviki | \o/ | ||
dalek | kudo/nom: 58c79e2 | jnthn++ | tools/build/NQP_REVISION: Get latest MoarVM. This fixes a bug that affected a handful of programs that do deep recursion, causing GC panics or SEGVs. |
18:18 | |
kudo/nom: e8573e7 | jnthn++ | t/spectest.data: Run deep-recursion-initing-native-array.t. |
|||
lucasb | hehe, jnthn++ :) | 18:33 | |
notviki | confirmed lucasb's test file no longer segfaults with the above fix | 18:34 | |
jnthn | Nice :) | 18:36 | |
lizmat | jnthn: could it be that using a grammar could trigger the deep recursion issue as well | 18:44 | |
? | |||
jnthn | lizmat: Potentially | 18:45 | |
It'd need a large grammar | |||
Note that we didn't encounter this parsing Perl 6 programs. :) | |||
lizmat | true | ||
jnthn | So "yes" but "not immediately likely" | ||
lizmat | so far, I haven't been able to crash HARNESS_TYPE=6 make spectest anymore :-) | ||
5 runs so far | 18:46 | ||
ugexe | the bug i'm seeing with prove6 is when a test does `use Not::Found;` it exits 0. `use-ok('Not::Found')` works as expected | 19:06 | |
lizmat | 10 runs and clean | 19:07 | |
:-( 12th run crashed | 19:16 | ||
so, it feels stabler than it was before | |||
Unhandled exception in code scheduled on thread 15 | 19:17 | ||
No such method 'made' for invocant of type 'TAP::Runner::State' | |||
dalek | kudo/nom: b8df3a6 | jnthn++ | src/core/Backtrace.pm: Fix detection of runtime errors in threads. I can only imagine this must have worked at some point in the past, but it sure didn't now. More odd is that this only showed up some of them time. Anyway, fixed now, and simple programs doing things like `await start die 'foo'` will now not report errors as if they were compile-time. |
19:20 | |
japhb | jnthn: So that bug fix basically translates to "THREAD-ENTRY is a ForeignCode, not a Sub" ? | 19:22 | |
jnthn | japhb: It's more like, nqp::backtrace gives back the raw code refs | ||
Which then get wrapped in ForeignCode | 19:23 | ||
japhb | Ah, gotcha | ||
Yeah, now I get it. | |||
jnthn | Which is a tad wasteful, but if we're rendering a backtrace then I figure it's all over at that point anyway. | ||
otoh I guess we could just be logging it somewhere :) | |||
But that doesn't need this detection either, and the .gist already came out fine. | 19:24 | ||
japhb | That depends if by "wasteful" you mean "takes a few milliseconds" or "takes a couple seconds" | ||
jnthn | The former :) | ||
Which in this context means "can be safely ignored" | |||
japhb | quite | 19:25 | |
jnthn | And probably far less that milliseconds too | ||
Righty, I'm off to cook/eat/relax | |||
Will hunt more bugs tomorrow, including trying to turn the OO::Monitors crash into a test case and see why my attempted fix wasn't sufficient. | 19:26 | ||
bbl | |||
japhb | jnthn: \o/ | 19:33 | |
.ask nine With lexical import, how do you handle the case of A.pm6 uses B.pm6, but at runtime B needs to refer to an our variable in A? | 19:35 | ||
yoleaux2 | japhb: I'll pass your message to nine. | ||
ugexe | perl6 -e 'use Test; my $fake_test_dir = "/tmp/t".IO andthen *.mkdir; my $fake_test_file = $fake_test_dir.child("should-fail.t") andthen *.spurt(q|use Test; use Not::Found; ok 0;|); nok( run($_, $fake_test_file), "Failing test should fail: $_" ) for <prove prove6>;' # prove6 reporting passes for failing tests example | 19:37 | |
lizmat | jnthn: while benchmarking, I ran into a weird thing wrt to Num.floor: while all other entries in the profile are abut the same, the variance on Num.floor is about 2.5x slower | ||
(or faster, whichever way you look at it). | 19:38 | ||
there *are* random numbers involved (100K of them) | |||
so this could also indicate a problem with rand() ? | 19:39 | ||
hnmm... now I even got a factor of 4x slower | 19:41 | ||
dalek | ast: bcec811 | (Zoffix Znet)++ | integration/error-reporting.t: Test broken promise exceptions' backtraces know they're runtime Bug find: irclog.perlgeek.de/perl6/2016-12-20#i_13774176 Rakudo fix: github.com/rakudo/rakudo/commit/b8df3a6131 |
19:43 | |
notviki | ugexe: where's this prove6? | ||
lizmat | tap-harness6/bin/prove6 | 19:44 | |
aka github.com/Leont/tap-harness6.git | |||
notviki | Thanks. | 19:45 | |
ugexe: well, it's here: github.com/Leont/tap-harness6/blob...prove6#L48 | 19:49 | ||
It just checks the failed number and doesn't consider exit code of the program itself, it seems | |||
ugexe | note that the bug itself occurs in rakudo/lib/TAP.pm6 (not the prove6 script itself) | ||
because it happens to zef's interface as well: github.com/ugexe/zef/blob/master/l...ce/TAP.pm6 | 19:50 | ||
oh ha its checkign failed == 0 | 19:51 | ||
notviki | ugexe: seems the bug is in prove6, it's checking number of failed tests only, even tho TAP::Run has exit-code attribute too | 19:52 | |
I mean .exit-status method: github.com/rakudo/rakudo/blob/nom/...P.pm6#L710 | |||
lizmat | afk for some Rogue One | 19:53 | |
ugexe | yeah, i just noticed i used failed == 0 in zef as well whoops | 19:54 | |
gfldex | m: class { method ^name ($) { 'oi‽' } } | 20:10 | |
camelia | ( no output ) | ||
notviki | .ask jnthn should stuff like class { method ^name ($) { "elems" } }; be spectested or is it a Rakudo-only detail? Like overriding the metamodel methods like that? | ||
yoleaux2 | notviki: I'll pass your message to jnthn. | ||
gfldex | îs this ^^^ valid Perl 6? | ||
nine | Serialization Error: missing static code ref for closure 'BUILD' (/usr/share/perl6/sources/C57EBB9F7A3922A4DA48EE8FCF34A4DC55942942:4) | 20:19 | |
yoleaux2 | 19:35Z <japhb> nine: With lexical import, how do you handle the case of A.pm6 uses B.pm6, but at runtime B needs to refer to an our variable in A? | ||
nine | Doesn't sound all that nice :/ | ||
japhb: wait...what?! | 20:20 | ||
japhb | nine: See github.com/ab5tract/Terminal-Print...et.pm6#L46 for a concrete failing example. Terminal::Print uses Terminal::Print::Grid to implement the screen grid, and Terminal::Print::Widget uses Terminal::Print::Grid to implement its own backing grid. A uses C, B uses C, now B wants to refer to a singleton in A. | 20:24 | |
(concrete, and mildly more complex) | 20:25 | ||
nine | japhb: I thought Perl 6 really gave you enough tools, so you wouldn't need global variables anymore... | 20:28 | |
japhb: why isn't this grid thing passed to Terminal::Print::Widget's method? | 20:30 | ||
japhb | The check on that line is checking whether the target grid is the singleton's grid, in which case print to screen by default, otherwise, just composite onto the parent's grid -- it's a DWIM. So the API *does* send the target grid explicitly, but this DWIM functionality is obviously not something you would want to trigger by being explicit, that's the opposite of DWIM. :-) | 20:33 | |
nine | Terminal::Print::Grid could simply have a flag for whether it's the screen grid | 20:35 | |
japhb | Callers of .composite, such as animation controllers, won't necessarily know that any more easily. | ||
nine | japhb: why? Just default it to False and only set it to True in github.com/ab5tract/Terminal-Print...nt.pm6#L86 | 20:37 | |
japhb | nine: Because Terminal::Print can have several grids at once, and at any given time only one is set as current-grid. | 20:38 | |
And sure, I suppose T::P::Grid could add a flag indicating it is currently the screen singleton's current-grid, that seems like the wrong place to put that data, especially as it just screams thread UN-safety to me. | 20:39 | ||
nine | And global variables have been known to be especially thread safe? | ||
japhb | Note that the code I originally linked does a *method call* on that global. | ||
To get the current-grid. | 20:40 | ||
That method call can be made perfectly thread safe, and the global is a singleton that never changes after creation. | |||
I just can't refer to the global singleton at all, which seems wrong. | |||
gfldex | if you provide your own sub EXPORT you can expose anything (I may not have understood what your problem is) | 20:41 | |
japhb | gfldex: Since A uses C and B uses C, I don't know that B can use A without horrible confusion. Perhaps I am wrong in this .... | ||
nine | Put it into D | 20:42 | |
used by both A and C | |||
gfldex | you can do "forward declarations for modules" | ||
japhb | gfldex: You mean like: `package Terminal::Print { ... }` ? | 20:43 | |
gfldex | yes | ||
japhb | Interesting, I didn't know that worked with package decls. | ||
japhb tries that. | |||
gfldex | and if you start with trianglish dependencies you will end up in a world of pain | ||
japhb: err sorry, I ment you can't (I think) | 20:44 | ||
nine | You can but not between files | ||
gfldex | :D | ||
nine | Only for packages (classes, modules) in the same file | ||
japhb | Yeah, first variation didn't work. | 20:45 | |
nine: If I put the singleton in D, and both A and B use both C and D, will A and B see the same singleton? (Meaning, will I accidentally create a doubleton?) | 20:47 | ||
nine | As long as it's initialized at runtime, you should be fine. | 20:48 | |
japhb | Gah, just realized it's even worse: A uses B and C, B uses C. | ||
OK, so this is bringing up a general question for me. In the new lexical imports world, 'use' forms a DAG of reachable imported declarations, with the main program at the root. OK, fine, I get that. But where's the escape hatch if I don't want a DAG, but want a DG instead? | 21:11 | ||
arnsholt | Circular uses have never been possible in Perl 6 | 21:13 | |
I can never remember *quite* why, but it's something to do with one-pass parsing, and allowing circular uses just messes everything up, IIRC | 21:14 | ||
japhb | arnsholt: But in Rakudo they have. | ||
Not circular 'use', circularity in the reachable declaration space. | |||
arnsholt | What do you mean by "reachable declaration space"? | 21:15 | |
japhb | In other words, Rakudo's previous installation of packages into the global namespace allowed any package to reach any other package's "our" declarations just by using going through the global namespace. | 21:16 | |
Even if neither package used the other, just as long as both were used somewhere, at some point. | |||
arnsholt | Ah, right | ||
That use-case | |||
japhb | I'm not saying I want that back by default -- I just want an escape hatch. | ||
arnsholt | use MONKEY-CLAIRVOYANCE perhaps =) | 21:17 | |
jnthn | Putting stuff in PROCESS is probably one such escape hatch | 21:18 | |
japhb | Something like, I dunno, CUR.package('Other::Package') returning a WHO | ||
jnthn: Oh, that's a decent point. | |||
Actually, I guess that wouldn't be CUR but rather CU or somesuch, but you get my general point. | 21:19 | ||
japhb finds temporary relief with PROCESS::<> | 21:25 | ||
It ain't ideal, but it means I don't have to do surgery on ab6tract's design | 21:26 | ||
RabidGravy | I took a quick look at that | 21:27 | |
japhb | jnthn++ # Thank you for the suggestion, it worked: github.com/ab5tract/Terminal-Print...436b3268ac | 21:32 |