https://github.com/bgctw/symboldispatch.jl

Implementing the Singleton type dispatch pattern

https://github.com/bgctw/symboldispatch.jl

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Implementing the Singleton type dispatch pattern

Basic Info
  • Host: GitHub
  • Owner: bgctw
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Size: 110 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

SymbolDispatch

Stable Dev Build Status Coverage

Macro @symboldispatch helps implementing the singleton type dispatch pattern, with avoiding the value type anti pattern.

Code Example ```julia using SymbolDispatch @symboldispatch _bar(::Val{:method1}) = "method for :method1" _bar(::Val{:method2}) = "method for :method2"

call with symbol, rather than Val(:method1)

_bar(:method1) == "method for :method1" ```

See documentation

Type-stable Alternatives

Caution The return of a symbol-dispatched call is type-unstable. Use this pattern only in non-performance-critical parts of your application or where you can deal with type-instability.

As an alternative, consider explicitly declaring Singleton-types.

```julia abstract type ETMethod end struct PriestleyTaylor <: ETMethod end struct PenmanMonteith <: ETMethod end

potentialET(::PriestleyTaylor, Tair) = "return from PriestlyTaylor" potentialET(::PenmanMonteith, Tair) = "return from PenmanMonteith"

method = PriestleyTaylor() ET = potential_ET(method, 21.3) ```

Owner

  • Name: Thomas Wutzler
  • Login: bgctw
  • Kind: user

GitHub Events

Total
  • Push event: 4
Last Year
  • Push event: 4

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v2 composite
  • julia-actions/cache v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-docdeploy v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions
  • actions/checkout v2 composite
  • bgctw/keepalive-workflow master composite
  • julia-actions/setup-julia v1 composite
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite