Giter Club home page Giter Club logo

Comments (5)

graydon avatar graydon commented on May 9, 2024 1

Hah, I thought for a moment you were soliciting input on whether user defined operators would be a good idea in rust, which I 100% oppose in every conceivable way.

But if you're into it I guess...

The precedence groups themselves don't seem to have been a problem in swift. One thing that is a problem is that operators can, if you're unlucky about how you do name lookup, participate in global name overload resolution and some expensive global type-constraint-solving problems. Makes for some whole-module search and coupling you might not want (a la multimethods). IOW try to just make operators sugar for a member call or at most an already-defined whole-module dispatch mechanism like a typeclass, don't do anything additional for the operators. That was a design mistake on swift's part we're backing off of.

from pikelet.

brendanzab avatar brendanzab commented on May 9, 2024

One interesting problem is trying to do precedences in an ok/semi-sane sort-of-way. I think Fortress had something where you could define groups of operators with related precedences. Swift has precedence groups - not sure how that turned out for them. Would you happen to know @graydon?

from pikelet.

brendanzab avatar brendanzab commented on May 9, 2024

Thanks for the info! Might try tracking down some code/libraries that use them to see how it looks. I'd just like to avoid the numeric precedences that are kind of hard to use/visualise in Coq, Agda, and Lean.

Unlike Swift, Pikelet won't have overloading apart from instance arguments (#13), so I'm guessing that would dodge the global name lookup issue? It would kind of look like:

Monoid (a : Type) = Record {
    empty : a,
    append : a -> a -> a,
};

(<>) : {a : Type} {{M : Monoid a}} -> a -> a -> a;
(<>) {{M}} = M.append; 

from pikelet.

graydon avatar graydon commented on May 9, 2024

Shrug it's hard for me to say, I mean, it only really bites us because we have a bad exponential-search problem in expression constraint solving, and any whole-module coupling between files causes whole-module invalidation at the incremental level any time you change a file that uses such a global operator; so both are compile-time costs. Semantically it's no problem.

Whether you can make your implicits system (and compile times) not have those features, well, I hope so!

(ps. I really like the clarity of design docs you're putting out, keep it up! very lucid, makes me feel a bit ashamed at the mess of my note-taking on rust. not to mention total theoretical underpreparedness for what was to come. ah well, hindsight...)

from pikelet.

brendanzab avatar brendanzab commented on May 9, 2024

I really like the clarity of design docs you're putting out, keep it up! very lucid, makes me feel a bit ashamed at the mess of my note-taking on rust.

Thanks for the feedback! Lots of this is based on the stuff I've learned from being around Rust's development process as its grown over the years, and also through some of the mistakes I've made during the development of my own libraries. The stuff we have learned while working on Rust isn't just all the language/type system features, it's also been all the community and process. That takes time, experimentation, and trial and error to figure out - I couldn't have arrived at this on my own!

That said, there are some definite reactions against some of the early design processes. I'm trying hard to keep my eye on the goal of future formalization and core simplicity of design, as I think that's critical to not becoming a culdesac like C++ has become (and what Rust is trying to dodge becoming with RustBelt). Also in communicating intent in preparation for other contributors coming in to help out. But again, I could have only learned that by hindsight via Rust, and by getting excited about language design and theory thanks to your influence! ❤️

from pikelet.

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.