Bug 21105 – Casting from a function pointer to a delegate

Status
NEW
Severity
enhancement
Priority
P4
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-08-03T14:50:55Z
Last change time
2024-12-15T15:26:21Z
Assigned to
No Owner
Creator
Victor Porton
Moved to GitHub: dlang.org#4108 →

Comments

Comment #0 by porton — 2020-08-03T14:50:55Z
Please add the following features: - explicit casting from a function pointer to the corresponding delegate (with the obvious semantics) - implicit casting from a function pointer to the corresponding delegate - `cast(delegate) ...` that would also do this cast. The state would be set to null by such casts.
Comment #1 by dkorpel — 2020-08-03T15:07:25Z
Are you aware of std.functional.toDelegate? https://dlang.org/phobos/std_functional.html#toDelegate Implicit casting to delegate probably needs a DIP or at least some good rationale.
Comment #2 by robert.schadek — 2024-12-15T15:26:21Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/4108 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB