News for hackers. Stuff that matters.
Re:Proposal: expression to create pointer to simple types by phoe-krk on Monday April 19, 2021 @11:15AM (#26863646)
> (...) that has the nasty problem that 3 does not have a type (...)

How is that possible? At least in Common Lisp, all literal objects have types, and the same is true of C from what I have just checked.

Re:Proposal: expression to create pointer to simple types by earhart on Monday April 19, 2021 @11:26AM (#26863795)
Go supports untyped constants -- https://golang.org/ref/spec#Constants. It's useful for defining a named constant, and then using the name to initialize variable values of any compatible type.
Re:Proposal: expression to create pointer to simple types by Smaug123 on Monday April 19, 2021 @12:14PM (#26864424)
It doesn't have a type in Haskell, from a certain point of view. `3` is polymorphic.

Prelude> :t 3

3 :: Num p => p

Re:Proposal: expression to create pointer to simple types by tome on Monday April 19, 2021 @12:21PM (#26864520)
It does have a type. You just wrote it down!
Re:Proposal: expression to create pointer to simple types by Smaug123 on Monday April 19, 2021 @12:53PM (#26864960)
Hence "from a certain point of view" - I would argue, in fact, that it's extremely similar to the sense in which 3 doesn't have a type in Go. Haskell's type system can express that sense, whereas Go's can't; but it's the same sense.

> It is an error if the constant value cannot be represented as a value of the respective type. An untyped constant has a default type which is the type to which the constant is implicitly converted in contexts where a typed value is required, for instance, in a short variable declaration such as i := 0 where there is no explicit type. The default type of an untyped constant is bool, rune, int, float64, complex128 or string respectively, depending on whether it is a boolean, rune, integer, floating-point, complex, or string constant.