Re: Pharo-dev Digest, Vol 59, Issue 25

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

Re: Pharo-dev Digest, Vol 59, Issue 25

Richard Uttner

Interesting ... so I started guessing and searching a bit, guided by the idea that the guy is more experienced with JavaScript than with Smalltalk. What I found: In JavaScript there is an (incredibly beautiful) unary plus operator performing a Number cast on the object following. Being not shure that the value returned from the configuration call would be an Integer, he or she tried to cast it using the same unary operator, which did not work out of the box in Pharo ;) but could be fixed with a 0 as receiver. So I guess / think the intention behind was totally different compared to what it looks like for us. It's not very important here, but in general, guessing the effective intention behind some weird code you have to fix - that's the really hard part, but might save you a lot of time!


Am 22.03.2018 um 17:00 schrieb [hidden email]:
Message: 3
Date: Wed, 21 Mar 2018 21:47:59 +0100
From: Stephane Ducasse [hidden email]
To: Pharo Development List [hidden email]
Subject: [Pharo-dev] Coding pearl of the day
Message-ID:
	[hidden email]
Content-Type: text/plain; charset="UTF-8"

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: Pharo-dev Digest, Vol 59, Issue 25

Sean P. DeNigris
Administrator
Richard Uttner wrote
> in general, guessing the
> effective intention behind some weird code you have to fix - that's the
> really hard part, but might save you a lot of time!

True! And documenting the intention behind my weird code will save the poor
future programmers even more ;)



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

Cheers,
Sean