Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTA IO::Handle.encoding can have a value, but no valid decoder is setup #2039

Open
zoffixznet opened this issue Jul 9, 2018 · 1 comment
Labels
IO LTA Less Than Awesome; typically an error message that could be better

Comments

@zoffixznet
Copy link
Contributor

zoffixznet commented Jul 9, 2018

http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-07-09#l155

Zoffix | We have a wart in IO::Handle. In its TWEAK, it sets $!encoding, but 
    that alone never sets up decoders
Zoffix | e: with class :: is IO::Handle {}.new { .encoding.say; .print: "foo"}
evalable6 | Zoffix,  rakudo-moar e93032a9a: OUTPUT: «(exit code 1) utf8␤Cannot 
    do 'print' on  a handle in binary mode␤ in block <unit> at /tmp/dbeuXgzaQW line  1␤␤»
Zoffix | probably can restructure and move the decoder creation to TWEAK, with .open not 
    bothering with it if it's already set

This issue has more significance for subclasses of IO::Handle that might not utilize .open calls.

@zoffixznet zoffixznet added IO LTA Less Than Awesome; typically an error message that could be better labels Jul 9, 2018
zoffixznet added a commit to Raku/roast that referenced this issue Jul 9, 2018
Blocked by R#2039 rakudo/rakudo#2039
as without explicitly calling .encoding on handle creation
the character read/write methods explode.
zoffixznet added a commit to Raku/doc that referenced this issue Jul 9, 2018
zoffixznet added a commit that referenced this issue Jul 9, 2018
…before we assume no work is needed. This likely won't be
needed when R#2039 #2039
is fixed to setup the decoder right when encoding is set on creation.
zoffixznet added a commit that referenced this issue Jul 9, 2018
@zoffixznet zoffixznet self-assigned this Jul 9, 2018
zoffixznet added a commit that referenced this issue Jul 11, 2018
…before we assume no work is needed. This likely won't be
needed when R#2039 #2039
is fixed to setup the decoder right when encoding is set on creation.
@zoffixznet
Copy link
Contributor Author

zoffixznet commented Jul 11, 2018

Tried fixing it by setting up the encoder in TWEAK, but then it breaks constructs like IO::Handle.new(:$path).open(:bin), and we could make .open unset the encoder if :bin is provided, but then we're setting up a decoder just to almost immediately throw it away.

A correcter approach might be to not set any options in .new, even if there are attributes. Maybe a long term goal would be to forbid IO::Handle.new calls entirely and require the :$path currently given to .new to be a positional argument of .open

http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-07-11#l201


All of these issues likely apply to IO::CatHandle too, BTW.

@zoffixznet zoffixznet removed their assignment Jul 11, 2018
zoffixznet added a commit to Raku/roast that referenced this issue Sep 15, 2018
There are several indications[^1][^2][^3] that we might want
to remove .new in the future entirely or at least not set up the
encoding until the open call, and this test would interfere with that.

[1] http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-07-11#l201
[2] rakudo/rakudo#2039 R#2039
[3] rakudo/rakudo#2049 R#2049
[4] rakudo/rakudo#2050 R#2050
zoffixznet added a commit to Raku/roast that referenced this issue Sep 15, 2018
There are several indications[^1][^2][^3] that we might want
to restrict functionalities of unopened handles. Remove these
proptests to ensure they don't interfere with that plan in the future

[1] http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-07-11#l201
[2] rakudo/rakudo#2039 R#2039
[3] rakudo/rakudo#2049 R#2049
[4] rakudo/rakudo#2050 R#2050
zoffixznet added a commit to Raku/roast that referenced this issue Sep 15, 2018
There are several indications[^1][^2][^3] that we might want
to restrict functionalities of unopened handles. Remove these
proptests to ensure they don't interfere with that plan in the future

[1] http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-07-11#l201
[2] rakudo/rakudo#2039 R#2039
[3] rakudo/rakudo#2049 R#2049
[4] rakudo/rakudo#2050 R#2050
zoffixznet added a commit to Raku/roast that referenced this issue Oct 28, 2018
ugexe pushed a commit to Raku/roast that referenced this issue Dec 15, 2018
Blocked by R#2039 rakudo/rakudo#2039
as without explicitly calling .encoding on handle creation
the character read/write methods explode.
ugexe pushed a commit to Raku/roast that referenced this issue Dec 15, 2018
There are several indications[^1][^2][^3] that we might want
to remove .new in the future entirely or at least not set up the
encoding until the open call, and this test would interfere with that.

[1] http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-07-11#l201
[2] rakudo/rakudo#2039 R#2039
[3] rakudo/rakudo#2049 R#2049
[4] rakudo/rakudo#2050 R#2050
ugexe pushed a commit to Raku/roast that referenced this issue Dec 15, 2018
There are several indications[^1][^2][^3] that we might want
to restrict functionalities of unopened handles. Remove these
proptests to ensure they don't interfere with that plan in the future

[1] http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-07-11#l201
[2] rakudo/rakudo#2039 R#2039
[3] rakudo/rakudo#2049 R#2049
[4] rakudo/rakudo#2050 R#2050
ugexe pushed a commit to Raku/roast that referenced this issue Dec 15, 2018
There are several indications[^1][^2][^3] that we might want
to restrict functionalities of unopened handles. Remove these
proptests to ensure they don't interfere with that plan in the future

[1] http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-07-11#l201
[2] rakudo/rakudo#2039 R#2039
[3] rakudo/rakudo#2049 R#2049
[4] rakudo/rakudo#2050 R#2050
ugexe pushed a commit to Raku/roast that referenced this issue Dec 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant