News for hackers. Stuff that matters.
Re:Yatima: A programming language for the decentralized web by throwaway894345 on Monday June 07, 2021 @02:50PM (#27426513)
> First-class types. This lets you the programmer to tell the compiler what you intend to do in your program. Then, like a helpful robot assistant, the compiler will check to make sure that what you're actually doing matches those expressed intentions.

So static typing? Or am I missing something?

Re:Yatima: A programming language for the decentralized web by jcburnham on Monday June 07, 2021 @05:09PM (#27426960)
Hi, Yatima co-author here, this paragraph refers broadly to static dependent types, like in Idris, but I described them as "first-class-types" here because I thought it sounded more accessible. Also, becase at the type-level Yatima types are ordinary values, so there's an analogy that can be drawn with first-class functions.

But it seems from this thread this caused confusion, so I'll update the README shortly to clarify.

Re:Yatima: A programming language for the decentralized web by nxrabl on Monday June 07, 2021 @02:58PM (#27426590)
Their explanation is reductive, but it looks like more than that. For example, in the standard library [0] the definition of the Map type is a function of other types.

[0]: https://github.com/yatima-inc/introit/blob/main/Map.ya#L10

Re:Yatima: A programming language for the decentralized web by AkshatM on Monday June 07, 2021 @03:45PM (#27426667)
They mean dependent types, in the Idris sense. Basically, types (not just instances of types i.e. the entire collection `int` rather than 5) are first-class citizens that can be passed to functions. It enables proof checking as well as so-called "type-driven development".
Re:Yatima: A programming language for the decentralized web by chubot on Monday June 07, 2021 @04:21PM (#27426721)
Yeah to me that description sounds like "static type checking".

"First-class types" on the other hand means that types are expressions that can be manipulated at runtime, or by compile-time metaprogramming stage. I think Julia is very much like this: types are very complex expressions and they're expressed with the same machinery as arithmetic expressions (femtolisp).

Re:Yatima: A programming language for the decentralized web by jcburnham on Monday June 07, 2021 @05:13PM (#27427010)
> types are very complex expressions and they're expressed with the same machinery as arithmetic expressions (femtolisp).

This is how it works in Yatima. Since we use self-types and lambda-encodings for our datatypes, all type expressions are built up via some combination of self types, pi types and a few type-level constants (like primitives).

For example, the type of booleans can be expressed as:

  def Bool : Type =
    @self ∀
    (0 P     : ∀ (Bool) -> Type)
    (& true  : P (data λ P t f => t))
    (& false : P (data λ P t f => f))
    -> P self

  def true  : Bool = data λ P t f => t
  def false : Bool = data λ P t f => f
from https://github.com/yatima-inc/introit/blob/main/Pure/Bool.ya
Re:Yatima: A programming language for the decentralized web by skulk on Monday June 07, 2021 @06:45PM (#27428254)
What is 'Type'? Is it a Type as well? In a toy dependent type system I'm building I just declared the top type as an instance of itself without caring about soundness. I'm curious what the approach is here.
Re:Yatima: A programming language for the decentralized web by jcburnham on Monday June 07, 2021 @07:34PM (#27428747)
Type is a builtin currently, with `Type : Type`, which makes the type system unsound. There are a couple ways of addressing that that we've explored, like the standard universe polymorphism hierarchy of `Type 0 : Type 1 : Type 2 ...`, but we've also looked at more exotic solutions like whether there's actually a self-type lambda encoding of `Type` itself (which would allow for `case` matching on `Type`). Haven't quite figured it out though, so for the moment `Type : Type` is an acceptable shim while we work on getting everything else working.