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
So the Event property is gone. I came across this issue since Python uses interfaces and I get the error: Can't instantiate abstract class ObjectExpr0 with abstract method Event
So the Event is part of the interface, but not part of the implementation. If you implement a class using the interface, then the property will be available.
Thanks for reporting @dbrattli! I need to have a look. Actually I never wanted to add Events to Fable, because I like Observables much better (current support has been mostly done by Krzystof and ncave) so I don't remember all the fitting parts 😅
Hmm, that's the "trimmed down FCS" created by @ncave that we use to self-compile Fable.Standalone. But Fable.Cli doesn't use fable-fcs but a custom build also from ncave's FCS fork (service_slim branch). If we need to generate some code for object expressions implementing Events I assume we have to do it either here (for Fable AST) or here (for Babel/JS AST).
The problem is that the main property seem to have been removed, so it's not that easy to know that you have to re-add it just by looking for the _remove and _add methods. Anyways, consider this low-priority. I'm not using it for anything, just porting more tests to Python.
@dbrattli I'm no expert, but it looks like this is how F# compiler (FCS) works for [<CLIEvent>] properties. In any case, it is not something that Fable is doing or changing.
Can you perhaps just not output (in the interface) any property with [<CLIEvent>] attribute, instead of trying to re-add the property in the object expression? (Technically that should be done for all languages that emit interfaces, so in Rust too).
@dbrattli@alfonsogarciacaro Looks like Dart also generates interfaces, so it has to be fixed there too (to not output [<CLIEvent>] properties in the interface).
I've implemented a fix for this issue and submitted a draft PR.
Root cause: transformInterface in Fable2Python.Transforms.fs generates a Protocol class for each F# interface. FCS exposes a [<CLIEvent>] member as three symbols — the event property (e.g. SomethingChanged), add_SomethingChanged, and remove_SomethingChanged. All three pass the existing not memb.IsProperty filter, so all three become abstract Protocol members. But transformObjectExpr only generates add_*/remove_* methods — never the event property override. This leaves the Protocol with an unimplementable abstract member.
Fix: After collecting interface members, detect event property members by checking whether a companion add_<name> member exists in the same interface. If so, exclude the event property from the Protocol. The add_*/remove_* accessors are retained.
This fix also applies the same filtering to the Dart transformInterfaceDeclaration, as requested by @ncave. The previously commented-out test "test Generic interface expression can have CLI events" in tests/Python/TestEvent.fs has been reinstated.
Note
🔒 Integrity filter blocked 52 items
The following items were blocked because they don't meet the GitHub integrity level.
#4220list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4166list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4143list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4104list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4044list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4038list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#3290list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#2279list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#2154list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4375search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4326search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4224search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4176search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4094search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4082search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
#4080search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
... and 36 more items
To allow these resources, lower min-integrity in your GitHub frontmatter:
Activity
alfonsogarciacaro commentedon Aug 8, 2022
Thanks for reporting @dbrattli! I need to have a look. Actually I never wanted to add Events to Fable, because I like Observables much better (current support has been mostly done by Krzystof and ncave) so I don't remember all the fitting parts 😅
dbrattli commentedon Aug 8, 2022
Yes, the only reference I can find is: https://github.com/fable-compiler/Fable/blob/main/src/fcs-fable/src/Compiler/Checking/CheckExpressions.fs#L2745 Is that where this things happen?
alfonsogarciacaro commentedon Aug 8, 2022
Hmm, that's the "trimmed down FCS" created by @ncave that we use to self-compile Fable.Standalone. But Fable.Cli doesn't use fable-fcs but a custom build also from ncave's FCS fork (
service_slimbranch). If we need to generate some code for object expressions implementing Events I assume we have to do it either here (for Fable AST) or here (for Babel/JS AST).dbrattli commentedon Aug 8, 2022
The problem is that the main property seem to have been removed, so it's not that easy to know that you have to re-add it just by looking for the
_removeand_addmethods. Anyways, consider this low-priority. I'm not using it for anything, just porting more tests to Python.ncave commentedon Aug 8, 2022
@dbrattli I'm no expert, but it looks like this is how F# compiler (FCS) works for
[<CLIEvent>]properties. In any case, it is not something that Fable is doing or changing.Can you perhaps just not output (in the interface) any property with
[<CLIEvent>]attribute, instead of trying to re-add the property in the object expression? (Technically that should be done for all languages that emit interfaces, so in Rust too).ncave commentedon Aug 8, 2022
@dbrattli @alfonsogarciacaro Looks like Dart also generates interfaces, so it has to be fixed there too (to not output
[<CLIEvent>]properties in the interface).github-actions commentedon Apr 3, 2026
fix(Python): filter CLIEvent property from Protocol when using object…
github-actions commentedon Apr 8, 2026
🤖 This is an automated response from Repo Assist.
I've implemented a fix for this issue and submitted a draft PR.
Root cause:
transformInterfaceinFable2Python.Transforms.fsgenerates aProtocolclass for each F# interface. FCS exposes a[<CLIEvent>]member as three symbols — the event property (e.g.SomethingChanged),add_SomethingChanged, andremove_SomethingChanged. All three pass the existingnot memb.IsPropertyfilter, so all three become abstract Protocol members. ButtransformObjectExpronly generatesadd_*/remove_*methods — never the event property override. This leaves the Protocol with an unimplementable abstract member.Fix: After collecting interface members, detect event property members by checking whether a companion
add_<name>member exists in the same interface. If so, exclude the event property from the Protocol. Theadd_*/remove_*accessors are retained.This fix also applies the same filtering to the Dart
transformInterfaceDeclaration, as requested by@ncave. The previously commented-out test"test Generic interface expression can have CLI events"intests/Python/TestEvent.fshas been reinstated.Note
🔒 Integrity filter blocked 52 items
The following items were blocked because they don't meet the GitHub integrity level.
list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: