You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
[@gavinking] Currently the only way you can assign a value to a dynamic interface type is by assigning an expression with no type within a dynamic block on JavaScript.
It was suggested here that we let you assign a typed expression, performing a structural type check. For example:
I don't see a very good reason to not allow this. The work for structural checking of schemas basically parallels the stuff @quintesse already had to do for native, so it's a problem we've already bitten off.
A change we would have to make would be to disallow runtime type checks like is Named, which currently merely evaluate to false. They should be disallowed at compile time.
To be clear: this would amount to Go-style structural typing.
Then, two completely unrelated types would be subtypes of Foo if they are subtypes of {Anything*} and the type of their member first is a subtype of String...
No, I don't think we should allow that because there are some things that you can do with / assume about ordinary interfaces that you can't do with / assume about dynamic interfaces.
[@RossTate] I admit, I don't know what Go does. If they do, the challenge I pointed out is much easier for them, since they're type system is much smaller.
[@gavinking] Currently the only way you can assign a value to a
dynamic
interface type is by assigning an expression with no type within adynamic
block on JavaScript.It was suggested here that we let you assign a typed expression, performing a structural type check. For example:
I don't see a very good reason to not allow this. The work for structural checking of schemas basically parallels the stuff @quintesse already had to do for
native
, so it's a problem we've already bitten off.A change we would have to make would be to disallow runtime type checks like
is Named
, which currently merely evaluate tofalse
. They should be disallowed at compile time.To be clear: this would amount to Go-style structural typing.
[Migrated from ceylon/ceylon-spec#1400]
The text was updated successfully, but these errors were encountered: