Comments (7)
For Buf_read
, the names were chosen to be compatible with Angstrom's names; e.g. https://github.com/inhabitedtype/angstrom/blob/5536d1da71469b49f37076beb5f75d34f448da5e/lib/angstrom.mli#L89.
I think Buf_write.printf
would be a great addition (PRs welcome).
The use of Filename.concat
in path.ml
is a bug - it will use the wrong separator on Windows. There is a Path.split
that might be useful for you. Calling it in a loop will get all the components. That might be a useful convenience function to add indeed (along with basename
and dirname
).
As an alternative to using a GADT, you can also cast to a concrete type: see https://github.com/ocaml-multicore/eio#casting
from eio.
Hi @talex5.
I did some initial exploration based on your answer here. If you think some bits are going the right direction (printf, components, basename and dirname) I can try and create some PRs out of it.
Re: casting.
As an alternative to using a GADT, you can also cast to a concrete type: see https://github.com/ocaml-multicore/eio#casting
Sorry I missed that section of the doc. This is spot on and I ended up preferring this style. Thanks! While writing the cast I wondered whether it would make sense to offer some canonical type alias in eio to simplify usage. I explored it a bit here, please let me know your thoughts.
Re: api compatibility. Thanks for pointing out the Angstrom constraint. It occurred to me that with what's already exposed by Buf_read
and Buf_write
, many things can be done in the user land depending on people's need, so I'm happy to do some exploration as third party libraries for now (example here). Thank you!
from eio.
Using primes for the generic types looks interesting. I didn't add them originally as there are so many types already.
I think basename
etc should just be e.g. snd (split t)
. Why is extra logic needed?
from eio.
Re: basename
I expect the domain for basename
and dirname
to be any valid Eio.Path.t', thus my inclination was for their types to be:
val basename : _ Eio.Path.t -> string
val dirname : _ Eio.Path.t -> string
If you limit their implementation to the domain where split is defined, you'd end up with a string option
in the returned type (thus the extra logic in the None case).
For the behavior, I based it on what I witness was the behavior of unix utils basename
and dirname
when typed in a terminal. For example:
$ dirname ''
.
You can have a look at the test cases I looked at here
I plan on creating separate PRs for the different things we talked about here, that way we'll be able to further discuss options there. Thank you!
from eio.
Re: basename in PR #648
from eio.
Re: type-aliases: I couldn't think of a technic that offers the same potential benefits without adding complexity and more types. I'll continue experimenting with it.
I believe my feedback is entirely covered at this point (thank you @SGrondin for #652 !), I'm happy to close this issue.
Thank you.
from eio.
(Buf_write.printf
was added in #655)
from eio.
Related Issues (20)
- Add Condition to `Eio.Std` HOT 3
- Creating a process group in `Fork_action` (?) HOT 1
- Add a systhread pool of workers for eio_posix HOT 1
- README discussion of `type 'a env` convention is out of date HOT 2
- Restore "available" metadata on eio_windows
- Keep writes within IOV_MAX HOT 1
- Compilation failure HOT 7
- Full tracing support
- `_os_unfair_lock_corruption_abort` after fork on MacOS HOT 15
- `getsockname` missing? HOT 3
- Switches should be domain-safe
- Eio_unix: Allocation warning from sched.ml breaks cram tests HOT 2
- Unix.Unix_error(Unix.EPERM, "io_uring_queue_init", "") failures in Docker HOT 5
- Occasional deadlocks with systhreads
- Multiple message in TCP communication with flow HOT 3
- Explanation of "connect-in-progress" HOT 3
- Net.listen hangs if the port is already in use HOT 2
- Extending eio from the outside HOT 1
- Signal handlers may not run, especially with eio_linux
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eio.