Giter Club home page Giter Club logo

Comments (18)

Taneb avatar Taneb commented on July 18, 2024 2

We're importing just Data.Nat.Properties as ℕₚ, ℕᵖ, , Nat, and ℕ-Prop...

from agda-stdlib.

MatthewDaggitt avatar MatthewDaggitt commented on July 18, 2024 1

This is definitely mostly my fault, I've definitely shifted over the years. My current go-to style is to import Data.Nat.Properties as simply as , as the reason you need to disambiguate the Properties files is to avoid clashes with other datatypes. So my proposal would be to:

  • name the properties file Data.X.Properties after the name of the main datatype in Data.X.

from agda-stdlib.

MatthewDaggitt avatar MatthewDaggitt commented on July 18, 2024 1

I'd been groping towards @MatthewDaggitt 's proposal for a while, but not quite sure if one can simultaneously import Data.X.Base and Data.X.Properties both as X, but it seems as though you can...

Yup, there's no problem there.

That said, I would still prefer to import as literal X, and hence ASCII/UTF-8 as a (Unix) filename, rather than 'symbolic' X, ie Nat rather than ℕ, but it seems as though I'm in a minority on this one...?

Hmm so this would be naming if after the module name not the datatype name? Or do you mean the datatype name transcribed to ASCII, i.e. would Data.Foo.Properties with a datatype called \. in Data.Foo.Base be imported as Dot?

from agda-stdlib.

MatthewDaggitt avatar MatthewDaggitt commented on July 18, 2024 1

If we're naming the qualifier after the datatype, what should be the convention for datatypes with long names?

Do you have any examples? I'm not aware of any datatypes with ridiculously long names.

What about when we're importing two modules for datatypes with the same name, e.g., Data.Vec.Relation.Unary.All and Data.List.Relation.Unary.All?

I think these should be named after the same datatype as everything else, i.e. the main datatype in Data.X. So these would be named Vec and List respectively.

We very rarely ever have the case that datatypes have the same name. We usually disambiguate them somehow, e.g. binary naturals, unnormalised rationals etc. so I don't think we'll run into that problem.

from agda-stdlib.

gallais avatar gallais commented on July 18, 2024

We have a long tradition of using Xₚ for the qualified import of Data.X.Properties.

from agda-stdlib.

JacquesCarette avatar JacquesCarette commented on July 18, 2024

This is one of the areas where I'd lean hard on 'convention' rather than making the style 'standard'. In other words, we won't get complete uniformity, but we'll get a lot closer.

For example, points 2-3 above de facto end up being ASCII, so if we remove the first point (because we don't want to change the tradition wrt Data.X.Properties), it's still going to be mostly true.

from agda-stdlib.

jamesmckinna avatar jamesmckinna commented on July 18, 2024

Re: X_p and ASCII
There's still some discrepancy between Nat_p and \bN_p, and... so on.

And Fin never seems to be consistently named, Properties or otherwise...

from agda-stdlib.

JacquesCarette avatar JacquesCarette commented on July 18, 2024

I'm all for consistency. For sure we'd want to pick a single name for Data.Nat.Properties in stdlib.

from agda-stdlib.

jamesmckinna avatar jamesmckinna commented on July 18, 2024

I'd been groping towards @MatthewDaggitt 's proposal for a while, but not quite sure if one can simultaneously import Data.X.Base and Data.X.Properties both as X, but it seems as though you can...

That said, I would still prefer to import as literal X, and hence ASCII/UTF-8 as a (Unix) filename, rather than 'symbolic' X, ie Nat rather than , but it seems as though I'm in a minority on this one...?

from agda-stdlib.

jamesmckinna avatar jamesmckinna commented on July 18, 2024

Module name. Your thought experiment litmus test example would import as "Foo"... but thanks for the ingenuity of the challenge ;-)

from agda-stdlib.

MatthewDaggitt avatar MatthewDaggitt commented on July 18, 2024

Okay, so when you said

I'd been groping towards @MatthewDaggitt 's proposal for a while, but not quite sure if one can simultaneously import Data.X.Base and Data.X.Properties both as X, but it seems as though you can... That said, I would still prefer to import as literal X, and hence ASCII/UTF-8 as a (Unix) filename, rather than 'symbolic' X, ie Nat rather than ℕ, but it seems as though I'm in a minority on this one...?

you weren't supporting my proposal for naming it after the datatype (leaving aside ASCII/non-ASCII)?

My feeling is that we want the qualified names of the Base modules to be as short as possible. When you have big long equations with lots of qualified operators, you want them to be short. So I would strongly be against importing the Base names as Nat rather than . Given that, it would be weird to then call the Properties modules Nat rather than ...

from agda-stdlib.

jamesmckinna avatar jamesmckinna commented on July 18, 2024

Ok, I see your point. I had been trying to argue for ASCII throughout, and you for datatype name (throughout?, Properties as well as Base? I'm not thrilled about the subscript p, FWIW) but I don't want to make this a hill on which to die. Consistency, and understanding/documenting the convention, are much more important, IMHO.

That said, can/should/will we then import the PropositionalEquality module(s) as ... I hope so. P and PropEq etc. don't do it for me...

from agda-stdlib.

MatthewDaggitt avatar MatthewDaggitt commented on July 18, 2024

The subscript p should definitely go!

That said, can/should/will we then import the PropositionalEquality module(s) as ≡... I hope so. P and PropEq etc. don't do it for me...

Yes, I think so! I think that falls neatly under my proposed scheme of naming the qualifier after the datatype.

from agda-stdlib.

Taneb avatar Taneb commented on July 18, 2024

If we're naming the qualifier after the datatype, what should be the convention for datatypes with long names? What about when we're importing two modules for datatypes with the same name, e.g., Data.Vec.Relation.Unary.All and Data.List.Relation.Unary.All?

from agda-stdlib.

jamesmckinna avatar jamesmckinna commented on July 18, 2024

Do we have examples of this in the library, where we need to name those modules for qualified import?

Nevertheless, the question stands, so I suppose we would need to agree a disambiguation scheme, eg in your example, to import as VecAll and ListAll? (again, using the datatype name as a root to the 'long' name...?)

from agda-stdlib.

jamesmckinna avatar jamesmckinna commented on July 18, 2024

Closed by #2270 ? Or worth keeping open as a reminder to enact the recommendations, both going forward, and when updating old modules...?

from agda-stdlib.

JacquesCarette avatar JacquesCarette commented on July 18, 2024

Yes to close, since the style guide has been updated. Opening a fresh issue with a list of the old modules that need to be updated would be a good idea.

from agda-stdlib.

jamesmckinna avatar jamesmckinna commented on July 18, 2024

The horror! The horror! What a list... and how to face tackling it... :-( will file an issue in some form or other eventually ;-)

from agda-stdlib.

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.