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

Dimitris Chloupis kilon.alios at gmail.com
Thu Jan 21 07:50:44 EST 2016


how about syntax like this

openFile: aPath (optionalArgumentA: anArgument optionalArgumentB:
anArghument)

On Thu, Jan 21, 2016 at 1:39 PM Henrik Johansen <
henrik.s.johansen at veloxit.no> wrote:

>
> > On 20 Jan 2016, at 6:14 , Esteban A. Maringolo <emaringolo at gmail.com>
> wrote:
> >
> >
> > I would be interested in the use cases and how to deal with
> > "undefined" arguments, will they be nil or other kind of undefined
> > object?
> >
> > Regards!
> >
> > Esteban A. Maringolo
>
> Perhaps
>
> request: aFile with: anotherThing and: aThirdThing
>         <optionalParameter: anotherThing "default: nil">
>         <optionalParameter: aThirdThing default: defaultThirdThing>
> ->
> request: aFile with: anotherThing
>         ^self request: aFile with: anotherThing and: self defaultThirdThing
> request: aFile and:: aThirdThing
>         ^self request: aFile with: nil and: self aThirdThing
> request: aFile
>         ^self request: aFile with: nil and: self defaultThirdThing
>
> ?
>
> Cheers,
> Henry
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20160121/16c339a6/attachment.html>


More information about the Pharo-users mailing list