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
Allow native-int enums as speculated by S12 #5299
Comments
From @titsukiSee the following results. perl6 -e 'my Int enum day <Sun Mon Tue Wed Thu Fri Sat>; my day $day = 0;' The above behavior is different from the explanation of the spec page's one. |
From @titsukiP.S. My Perl 6 version is $ perl6 --version On 2016-5月-05 木 18:08:19, cookbook_000@yahoo.co.jp wrote:
|
From @smlsThis doesn't look like a bug to me; just a case where ideas from the synopses did not make it into the language. The synopses are not the "spec", they are just design documents. I also don't see how your assignment could work, considering how enums ended up behaving in Perl 6.c. As you can see from the output of the .^mro introspection method, your enum type inherits from Int, and not the other way around: ➜ perl6 -e 'my Int enum day <Sun Mon Tue Wed Thu Fri Sat>; say day.^mro' A variable with a type constraint for a specific type, cannot be assigned a value of its *parent* type. Furthermore, it looks to me like the example that you cite from S12, is meant to be about *native* types - i.e. "int" rather than "Int". ➜ perl6 -e 'my int enum day <Sun Mon Tue Wed Thu Fri Sat>;' And then some magic could potentially happen with assignments. Alas, native-typed enums apparently did not make it into Perl 6.c at all (the previous example fails with an internal error), and there are no tests related to them in the official test suite (which is the true "spec"): For these reasons, I changed the title of this issue to reflect that it is not a bug, but rather an idea that could potentially be investigated for future Perl 6.c versions. |
The RT System itself - Status changed from 'new' to 'open' |
From @titsukiThank you for your reply !
I'll be careful to this point from now on. On 2016-5月-06 金 05:36:34, smls75@gmail.com wrote:
|
Migrated from rt.perl.org#128076 (status was 'open')
Searchable as RT128076$
The text was updated successfully, but these errors were encountered: