Re: Floating point in the type system

2015-09-12 Thread via Digitalmars-d
On Saturday, 12 September 2015 at 19:02:16 UTC, Robert wrote: For what it's worth, I was investigating this initially as a discussion about adding type-level values in Rust, and how to handle unusual cases like this. C++ does not allow it. And frankly, having more than a single integer value

Re: Floating point in the type system

2015-09-12 Thread Robert via Digitalmars-d
On Saturday, 12 September 2015 at 15:13:27 UTC, Robert wrote: Hi all, I came across this example, and wondered what your thoughts on it are: It seems a little unusual to me. Robert For what it's worth, I was investigating this initially as a discussion about adding type-level values

Re: Floating point in the type system

2015-09-12 Thread Ola Fosheim Grostad via Digitalmars-d
On Saturday, 12 September 2015 at 16:08:31 UTC, Robert wrote: assert and runtime assert failing. I'm just curious to understand the reasoning behind this, whether it's intentional, and whether it matters at all. Types need to mangle to the same name, but using floats in a type name is

Re: Floating point in the type system

2015-09-12 Thread via Digitalmars-d
On Saturday, 12 September 2015 at 19:02:16 UTC, Robert wrote: handle unusual cases like this. In the process we've managed to break the Idris type system: https://github.com/idris-lang/Idris-dev/issues/2609. I don't know Idris, but you can't easily unify over floats, because they are samples

Re: Floating point in the type system

2015-09-12 Thread Xinok via Digitalmars-d
On Saturday, 12 September 2015 at 16:08:31 UTC, Robert wrote: On Saturday, 12 September 2015 at 15:49:23 UTC, Atila Neves wrote: What do think is unusual? Atila It's unusual, because `float.nan != float.nan`, so one might expect that `typeof(Foo!(float.nan) != Foo!(float.nan))`, whereas

Re: Floating point in the type system

2015-09-12 Thread anonymous via Digitalmars-d
On Saturday 12 September 2015 18:08, Robert wrote: > It's unusual, because `float.nan != float.nan`, so one might > expect that `typeof(Foo!(float.nan) != Foo!(float.nan))`, whereas > this is clearly not the case, even with both the static assert > and runtime assert failing. I'm just curious

Re: Floating point in the type system

2015-09-12 Thread Atila Neves via Digitalmars-d
On Saturday, 12 September 2015 at 15:13:27 UTC, Robert wrote: Hi all, I came across this example, and wondered what your thoughts on it are: ``` void main(string[] args) { struct Foo(float f) { alias VAL = f; float getF() { return f; } }

Re: Floating point in the type system

2015-09-12 Thread Robert via Digitalmars-d
On Saturday, 12 September 2015 at 15:49:23 UTC, Atila Neves wrote: On Saturday, 12 September 2015 at 15:13:27 UTC, Robert wrote: Hi all, I came across this example, and wondered what your thoughts on it are: ``` void main(string[] args) { struct Foo(float f) { alias VAL = f;