🦋 Welcome to the IRC channel of the core developers of the Raku Programming Language (raku.org #rakulang). This channel is logged for the purpose of history keeping about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Logs available at irclogs.raku.org/raku-dev/live.html | For MoarVM see #moarvm
Set by lizmat on 8 June 2022.
00:51 buildable6 left 00:53 buildable6 joined 01:53 buildable6 left 01:56 buildable6 joined 02:56 buildable6 left 02:58 buildable6 joined 03:58 buildable6 left 04:01 buildable6 joined 04:05 hythm joined 04:13 buildable6 left, buildable6 joined 05:01 buildable6 left 05:04 buildable6 joined 06:04 buildable6 left 06:05 buildable6 joined 06:11 hythm left 07:05 buildable6 left 07:07 buildable6 joined 07:11 buildable6 left, buildable6 joined 08:07 buildable6 left 08:10 buildable6 joined 08:36 sena_kun joined 09:10 buildable6 left 09:13 buildable6 joined 09:17 buildable6 left, buildable6 joined 10:13 buildable6 left 10:15 buildable6 joined 11:00 melezhik joined 11:05 melezhik left 11:15 buildable6 left 11:17 buildable6 joined 11:21 buildable6 left, buildable6 joined 12:17 buildable6 left 12:20 buildable6 joined
tbrowder__ on #raku i pointed out my problems with using try on an exception in $?DISTRIBUTION when it is installed. my question is: is that a bug in zef (one of its many modules) or raku? 12:31
Geth rakudo/main: bd53ad250a | (Elizabeth Mattijsen)++ | src/core.c/Unicode.rakumod
Add test for Unicode 15.1

Doesn't actually change anything, apart from when MoarVM supports Unicode 15.1, then no changes will be needed here anymore.
Test based on the fact that 15.1 added a
... (5 more lines)
13:14
13:20 buildable6 left 13:21 buildable6 joined 14:21 buildable6 left, buildable6 joined 14:32 buildable6 left, buildable6 joined 14:43 buildable6 left, buildable6 joined 14:45 codesections1 joined 14:55 codesections1 left 14:56 codesections1 joined
tbrowder__ if this is a bug, i will create a PR for a suitable test 15:11
ugexe tbrowder__: i dont think there is a bug 15:20
i suspect you are misunderstanding how error handling works 15:21
you say you pointed out your problems, but you've only stated that you are having problems
15:21 buildable6 left
ugexe you haven't pointed out what the actual problem is. what is the text you are seeing, what are you expecting to see 15:22
tbrowder__ probably :)
ugexe i think you should create a suitable test *on your demonstration repo* 15:23
write a test for your repo you think should pass, but it doesn't
15:23 buildable6 joined
ugexe note you will have to test via `raku t/name-of-test.rakutest` since you want to use the installed version of whatever module you would be testing, and not -Ilib 15:24
tbrowder__ what i am seeing is the raku error msg when i expect it to be hidden as i have shown 15:33
m: try { die “bad” } // say “failed” 15:34
camelia failed
tbrowder__ that’s from the docs
ugexe what error message 15:35
this is why i asked for a test
are you sure it isn't a warning message for instance?
m: say ~Any 15:36
camelia Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.

