Deprecate the blocking parameter of File, Socket and IO::FileDescriptor constructors#16034
Conversation
straight-shoota
left a comment
There was a problem hiding this comment.
The version flags are annoying, but I suppose there's no way around that.
File, Socket and IO::FileDescriptor constructorsblocking parameter of File, Socket and IO::FileDescriptor constructors
|
At some point we might release a 2.0 that would allow us to drop these in a 2.x release, so we can build 1.0 -> 2.0 -> 2.x. Maybe. |
|
Or release patched versions of 1.0 -> 1.4 where the parser will skip over argument annotations? |
|
Alternatively, we could break forward compatibility for building a 1.x compiler with a compiler < 1.5. |
|
This PR seems a bit problematic related to its deprecation warnings. If I have a file with $ ccrystal test.cr
Using compiled compiler at /home/george/dev/git/crystal/.build/crystal
In /home/george/dev/git/crystal/src/file.cr:525:3
525 | {% begin %}
^
Warning: expanding macro
There was a problem expanding macro 'macro_140154605514400'
Called macro defined in /home/george/dev/git/crystal/src/file.cr:525:3
525 | {% begin %}
Which expanded to:
1 |
2 | def self.open(filename : Path | String, mode = "r", perm = DEFAULT_CREATE_PERMISSIONS, encoding = nil, invalid = nil, @[Deprecated] blocking = nil, &)
> 3 | file = new filename, mode, perm, encoding, invalid, blocking
4 | begin
5 | yield file
6 | ensure
7 | file.close
8 | end
9 | end
10 |
Warning: Deprecated argument blocking.
A total of 1 warnings were found.
fooI feel like I shouldn't be getting warned about something in the stdlib that I have no control over fixing. |
The final patch to the blocking behavior rework. Each event loop configures the system file descriptor or handle as per its internal requirement, and we shall deprecate the
blockingargument.Extracted from #15924. Follow up to #15804, #15754, #15753, #15750, #15930 and #15977. Depends on #15999 and #16012 for the deprecations to be visible.
Parser support for annotations on def parameters was only added in #12044 for Crystal 1.5.