Replies: 9 comments
-
We cannot completely eliminate the use of the integer |
Beta Was this translation helpful? Give feedback.
-
Would there be a way to create a |
Beta Was this translation helpful? Give feedback.
-
Also, would there be a way to go the other direction? Get a fd from a |
Beta Was this translation helpful? Give feedback.
-
Currently no but there's no reason why we can't make it possible. The
There already is. The |
Beta Was this translation helpful? Give feedback.
-
This is true, but … in practice, people are not using file descriptors as numbers, at least if they are doing it correctly. The numeric values don’t have any meaning besides being used as references, so it’s more of an opaque identifier that can only be used by passing it to I would personally estimate that if we replace file descriptors with objects that wrap around |
Beta Was this translation helpful? Give feedback.
-
@ronag... in terms of a transition path... what I would recommend is:
We can't yet say how long that deprecation would need to be held for but... @addaleax...
Possibly, but the fact that it breaks strict equality can't be forgotten. That's a big difference. |
Beta Was this translation helpful? Give feedback.
-
There’s no realistic way to deprecate
I don’t think that’s such a huge issue – people don’t care so much about numeric equality of two values as they care about whether the values refer to the same fd, and they would usually only do that in a meaningful way if they come from the same That’s not to say there aren’t issues – for example, we would need some special handling for people who do transfer |
Beta Was this translation helpful? Give feedback.
-
It might just be curmudgeonly ways and traumatic stress from the Great Buffer Constructor Deprecation of years past, but it definitely gives me the nervous shakes -- which, is not to say Don't Do It, but I am imagining much angst lol. I think the most likely area of concern is going to be around the stable stdio fd's. You are, of course, correct that anyone who is using the Perhaps an experiment with some popular |
Beta Was this translation helpful? Give feedback.
-
Currently we use
FileHandle
for the promise based version of the fs api. Would it be possible to move the callback based api to this as well? It would allow us to guard against unsafe/undefined behaviors.This would be breaking in terms of
fd
no longer being an integer but an object instead. So I guess if there are any implementations that depend on this it might be a problem, e.g. if storing in a object or array and using thefd
as a key. Is there maybe some hack with a symbol that can make it automatically converted into an integer when trying to cast to string or number? e.g.Symbol.toPrimitive
.Refs: #34746
Beta Was this translation helpful? Give feedback.
All reactions