Feature deprecation: apply(EquationForm(), eos::EquationOfState)
returns a function
#52
Labels
blog
This is a blog of development
breaking
Introduce breaking changes
deprecation
wontfix
This will not be worked on
Milestone
Is your feature request related to a problem? Please describe.
This is actually not a feature request but a feature deprecation request. In the past, I allow the following syntax:
and the usage is
Which basically means:
apply(EquationForm(), eos::EquationOfState)
returns a function that takes a volumev
as a variable, suitable for mapping onto any array.This feature is the so-called Currying in functional programming, named after logician Haskell Curry.
Describe the solution you'd like
But I found Julia provides a nice
do
block, so the above example is equivalent toYou can tell the results are exactly the same, but here we only use the method
apply(EnergyForm(), eos::EquationOfState, v::Real)
, which is self-explanatory. So even if we deprecate the syntaxusers can still get the same results without writing extra code. The only downside is that the code is 3 lines, compared to the old one-liner.
By now, I want to introduce as little features as possible to make this code minimal and maintainable. Introducing too many features at once may affect future implementation. Users can write Lambda functions
to re-enable this feature if they really want to use it.
Describe alternatives you've considered
There are some packages (
Curry.jl
,Curry.jl
orCurrier.jl
) implementing Currying, apart from defining Lambda functions by user themselves.Please be aware that this is a breaking change if you use the above syntax before @searchengineorientprogramming, I will update docs and tests soon.
The text was updated successfully, but these errors were encountered: