Skip to content

Conversation

@librasteve
Copy link
Contributor

Some of the more recent attribute traits (is built) are not covered in the Objects tutorial. This introduces a new short section to summarize all the available attribute traits (as documented in class Attribute

See this SO question:

https://stackoverflow.com/questions/79836453/instantiating-required-attributes-without-build-submethod/79836679#79836679

Some of the more recent attribute traits (`is built`) are not covered in the Objects tutorial. This introduces a new short section to summarize all the available attribute traits (as documented in `class Attribute`

See this SO question:

https://stackoverflow.com/questions/79836453/instantiating-required-attributes-without-build-submethod/79836679#79836679
@librasteve librasteve requested review from arkiuat and coke December 3, 2025 10:49
@librasteve
Copy link
Contributor Author

not sure why test is failing...

@arkiuat
Copy link
Collaborator

arkiuat commented Dec 3, 2025

not sure why test is failing...

there's a trailing whitespace somewhere for starters. I wouldn't go digging into the other failures until that's corrected.

@coke
Copy link
Collaborator

coke commented Dec 3, 2025

Your example code fails to compile:

class Journey {
    # error if origin is not provided
    has $.origin is required;
    # reset to this default value if Nil is assigned
    has $.destination is default('Orlando') is rw;
    # private attribute
    has @!travelers;
    # is read/write
    has $.notes is rw;
    # is readonly
    has $.agent = 'Acme Travel Inc.' is readonly;
    # private attribute can (only) be set via .new
    has $!status is built;
}

The line with the problem is ‘has $.agent’, fails with Two terms in a row

@coke
Copy link
Collaborator

coke commented Dec 4, 2025

new failing code example - missing a comment before “then”. Need to predeclare Journey at the top of that block with:

=begin code :preamble<class Journey {}>

@librasteve
Copy link
Contributor Author

@coke , @arkiuat - thank you so much for your patience with my errors here - I would never have found that missing # without your help - very embarrassing!

@librasteve librasteve merged commit 61d8402 into main Dec 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants