Re: [Pharo-dev] Pharo-dev Digest, Vol 59, Issue 25
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 pharo-dev-request@lists.pharo.org:
Message: 3 Date: Wed, 21 Mar 2018 21:47:59 +0100 From: Stephane Ducasse<stepharo.self@gmail.com> To: Pharo Development List<pharo-dev@lists.pharo.org> Subject: [Pharo-dev] Coding pearl of the day Message-ID: <CAJ4kQBVMG-ytmLunCcBKRJqkSw5TzCyXGYXMa=miF1KCxVYxQg@mail.gmail.com> 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).
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
participants (2)
-
Richard Uttner -
Sean P. DeNigris