Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support System.IO.Path #2369

Closed
jwosty opened this issue Jan 30, 2021 · 3 comments
Closed

Support System.IO.Path #2369

jwosty opened this issue Jan 30, 2021 · 3 comments

Comments

@jwosty
Copy link
Contributor

jwosty commented Jan 30, 2021

Description

It might be nice to have a replacement implementation of System.IO.Path in Fable. I've written a pretty robust one over at Fable.System.IO. Perhaps a merger of this into core Fable would be a net good?

I thought I've already asked this somewhere, but I can't find it anymore. The reason it's already its own library is because I figured @alfonsogarciacaro would take the viewpoint that it's better in general to keep BCL API implementations out of Fable itself and in separate libraries to reduce maintainer overhead of Fable itself -- at which point, the question becomes whether or not this is worth that cost. Might be, might not be, but I figured I'd bring it up!

The one thing that would make this tricky is the fact that Fable.System.IO uses a platform detector (currently platform-detect from npm; but in the process of switching over to Shmew's F#-only Fable.Extras). So if Fable were to properly absorb this code, it would have to either similarly take some kind of dependency (or inline) on a platform detector, or it would just choose which environment's behavior to emulate (Windows vs Unix paths).

FWIW, I have complete unit test coverage here.

@alfonsogarciacaro
Copy link
Member

alfonsogarciacaro commented Feb 1, 2021

Hi @jwosty! This is a great work you've done with Fable.System.IO 👏👏👏 I understand your desire to see this integrated into Fable, but I'm still very careful in trying to shim more .NET APIs. Path is useful, but I assume when adding any support for System.IO people will try to use File as well. Javascript can run in multiple environments: browser, nodejs, mobile... and trying to support File I/O in all of these is too big an undertake (for me). We already have trouble with binary serialization because btoa is not supported in Node :/

Also, fable-library doesn't have dependencies, so we would have to include platform-detect in our codebase. We've already done something like that for decimals and longs, but besides this causing trouble with bundle sizes (as in thoth-org/Thoth.Json#96 which took me a long time to realize) we're actually trying to remove this external js code and go for a full f# fable-library.

Fable.System.IO is fantastic and I think this is the way to go for .NET developers who want yo use familiar APIs in a JS environment: a library that is similar to what they're used to, but gives immediate hints in the IDE about what is supported and the platform differences.

@alfonsogarciacaro
Copy link
Member

Closing as we've Fable.System.IO as a great alternative to trying to add more (imperfect) BCL replacements. Thanks again for this @jwosty!

@jwosty
Copy link
Contributor Author

jwosty commented Jul 12, 2021

Sure thing; I can definitely understand this reasoning!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants