Coding pearl of the day

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Coding pearl of the day

Stephane Ducasse-3
Hi

when cleaning a system sometimes you find some coding pearls.
And I want to share one I found.

currentSlide := 0 + self configuration slideInTemplateForDeckJS.

Stef (we got a good laugh with guille).

Reply | Threaded
Open this post in threaded view
|

Re: Coding pearl of the day

Sven Van Caekenberghe-2


> On 21 Mar 2018, at 21:47, Stephane Ducasse <[hidden email]> wrote:
>
> Hi
>
> when cleaning a system sometimes you find some coding pearls.
> And I want to share one I found.
>
> currentSlide := 0 + self configuration slideInTemplateForDeckJS.
>
> Stef (we got a good laugh with guille).

Haha, that should clearly be

currentSlide := (0 + self configuration slideInTemplateForDeckJS) * 1.

And after that you definitively have to do

currentSlide := [ currentSlide ] value.


Reply | Threaded
Open this post in threaded view
|

Re: Coding pearl of the day

Stephane Ducasse-3
:)

Yes it probably even more intention revealing.

On Wed, Mar 21, 2018 at 9:58 PM, Sven Van Caekenberghe <[hidden email]> wrote:

>
>
>> On 21 Mar 2018, at 21:47, Stephane Ducasse <[hidden email]> wrote:
>>
>> Hi
>>
>> when cleaning a system sometimes you find some coding pearls.
>> And I want to share one I found.
>>
>> currentSlide := 0 + self configuration slideInTemplateForDeckJS.
>>
>> Stef (we got a good laugh with guille).
>
> Haha, that should clearly be
>
> currentSlide := (0 + self configuration slideInTemplateForDeckJS) * 1.
>
> And after that you definitively have to do
>
> currentSlide := [ currentSlide ] value.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Coding pearl of the day

Henrik Sperre Johansen
In reply to this post by Stephane Ducasse-3
Stephane Ducasse-3 wrote
> Hi
>
> when cleaning a system sometimes you find some coding pearls.
> And I want to share one I found.
>
> currentSlide := 0 + self configuration slideInTemplateForDeckJS.
>
> Stef (we got a good laugh with guille).

TBH, I found A := 0 + N to be the least confusing part of that code... ;)

Cheers,
Henry



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html