[Pharo-users] Use cases for methods with optional parameters

Offray Vladimir Luna Cárdenas offray at riseup.net
Wed Jan 20 12:01:06 EST 2016


Hi,

As a newbie, without a clear idea of where to apply this specifically I 
can say that seems pretty interesting. I have methods with several 
parameters (may be product of my newbie code), but making them optional 
seems an idea worthy to explore.

Cheers,

Offray

On 20/01/16 10:08, Damien Cassou wrote:
> Hi,
>
> I would like to study the impact of adding optional parameters to
> keyword methods in Pharo. The goal of optional parameters is to
> facilitate the implementation of methods where some parameters are
> optional. For example, Seaside has:
>
> WAComponent>>request: aRequestString label: aLabelString
>               default: aDefaultString onAnswer: aBlock
>
>      ...
>
> This method of 4 arguments has only 1 required argument (aRequestString)
> and 3 optional ones. In the current implementation, this results in 7
> additional methods that only delegate directly or indirectly to the one
> above:
>
> - request:
> - request:default:
> - request:default:onAnswer:
> - request:label:
> - request:label:default:
> - request:label:onAnswer:
> - request:onAnswer:
>
> Before starting to implement anything, I need to know if it makes sense.
> If you want to help me, please send me all the use cases you have by
> giving me:
>
> - the library name (and URL if not in Catalog), or "pharo" if it's in
>    Pharo
> - the class where this happens
> - the range of selectors that make sense
>
> For the example above, this would be:
>
> - Seaside
> - WAComponent
> - request:*
>
>
> Thank you very much
>





More information about the Pharo-users mailing list