HaxeFoundation / HaxeFoundation/haxe

"Non-Void" constraint for type parameters

Open
#6,810 10 comments 1 reaction 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

I'd like to have a "Non-Void" constraint for type parameters.
Here is why:
```haxe
class Test {
static function main() {
var a = [1, 2, 3].map(function(i) i * 2); //Compiler does not complain that function does not returning any value.
trace(a); //null, null, null
}
}
```
https://try.haxe.org/#aa8D8

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided Haxe example and the linked try.haxe.org case. The issue names no source file or test path; done would mean defining and enforcing the proposed “Non-Void” type-parameter constraint so callbacks that return no value are rejected.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.