in block <unit> at <tmp> line 1
ugexe for example
tbrowder__ ah, maybe. let me go to a real terminal and i’ll paste it here. back in a few 15:37
ugexe if its a warning you can do
return so quietly try $?DISTRIBUTION.content($path) 15:38
return so quietly try $?DISTRIBUTION.content($path).open(:r:).close
15:38 codesections1 left
tbrowder__ here it is: 15:39
www.irccloud.com/pastebin/XUH0EKcG/
ugexe yeah, i think you need to create a script or test to show how you are getting that 15:40
there is at least a warning in there
i dunno if the last line is a real exception or part of the warning
oh the last line is from your script 15:41
so yeah you are seeing a warning
there is no exception
return so quietly try $?DISTRIBUTION.content($path).open(:r:).close
use that
tbrowder__ the last line is from my sub and, as i thought, should be the only message'
ugexe quietly will hide the warning. the warning itself could/should be worked around in core though 15:42
but yeah just use `return so quietly try $?DISTRIBUTION.content($path).open(:r:).close` and you'll get the result you want
tbrowder__ ok that works, "quietly" is the trick! thanks. gotta check the docs 15:46
"runtime" warnings!! 15:47
so a runtime warning appears to be a failure 15:48
at least it causes that without the try block 15:49
hm...
ugexe no 15:50
the try block eats the exception from trying to open a non-existent file
or failure or whatever
you can't expect to try and open a non-existent file and not get a failure/exception
tbrowder__ but i don't see the "eating" that's part of my giant confusion 15:51
ugexe yes you do
you are conflating a warning message and an exception message
and it is entirely possible for both to occur
m: "non-existent-file".IO.add(Any).open(:r) 15:52
camelia Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
in block <unit> at <tmp> line 1
Failed to open file /home/camelia/non-existent-file: No such f…
ugexe that is one warning and one exception
m: try "non-existent-file".IO.add(Any).open(:r)
camelia Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
in code at <tmp> line 1
ugexe just the warning
m: quietly "non-existent-file".IO.add(Any).open(:r) 15:53
camelia Failed to open file /home/camelia/non-existent-file: No such file or directory
in block <unit> at <tmp> line 1
ugexe just the exception
my examples even emulate the source of the warning and exception you would see 15:56
no need to involve $?DISTRIBUTION
the reason you see a warning only when installed is because installed and non-installed distribution use a different distribution class, and the installed one doesn't check for definedness in a spot it should. but that will only result in a warning, not an exception 15:59
tbrowder__ M: try { quietly "non-existent-file".IO.add(Any).open(:r) } // say "bad atempt"
m: try { quietly "non-existent-file".IO.add(Any).open(:r) } // say "bad atempt"
camelia bad atempt
16:00 vrurg_ joined
tbrowder__ ok, so no problem handling it in either case, then. 16:00
16:01 vrurg left
tbrowder__ but doesn't this example at least warrant more detail in the docs 16:01
ugexe i don't think the docs should tell users when to handle warnings and exceptions for every possible type/method/etc 16:05
as a user you should understand what exceptions and warnings are. and then when you see them you handle them based on generic documentation on warnings and/or exceptions 16:06
take for instance my earlier examples that don't use $?DISTRIBUTION at all... should those also tell users e.g. they potentially need to handle exception and warnings? 16:07
Geth rakudo/ugexe-patch-1: 3d180e8839 | (Nick Logan)++ (committed using GitHub Web editor) | src/core.c/CompUnit/Repository/Installation.rakumod
Don't emit warnings when trying to access non-existent file
16:08
rakudo: ugexe++ created pull request #5450:
Don't emit warnings when trying to access non-existent file
ugexe there is a pull request to get rid of the warning 16:09
admittedly it would be kind of neat if every method listed all the possible exceptions it could throw 16:18
tbrowder__ i'm not arguing. but clear examples greatly help us regular raku users. the try/catch area is not for the faint-hearted! 16:22
thanks for your help!
16:23 buildable6 left 16:24 buildable6 joined
lizmat nine ab5tract_ it feels like RakuAST::Package should be more like a base class, than having all sorts of special checks built in? 17:21
in other words: declarator should not be an attribute, but a subclassable method ? 17:22
17:24 buildable6 left 17:27 buildable6 joined
ab5tract_ Lizmat: I have thought the same thing. I’m not sure if there is a strong reason to keeping it this way 17:29
lizmat then I will endeavour to streamline it
m: class A { method a() { $!a } } 17:30
camelia ===SORRY!=== Error while compiling <tmp>
Attribute $!a not declared in class A
at <tmp>:1
------> class A { method a() { $!a } }⏏<EOL>
lizmat m: say Q|class A { method a() { $!a } }|.AST
camelia RakuAST::StatementList.new(
RakuAST::Statement::Expression.new(
expression => RakuAST::Package.new(
declarator => "class",
name => RakuAST::Name.from-identifier("A"),
body => RakuAST::Block.new(
lizmat m: say Q|class A { method a() { $!a } }|.AST.EVAL 17:31
camelia No $!a attribute in A
in any IMPL-EXPR-QAST at src/Raku/ast/variable-access.rakumod line 258
in any IMPL-TO-QAST at src/Raku/ast/expressions.rakumod line 42
in any IMPL-TO-QAST at src/Raku/ast/statements.rakumod line 545
in any IMPL-TO…
lizmat is what brought me there
17:31 buildable6 left, buildable6 joined
lizmat which is the only remaining test fail in t/spec/integration/role-composition-vs-attribute.t 17:33
18:27 buildable6 left 18:30 buildable6 joined
Geth rakudo/main: c727c2ae0e | (Elizabeth Mattijsen)++ | src/Raku/Actions.nqp
RakuAST: check for MONKEY-TYPING when augmenting
19:01
lizmat 976 +1 :-) 19:02
19:30 buildable6 left 19:32 buildable6 joined 20:09 melezhik joined 20:14 melezhik left 20:32 buildable6 left 20:33 buildable6 joined 21:33 buildable6 left 21:36 buildable6 joined 22:36 buildable6 left 22:38 buildable6 joined 23:08 hythm joined 23:14 hythm left
Geth rakudo/main: 4a5e0181e4 | (Elizabeth Mattijsen)++ | 2 files
RakuAST: remove ::Package::Augmented

Instead, add a $!augmented attribute to ::Package and adapt the necessary logic to cope with being an augmented class.
This should make it possible to subclass ::Package for specific types of packages, such as classes and roles.
23:34
23:38 buildable6 left 23:39 buildable6 joined 23:46 buildable6__ joined, buildable6 left 23:47 sena_kun left