[Esug-list] Nested Degenerate Convenience Methods

Steven Kelly stevek at metacase.com
Thu Apr 2 04:48:47 EDT 2015


I'd say it's similar to currying, but not actual currying. 
1) In this Smalltalk pattern, the extra default argument is fixed, provided
at compile time; with currying, the extra argument is provided at runtime. 
2) In Smalltalk, the result of any of the methods is the actual return value,
whereas in currying it's a function until the last case.

This is more like partial function application:
http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_applicat
ion
but that only solves 2), not 1). Blocks can go all the way.

I'm not a functional programming expert, though!

Steve


Andres Valloud wrote April 2, 2015 11:38 AM:
> ... /me reads Wikipedia article ...
> 
> It sure looks like an example of currying!
> 
> On 4/1/15 22:14 , Joseph Pelrine wrote:
> > I agree with Andres about calling it a convenience method (and also
> not
> > calling it a pattern), but is this not also an example of currying?
> >
> > Best
> > Joseph
> > On 02.04.15 00:49, Andres Valloud wrote:
> >> I would call that code an example of "convenience methods".  In C,
> those
> >> things would likely be implemented in terms of "macros".  The term
> >> "pattern" is overloaded, I wouldn't use it here.
> >>
> >> On 4/1/15 9:49 , Sean P. DeNigris wrote:
> >>> Is there a name for the following pattern?
> >>>
> >>> doSomething: arg1
> >>>    ^ self doSomething: arg1 ifA: arg2Default
> >>>
> >>> doSomething: arg1 ifA: arg2
> >>>    ^ self doSomething: arg1 ifA: arg2 ifB: arg3Default
> >>>
> >>>
> >>>
> >>> -----
> >>> Cheers,
> >>> Sean
> >>> --
> >>> View this message in context:
> >>> http://forum.world.st/Nested-Degenerate-Convenience-Methods-
> tp4816719.html
> >>>
> >>>
> >>> Sent from the ESUG mailing list archive at Nabble.com.
> >>>
> >>> _______________________________________________
> >>> Esug-list mailing list
> >>> Esug-list at lists.esug.org
> >>> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
> >>>
> >>
> >> _______________________________________________
> >> Esug-list mailing list
> >> Esug-list at lists.esug.org
> >> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
> >>
> >>
> >
> 
> _______________________________________________
> Esug-list mailing list
> Esug-list at lists.esug.org
> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org




More information about the Esug-list mailing list