Originally created by @HT154 on GitHub (Apr 21, 2025).
It's weird that this does not produce an error:
abstract class Bird {
name: String
}
class Parrot extends Bird {
name = "Polly"
lifespan = (super.lifespan) { // Bird does not define a property lifespan
min = 5
max = 20
}
}
mybird = new Parrot {}
Adding a trace() around super.lifespan indicates this expression has value new Dynamic {}.
This behavior makes sense in dynamic context where the parent may not define properties the child needs to amend, eg.
foo { // this is in module definition context
bar { // this is in Dynamic object body context
baz = true
}
}
// which is syntax sugar for:
foo = (super.foo) {
bar = (super.bar) {
baz = true
}
}
But in a typed context where the full set of properties of the parent is known, attempting to access an unknown property should result in an error like this:
Cannot find property `lifespan` in object of type `bird#Bird`.
Originally created by @HT154 on GitHub (Apr 21, 2025).
It's weird that this does not produce an error:
```pkl
abstract class Bird {
name: String
}
class Parrot extends Bird {
name = "Polly"
lifespan = (super.lifespan) { // Bird does not define a property lifespan
min = 5
max = 20
}
}
mybird = new Parrot {}
```
Adding a `trace()` around `super.lifespan` indicates this expression has value `new Dynamic {}`.
This behavior makes sense in dynamic context where the parent may not define properties the child needs to amend, eg.
```pkl
foo { // this is in module definition context
bar { // this is in Dynamic object body context
baz = true
}
}
// which is syntax sugar for:
foo = (super.foo) {
bar = (super.bar) {
baz = true
}
}
```
But in a typed context where the full set of properties of the parent is known, attempting to access an unknown property should result in an error like this:
```
Cannot find property `lifespan` in object of type `bird#Bird`.
```
We definitely want to improve this, but it's not as simple as "lookup on a Typed should fail". A module is also a Typed, and this syntax should still work:
foo {
res = 1
}
@bioball commented on GitHub (Apr 22, 2025):
We definitely want to improve this, but it's not as simple as "lookup on a `Typed` should fail". A module is also a `Typed`, and this syntax should still work:
```
foo {
res = 1
}
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @HT154 on GitHub (Apr 21, 2025).
It's weird that this does not produce an error:
Adding a
trace()aroundsuper.lifespanindicates this expression has valuenew Dynamic {}.This behavior makes sense in dynamic context where the parent may not define properties the child needs to amend, eg.
But in a typed context where the full set of properties of the parent is known, attempting to access an unknown property should result in an error like this:
@bioball commented on GitHub (Apr 22, 2025):
We definitely want to improve this, but it's not as simple as "lookup on a
Typedshould fail". A module is also aTyped, and this syntax should still work: