Skip to content

Latest commit

 

History

History
154 lines (106 loc) · 4.79 KB

major-changes.md

File metadata and controls

154 lines (106 loc) · 4.79 KB

Prev: Quotes
Next: P5P MVP


Section 13: Changes

This file is automatically generated. If you wish to submit a PR, do not edit this file directly. Please edit templates/rfc/major-changes.md instead. Use bin/generate_rfc.pl to regenerate the RFCs.


Due to the fast-moving nature of this project, we won't note every little change to the RFC. You can always clone the repo and read the commits. Instead, we'll cover major changes here.

Change Log

August 17, 2022

  • field attributes are now formally known as attributes. Previously this was ambiguous. The grammar and RFCs have been updated to reflect this.

December 8, 2021

  • Injected $class and $self variables are now documented as being immutable. That prevents this bug:
method foo () {
    $self = 42;
}
  • Class data and methods are agreed to be declared with :common
field $foo :common;              # class data
method bar :common () { ... }    # class method
  • Class data (declared with :common can accept defaults (see the next change) and only allows the :reader attribute with it.

  • Field initialization no longer allows =. You must wrap the default in curly braces (an anonymous sub). This is because of this problem:

field $colors = [qw/blue white red/];

Every $color would get a reference to the same anonymous array. Instead, write it like this:

field $colors { [qw/blue white red/] };

With that, you can change the colors of a particular instance without changing the others. Yes, you could do $foo = [qw/blue white black/]' in a method, but if someone did $foo->[-1] = 'black';, they might wonder why all other instances had their value changed.

We realize this change might seem strange, but we're hopeful people will get used to it.

As of this writing, we do not plan to inject $class or $self into that block. That avoids this bug:

field $color { $self->get_colors };

Because initialization happens when the instance construction might not be complete, some fields may not be properly defined, leading to obscure bugs.

December 6, 2021

  • After considerable discussion, slot has been renamed to field. A few people objected to "slot" because it's an unusual term (borrowed from Lisp). Some non-native English speakers pointed out that "slot" is also harder for them to understand, while "field" is very clear. There was discussion about confusion with the little-used "fields" pragma, but it was generally agreed this would be unlikely.

December 4, 2021

  • We have removed the special :handles(*) syntax. It was proving too problematic and, in fact, would not have allowed us to simulate inheritance because once you enter the delegate, you can't override its methods because it's not in your inheritance hierarchy.

November 23, 2021

  • Clarify that the :handles(*) delegation will not auto-delegate to methods beginning with underscores to avoid those becoming part of the public interface. Of course, internally you can still call those methods directly on the slot variable calling the object.

November 15, 2021

  • After many suggestions from Paul Evans and later by Damian Conway, Corinna has been switched over to KIM (Keyword, Identifier, Modifier) syntax. See also Damian Conway's post on the topic.

November 2, 2021

  • Method modifiers RFC section added.
  • Classes documentation now shows we use any legal version numbers, not just semver triples.

September 22, 2021

  • Abtract methods in classes and required methods in roles are no longer allowed to declare their argument lists. This gives us room to reconsider this behavior post-MVP.

September 21, 2021

  • :name attribute for slots removed from MVP. Might be returned later.
  • Version numbers no longer limited to semver. All current Perl version formats intended to be supported.
  • Classes which both inherit and consume roles must now declare the parent before the roles (previously, the order was not relevant).
  • Method access levels such as common, private, and overrides are now attributes that come between the method name and the argument list:
method foo :overrides ($bar, $baz) { ... }

August 26, 2021

  • Class slots now declared with my. They do not take attributes.

August 19, 2021

  • Slot declaration keyword renamed from has to slot

August 14, 2021

  • First draft of RFC released as markdown in github repo so that pull requests can be received. Wiki is noted to primarily be of historical interest.

Prev: Quotes
Next: P5P MVP