Design discussion
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 25/100
Direção de pesquisa
Comece por src/NestedNumbers.jl e examples/usage_demo.jl e, em seguida, revise os draft PRs vinculados e o contexto de Reactant e Discourse. A issue busca críticas da comunidade sobre o nome do pacote, a hierarquia de tipos e a abordagem geral, em vez de especificar uma mudança delimitada; para considerá-la concluída, seria necessário chegar a uma direção acordada ou a uma proposta concreta de acompanhamento.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
We have some number types in the Julia ecosystem that are "a bit special". The one's I have encountered most often are quantities (numbers with units), opaque/traced/symbolic numbers (value not accessible at all) and numbers that are "remote", i.e. that live on a separate compute-node/device/system (value accessible only with substantial latency).
Making such numbers subtypes of Real and Integer is tricky, dispatch wise, but also semantically not ideal - one might argue that a traced number with a real value is not actually a real number itself - I can operate on it, but I can't compare values and make a branching decision based on it (at least not during tracing). Likewise, a real number with a unit is clearly not a real number itself. On the other hand, user code often needs to restrict numerical type, both for semtantic and dispatch reasons - a function that will behave wrong for complex values should ideally not use Number at the argument type.
Also see https://github.com/EnzymeAD/Reactant.jl/issues/1570 and https://discourse.julialang.org/t/flexunits-jl-0-3-0-support-for-unitful-like-inference/134903/38 for context.
NestedNumbers is an attempt to create a bridge here - a super-lightweight package that user code can depend on and use for dispatch, while only minimal changes are required for unit packages or packages that use traced numbers like Reactant.
See the NestedNumbers demo, which requires these draft PRs:
- https://github.com/JuliaPhysics/Unitful.jl/pull/837
- https://github.com/Deduction42/FlexUnits.jl/pull/52
- https://github.com/JuliaPhysics/DynamicQuantities.jl/pull/198
- https://github.com/EnzymeAD/Reactant.jl/pull/2434
The final approach should ideally involve UnitsBase as well.
(Note that Reactant doesn't seem to work with unitful numbers in general yet, so the demo doesn't show a combination of both. )
The basic approach is this: NestedNumbers defines
- Abstract types like
OpaqueNumber{T}RemoteNumber{T}QuantityNumber{T}that packages that define number types can subtype. - Union typedefs like
AReal,AInteger,AComplex,ABoolandQReal,QInteger,QComplex,QBoolfor user/downstream code to dispatch on.
It's all in the single short source file.
Everyone involved/interested is more than welcome to comment and critique here, propose radical changes (feel free to open PRs), etc. NestedNumbers is not registered yet on purpose, everything is up for change including the package name. This is an attempt to see if this kind of approach can work and would be acceptable, and it's meant to involve the whole community.
- Linguagem predominante
- Julia
- Estrelas
- 2
- Forks
- 0
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
MagneticResonanceImaging/MRIReco.jl#320 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
rfordatascience/tidytuesday#1098 ·
-
`SplitRungeKutta` time steppers never call `update_lagrangian_particle_state!`, so particle `tracked_fields` are never updatedTalvez já em andamento @ali-ramadhan assumiu há 1 dia. Abertabug 🐞
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
CliMA/Oceananigans.jl#6381 ·
Mantenedores costumam responder em até 1 dia
-
ci system:windows test
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Single-column TKE example: boundary-layer depth description doesn't match Han & Bretherton (2019)Aberta
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 82/100
NumericalEarth/Breeze.jl#1143 ·
Mantenedores costumam responder em até 1 dia