Skip to content

Reconsider FluentResource instantiation #400

Closed
@stasm

Description

@stasm

In fluent 0.12, FluentResource is a subclass on Map. It exposes a static fromString method which can be used to parse a new resource from a string. In #380, which will be released the upcoming fluent 0.13, I changed FluentResource to extend Array and I kept fromString.

let resource = FluentResource.fromString("foo = Foo");

I don't fully remember why there is fromString in the first place. I think it's related to how transpilers can't handle extending native constructors back to ES5. But since we don't target ES5 any more (#133), perhaps we don't need a separate static method?

The reason why I wonder is that in a few examples of @zbraniecki's WebIDL experiemnts, I noticed he used a different API:

let resource = new FluentResource("foo = Foo");

Should we consider switching to it? And related: should we keep FluentResource as a subclass of Array, or perhaps make it an independent class with a semi-private field called _messages?

CC @Pike.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions