Giter Site home page Giter Site logo

reference current record? about dhall-lang HOT 6 CLOSED

sellout avatar sellout commented on September 26, 2024
reference current record?

from dhall-lang.

Comments (6)

Gabriella439 avatar Gabriella439 commented on September 26, 2024

Yeah, this restriction is very intentional in order to prevent infinite loops

The way I would organize this is to define the fields in a certain order and then pack them into a record at the end, like this:

    let g = λ(a : Natural) → λ(b : Natural) → a + b

in  let h = λ(a : Natural) → g a +2

in  let i = g (h +4)

in  { g = g, h = h, i = i }

from dhall-lang.

sellout avatar sellout commented on September 26, 2024

Ah, I like that better. Thanks.

Would it be acceptable if I implemented something that ensured there were no cycles in the fields? I’ve done something similar in a total language I wrote (pretty simple if you just require that fields can only reference fields defined “above” them, much like nested lets). No promises, but if it wouldn’t be rejected outright, I would keep it in the back of my mind as I dive deeper into Dhall.

from dhall-lang.

Gabriella439 avatar Gabriella439 commented on September 26, 2024

I think the main pros are:

  • It allows dependent records (especially now that they can store types for fields)
  • It's a common idiom in other configuration languages

I think the main cons are:

  • It's not clear if records with different field order are the same type. If not, that would be a bit weird
  • Sorting or reordering fields for clarity of configuration is no longer automatically safe

Overall I'm probably slightly against since it overlaps with nested let and I try to avoid having two idioms to do the same thing. I think the more compelling motivation is dependent records but nobody has requested that yet.

However, if you feel strongly about the idea then I can set up a process for voting on proposed changes to the language where I don't exercise veto power over proposed features.

from dhall-lang.

sellout avatar sellout commented on September 26, 2024

No, that’s fine – I’m definitely still getting my feet wet. I agree with trying to keep things orthogonal.

from dhall-lang.

sellout avatar sellout commented on September 26, 2024

BTW, I would love some way to construct dependent records. I think that’s all that’s needed in order to implement Nu for corecursive fixed-points, no?

from dhall-lang.

Gabriella439 avatar Gabriella439 commented on September 26, 2024

Yeah, I'm not ruling out dependent records (or even ordered records). I was thinking that if we do introduce that at some point it might be as a new separate construct with its own syntax

from dhall-lang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.