Fable.Python icon indicating copy to clipboard operation
Fable.Python copied to clipboard

Added string from stdlib

Open delneg opened this issue 4 years ago • 2 comments

Some functions from "string", although I'm struggling with 'Template' and 'Formatter' classes. (https://github.com/python/typeshed/blob/master/stdlib/string.pyi#L22) How should they be bind ? Is there any example .. ? Maybe it's using [<AbstractClass>] or some other way

delneg avatar Oct 29 '21 20:10 delneg

For string format I was planning to do this:

type System.String with
    [<Emit("$0.format($1...)")>]
    member self.format([<ParamArray>] args: Object[]) = nativeOnly

Is it something similar you need to do for the Formatter class? I've btw added a TestString.fs file, so you can add more unit-tests there for string handling.

dbrattli avatar Oct 30 '21 05:10 dbrattli

Some features like named arguments for format is currently blocked by #18

dbrattli avatar Oct 30 '21 05:10 dbrattli