Skip to content

Rework Fable.Core API for multi target  #3513

@MangelMaxime

Description

@MangelMaxime

Hello while fixing #3484,

I took this opportunity to restrict the different target to their own module.

For example, before it was possible to use the JsInterop.import for importing inside of Python or Rust code.

I believe it is better to have a clear and consistent API for the user.

Indeed, we working with Python it is better if the user can do:

open Fable.Core.Python
open Fable.Core.PyInterop
// or open Fable.Core.PythonInterop

Then he knows that everything he has access to is supported. Instead of letting him believe that he can use jsOptions<'T>, exportDefault (because this if valid F# code) and fail at the Fable compilation stage.

There is still a need to move the Attributes to their own target modules for example Fable.Core.ImportAttribute needs to be duplicated as

  • Fable.Core.JavaScript.ImportAttribute
  • Fable.Core.Rust.ImportAttribute
  • Fable.Core.Python.ImportAttribute

I believe doing a rework of Fable.Core would lead to more solid ground for the future of Fable however there is the problem of the JavaScript target.

Indeed, JavaScript target has a lot of package that use the current API and reworking it would lead to a break change in the ecosystem.

For now, I propose to explore a new API design for JavaScript, Python, Rust, PHP, etc. We would mark all the currently non specific target types / functions with Obselete and perhaps in a next major version remove them completely to have a clean base again.

I will work on a base API proposition so we can discuss it and ask feedback from the community.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions