HaxeFoundation / HaxeFoundation/haxe

[HL] Dynamic from Float vs any other target

Open
#8,477 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
var f:Float = 3;
var test:Dynamic = f;
trace(Type.typeof(test));
f /= 2;
trace(f);
trace(Type.typeof(test));

Main.hx:39: TFloat
Main.hx:41: 1.5
Main.hx:42: TFloat

any other target

Main.hx:39: TInt
Main.hx:41: 1.5
Main.hx:42: TInt

```
HL looks better, it is strange to see value 1.5 and TInt type on other targets. Still, HL stands alone here. BTW, I tried to force TFloat using cast on the other targets, no success. Except adding some small fraction. While in case of HL, cast(value, Int) is working just fine to make type equal to other targets.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.