Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
November 2017
- 87 participants
- 872 messages
Re: [Pharo-users] Stream API
by Stephane Ducasse
Denis I agree. I do not like to code in reverse order.
On Tue, Nov 14, 2017 at 4:49 PM, Denis Kudriashov <dionisiydk(a)gmail.com> wrote:
> 2017-11-14 16:30 GMT+01:00 Steffen Märcker <merkste(a)web.de>:
>>
>> I forgot to mention, that the most recent code for Pharo is already on
>> Github: https://github.com/Pharophile/Transducers
>>
>> Reducers was the name of the first very first implementation.
>>
>> (In fact, I was originally inspired by clojures Reducers lib. After
>> implementing it in Smalltalk, I developed the concept further. Later I found
>> out, that the clojure guys did the same in parallel and ended up with the
>> same abstraction but a differnt name. Hence I decided change the name in
>> order to make the relation clear.)
>
>
> I like abstraction. But I think names and order of computation should be
> changed to be more Smalltalk friendly. Because now it looks like Haskell
> with right to left order:
>
> squares := Set <~ 1000 take <~ #squared map <~ (1 to: 1000).
> fileOut writeStream <~ #isSeparator filter <~ fileIn readStream.
>
>
> Is there any reason to not change it? I would like to start expressions with
> source of data:
>
> squares := (1 to: 1000) ~> #squared map ~> 1000 take ~> Set.
> fileIn readStream ~> #isSeparator filter ~> fileOut writeStream.
>
>
>
>>
>> Am .11.2017, 16:18 Uhr, schrieb Sven Van Caekenberghe <sven(a)stfx.eu>:
>>
>>>
>>>
>>>> On 14 Nov 2017, at 16:00, Steffen Märcker <merkste(a)web.de> wrote:
>>>>
>>>> Hi,
>>>>
>> <---Schnitt--->
>>>>
>>>>
>>>> No. Transducers is my side project. I've implemented a package for
>>>> VisualWorks. Unfortunately, I did not finish the port to Pharo yet, simply
>>>> due to a lack of time. Originally, transducers evolved in the clojure
>>>> community. I figured, the concept a good fit for Smalltalk and adapted it
>>>> accordingly. (My thesis is on conditional probabilities in model-checking of
>>>> probabilistic systems.)
>>>>
>> <---Schnitt--->
>>
>>>>
>>>> http://www.cincomsmalltalk.com/publicRepository/Transducers.html
>>>> https://clojure.org/reference/transducers
>>>> Plus some mails on this list and more on the vwnc list. Feel free to
>>>> ask; I understand, that the package comment has lots of potential for
>>>> improvement to help understanding.
>>>>
>>>> Best, Steffen
>>>
>>>
>>> Some code seems to be here: http://smalltalkhub.com/#!/~cdlm/Experiments
>>>
>>> Not sure if it is complete or what the relation is, or the difference
>>> between transducers and reducers ...
>>>
>>>
>>
>>
>>
>
Nov. 14, 2017
About suggestions on Pillar editor (was Re: [ann] pillar text editor)
by Offray Vladimir Luna Cárdenas
Hi,
A suggestion from one year ago. Should be this converted into issues?
Cheers,
Offray
On 10/10/16 13:26, Offray Vladimir Luna Cárdenas wrote:
>
> Hi Doru,
>
> I was exploring Stephan Eggermont's code Panel because the zooming
> in/out behavior implemented there, but I would like to add your Pillar
> text editor to the exploration.
>
> I would like to add two things:
>
> 1. Font decrease/increase buttons/shorcuts, because for long
> documents, default font size can be tiresome.
>
> 2. Augmenting the amount of syntax highlighting languages, starting
> with markdown. I think that this would be strategic in making writing
> inside the image, more appealing, giving the spread of markdown as a
> documentation syntax in different context (GitHub, Scholar markdown,
> wikis, discussion, Slack clones, etc).
>
> I installed the extension today on a Pharo 5 system, but trying to use
> it, bring me the error detailed at the end of this mail, so after
> having it working on Pharo, I would like to explore/help in
> implementing items 1 and 2, avove.
>
> Cheers,
>
> Offray
>
> Error report
> ===========
> Author: OffrayLuna
>
> Array(Object)>>shouldNotImplement
> Array(ArrayedCollection)>>add:
> [ :each | self add: each ] in Array(Collection)>>addAll:
> Array(SequenceableCollection)>>do:
> Array(Collection)>>addAll:
> [ :array |
> ({array first}
> Â Â Â addAll: array last;
> Â Â Â yourself)
> Â Â Â collect: [ :each |
> Â Â Â Â Â Â ('' join: each first)
> Â Â Â Â Â Â Â Â Â -> (each second ifNotNil: [ :second | '' join: second ]) ]
> ] in GTPillarHighlighter>>scriptParameters
> PPActionParser>>parseOn:
> PPDelegateParser>>parseOn:
> PPSequenceParser>>parseOn:
> PPActionParser>>parseOn:
> PPDelegateParser>>parseOn:
> PPChoiceParser>>parseOn:
> PPDelegateParser>>parseOn:
> PPChoiceParser>>parseOn:
> PPPossessiveRepeatingParser>>parseOn:
> PPDelegateParser>>parseOn:
> PPEndOfInputParser>>parseOn:
> GTPillarHighlighter(PPDelegateParser)>>parseOn:
> GTPillarHighlighter(PPParser)>>parseWithContext:
> GTPillarHighlighter(PPParser)>>parse:withContext:
> GTPillarHighlighter(PPParser)>>parse:
> GTPillarHighlighterTextDecorator>>parse:onError:
> GLMHighlighterTextParserStyler>>privateStyle:
> [ self privateStyle: text.
> view ifNotNil: [ view stylerStyledInBackground: text ] ] in [
> backgroundProcess := [ self privateStyle: text.
> view ifNotNil: [ view stylerStyledInBackground: text ] ]
> Â Â Â forkAt: Processor userBackgroundPriority ] in
> GLMHighlighterTextParserStyler(SHTextStyler)>>styleInBackgroundProcess:
> [ self value.
> Processor terminateActive ] in BlockClosure>>newProcess
> ===============
>
> On 09/10/16 16:23, Tudor Girba wrote:
>> Hi,
>>
>> Pillar now ships with a text editor that also features a syntax
>> highlighter.
>>
>> So, now, if you load the development version of Pillar:
>>
>> Gofer newÂ
>> Â Â smalltalkhubUser: 'Pier' project: 'Pillar';
>> Â Â configuration;
>> Â Â loadDevelopment.
>>
>> You will have an extra presentation when inspecting a .pillar file:
>>
>>
>> The new thing here is that the highlighter is based on the Pillar
>> PetitParser, and it is extensible for highlighting more parts if
>> needed. The highlighting also can support actions. For example, the
>> picture above shows the file to the right after clicking on the
>> reference.
>>
>> Please take a look and let me know what you think.
>>
>> Cheers,
>> Doru
>>
>>
>> --
>> www.tudorgirba.com <http://www.tudorgirba.com>
>> www.feenk.com
>>
>> "Things happen when they happen,
>> not when you talk about them happening."
>>
>
Nov. 14, 2017
Re: [Pharo-users] About implementing a "Mini Pillar" in-image renderer for Pharo ...
by Stephane Ducasse
For git / iceberg first time users:
Please read the tip and tricks booklet available on http://books.pharo.org
On Tue, Nov 14, 2017 at 5:45 PM, Aliaksei Syrel <alex.syrel(a)gmail.com> wrote:
> Hi Offray,
>
> I understand your frustration, but with all respect, the fact that you have
> problems with Iceberg does not mean that GT Documenter or any other GT tool
> is responsible for described problems.
>
> Most complains about bloc, brick, whatever is because of unrelated stuff. It
> is a little bit disappointing. Especially for me, as one of the maintainers.
> But it is ok, I got used to it :)
>
> I donât remember when last time I used stable Pharo (not because it does not
> exist), simply live on the edge since Pharo4. If no one will use Git and
> report problems Iceberg will never progress. If no one will use Bloc it will
> never get âthereâ. Unfortunately, living on the edge is dangerous, requires
> effort, motivation and time.
>
> The script that Doru provided works flawlessly on OSX, we load it almost
> everyday. !! Bloc is tested on CI and builds are green on Windows, Linux and
> OSX !!. If computer (CI) manages to install it, I am pretty sure human can
> do it too. Looks like there is something missing in your configuration,
> something tiny :) Error handling in Iceberg can be definitely improved, but
> it is a different story.
>
> P.S. Documenter can be installed without enabled Iceberg integration. This
> is how CI does it. You will just not be able to contribute.
>
> Cheers,
> Alex
>
> On Tue, 14 Nov 2017 at 16:37, Offray Vladimir Luna Cárdenas
> <offray.luna(a)mutabit.com> wrote:
>>
>> I have been just trying to install GT Documenter and is really frustrating
>> (I have been unable to install it even for the first time!).
>>
>> This was the list of errors I got and steps I followed, in almost
>> sequential order, just to get a (bittersweet!) taste of GT Documenter:
>>
>> 1st: LGit_GIT_ERROR: No ssh-agent suitable credentials found. So I go to
>> GitHub, follow the five pages of documentation to get my SSH credentials
>> that start at [1], then, because I still get the same error, go to the
>> Iceberg FAQ [2], try to surpass the erro,r via command line and doesn't
>> work, so I go to the Iceberg settings and try the manual configuration,
>> going to the next item
>>
>> [1]
>> https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-…
>> [2] https://github.com/pharo-vcs/iceberg/blob/master/README.md
>>
>> Now I get "Instance of LGitCredentialsSSH class did not understand
>> #ifTrue:ifFalse:". I try to make sense of it in the debugger, but is
>> something I cannot. Anyway, I rerun it and now I get: LGit_GIT_EEXISTS:
>> '/home/offray/Programas/Pharo/6.1a/Dev24/pharo-local/iceberg/feenkcom/gtoolkit'
>> exists and is not an empty directory. I delete that directory and try an
>> installation... again
>> Now I get: "Instance of FileReference did not understand #notEmpty". I try
>> to make sense of it in the debugger. My user is git, my public and private
>> ssh keys are not empty. Despite of not making sense of all I understand that
>> is trying to clone something at git@github.com:feenkcom/gtoolkit.git. I go
>> to my image dir and then to `iceberg/feenkcom/gtoolkit/`. There is a git
>> repository there, but is empty.
>> Now I wonder, maybe if I can just clone the directory there, but how I say
>> Iceberg to load it? So I run now only the Metacello part. Same error and
>> solution that the last time but now for gtoolkit-visualizer, Brick,
>> gtoolkit-examples, Bloc and Sparta.
>> After getting my ssh keys, overcome config problems in shell and the Pharo
>> settings, chasing these errors and solving them by cloning the repositories
>> manually, I'm, a couple of hours later, ready to test GT Documenter, but
>> with the last Iceberg's duplicated repository message about Sparta I give
>> up. Is not nice to start your day accumulating frustration... that sets a
>> bad mood for the rest of it, and you need to actively fight against.
>>
>> I have thought that Git is overcomplicated for most of the developers'
>> tasks and communities. I don't know if the root of previous issues is in the
>> "Iceberg enableMetacelloIntegration: true" line, but having to get your pair
>> of keys working to just install software is overkill for the common user
>> (and when LibGit errors are present, the documented solutions don't work
>> seamlessly). Maybe a more sensitive solution would be just to use libgit,
>> without any ssh auth to clone repositories and its prerequisites or even
>> better, some download that goes to the files in the tip (or other) version
>> without all this overhead.
>>
>> Anyway, as I said, I have been unable to test GT Documenter properly and
>> getting feedback over GT Tools from the team usually requires a lot of
>> effort in my case (insisting on getting answers or getting none). And that
>> is just to test a promising tech that still doesn't offer saving features
>> (just and awesome preview). I think that a more sensible approach for a good
>> documentation toolkit for now is on Spec and creating custom syntax
>> highlighters with SmaCC[3], that is well documented and works today.
>>
>> [3]
>> https://medium.com/@juliendelplanque/hacking-a-simple-syntactic-highlighter…
>>
>> I understand that community is trying its best, but expressing how current
>> offerings are not mature and constructive criticism can help on that. At the
>> moment my feeling is that if you want to try the new shinny alpha stuff from
>> GT Documenter, you will need to be prepared for a lot of frustration and
>> silence.
>>
>> Cheers,
>>
>> Offray
>>
>>
>> On 10/11/17 12:41, Tudor Girba wrote:
>>
>> Hi,
>>
>> As shown at ESUG, GT Documenter offers an advanced viewer (and editor) for
>> Pillar working on top of Bloc.
>>
>> You can get it by loading:
>>
>> Iceberg enableMetacelloIntegration: true.
>> Metacello new
>> baseline: 'GToolkit';
>> repository: 'github://feenkcom/gtoolkit/src';
>> load.
>>
>> For example, you can then inspect:
>> 'PATH_TO_ICEBERG/feenkcom/gtoolkit/doc/transcript/index.pillarâ
>> asFileReference
>>
>> Cheers,
>> Doru
>>
>>
>> On Nov 10, 2017, at 12:58 PM, H. Hirzel <hannes.hirzel(a)gmail.com> wrote:
>>
>> A note:
>>
>> Tudor Girba wrote:
>> <tudor(a)tudorgirba.com> Fri, Aug 25, 2017 at 1:31 PM
>> Reply-To: Any question about pharo is welcome
>> <pharo-users(a)lists.pharo.org>
>> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
>>
>> Hi,
>>
>> As mentioned in an announcement about 10 days ago, we are building a
>> Pillar editor with inline viewing abilities in Bloc. Here is how it
>> looked like. Please note the embedded picture. We continued working on
>> it since then and we will probably announce the next version this
>> weekend:
>>
>>
>> Maybe there is now enough progress to do simple presentations in Bloc?
>>
>>
>> On 11/10/17, H. Hirzel <hannes.hirzel(a)gmail.com> wrote:
>>
>> Hello
>>
>> In the thread 'including Pillar in Pharo image by default' it was
>> suggested by Stephane Ducasse to include a subset of Pillar in the
>> Pharo image[1] .
>>
>> I'd like to extend that proposal a little bit it in order to do very
>> simple presentations. This should allow to describe at least part of
>> the slides used in the MOOC course [3].
>>
>> This will be _a possible_ solution to the question brought up in the
>> thread 'Writing "powerpoint" like presentations in Pharo?'.
>>
>> Another use is to write instructions with executable content within
>> the image ("Assistants").
>>
>> So below is the a proposal for a Pillar syntax _subset_ for class
>> comments and _simple_ presentations.
>> The numbering scheme follows the 'Pillar syntax cheat sheet' [2]
>>
>>
>>
>>
>> MINI PILLAR SYNTAX (a subset of Pillar)
>>
>> 1. Headers
>>
>> !Header 1
>> !!Header 2
>> !!!Header 3
>>
>>
>> 2. Lists
>>
>> - Unordered List
>> # Ordered list
>>
>>
>>
>> 5. Emphasis
>>
>> ""bold""
>>
>>
>> 6. Code blocks
>>
>> [[[
>> Transcript show: 'Hello World'.
>> \]]]
>>
>>
>> 9. Annotation
>>
>> ${slide:title=About Pharo}$
>>
>>
>>
>>
>> Next week I plan to implement the rendering of this 'Mini Pillar' in
>> Morphic using the Morphic API subset that works in Pharo and Squeak.
>>
>> A renderer using Bloc would also be nice. [4]
>>
>> Comments, suggestions, code snippets and other help is welcome.
>>
>> Regards
>> Hannes
>>
>>
>>
>>
>>
>> --------------------------------------------------------------------------------------------------
>> [1] Pillar subset for class comments
>>
>> Stephane Ducasse
>> <stepharo.self(a)gmail.com> Fri, Aug 11, 2017 at 7:09 PM
>> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
>>
>> Tx cyril
>>
>> For class comment I image that we want
>>
>> !
>>
>> -
>> -
>> *url*
>> and bold
>> [[[
>>
>> ]]]
>>
>> Did I miss something.
>>
>> Stef
>>
>>
>>
>>
>>
>>
>> --------------------------------------------------------------------------------------------------
>> [2]
>> http://pillarhub.pharocloud.com/hub/pillarhub/pillarcheatsheet
>>
>> --------------------------------------------------------------------------------------------------
>>
>>
>> 1. Headers
>>
>> !Header 1
>> !!Header 2
>> !!!Header 3
>> !!!!Header 4
>> !!!!!Header 5
>> !!!!!!Header 6
>>
>> 2. Lists
>>
>> - Unordered List
>> # Ordered list
>>
>> 3. Table
>>
>> |! Left |! Right |! Centered
>> |{Left |}Right| Centered
>>
>>
>> 4. Description
>> Note
>> on a new line
>>
>> ;head
>> :item
>>
>>
>> 5. Emphasis
>>
>> ""bold""
>> ''italic''
>> --strikethrough--
>> __underscore__
>> ==inline code==
>> @@subscript@@
>> ^^sub-script^^
>>
>> 6. Code blocks
>>
>> [[[labÂel=ÂhelÂloSÂcriÂpt|ÂcapÂtioÂn=How to print Hello
>> World|ÂlanÂguaÂge=ÂSmaÂlltalk
>> Transcript show: 'Hello World'.
>> \]]]
>>
>>
>> 7. Raw
>>
>>
>> {{{latex:
>> this is how you inject raw \LaTeX in your output file
>> }}}
>>
>> {{{marÂkdown:
>> this is how you inject raw `markdown` in your output file
>> }}}
>>
>> {{{html:
>> this is how you inject raw <b>ÂhtmÂl</Âb> in your output file
>> }}}
>>
>>
>> 8. Links
>>
>> Anchor @anchor (new line)
>> Internal link *anchor*
>> External link *Google>http://google.com*
>> Image +Caption>file://image.png|width=50|label=label+
>>
>>
>> 9. Annotation
>> Note
>> on a new line
>>
>> Annotation @@note this is a note
>> Todo item @@todo this is to do
>>
>>
>> 10. Comments
>>
>> % each line starting with % is commented
>>
>>
>> 11. References
>>
>> This document is copied from
>> http://www.cheatography.com/benjaminvanryseghem/cheat-sheets/pillar/
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> [3] Example pillar code for slides
>> ----------------------------------------------------------------------
>>
>>
>> https://github.com/SquareBracketAssociates/PharoMooc/blob/master/Slides/1-T…
>>
>> {
>> "title":"To the Roots of Objects",
>> "subtitle":"Learning from beauty",
>> "author":"Stephane Ducasse",
>> "complement":"http://stephane.ducasse.free.fr/ \\\\
>> stephane.ducasse(a)inria.fr"
>> }
>>
>>
>> ${toc:depthLevel=2|level=0|highlight=0}$
>>
>> %Les sections ne sont pas des titres de slide mais définnissent la
>> structure du doucment. Il est possible de rajouter
>> "renderStructureAsSlide":false dans pillar.conf pour ne pas créer de
>> slide à partir d'un titre.
>>
>>
>> ${slide:title=License}$
>>
>> +>file://figures/CreativeCommons.png|width=50|label=figCreativeCommons+
>>
>>
>> ! Introduction
>>
>> %
>> ${toc:depthLevel=1|level=0|highlight=1}$
>>
>>
>> ${slide:title=Really?!|label=really}$
>>
>> ${columns}$
>>
>> ${column:width=50}$
>>
>> %the width parameter take an Int between 1 and 100
>> %For now we have to pass a line before and after an annotation, I'll
>> correct that soon in Pillar.
>> - No primitive types
>> - No hardcoded constructs for conditional
>> - Only messages
>> - Only objects
>>
>> ${column:width=50}$
>>
>> - and this works?
>> - I mean really?
>> - Not even slow?
>> - Can't be real!
>>
>> ${endColumns}$
>>
>> ${slide:title=Motto}$
>>
>> - Let's open our eyes, look, understand, and deeply understand the
>> underlying design aspects of object-oriented programming.
>>
>>
>> *@really*
>>
>> *TEST !>@really*
>>
>> ${slide:title=Booleans}$
>>
>> [[[language=smalltalk
>> 3 > 0
>> ifTrue: ['positive']
>> ifFalse: ['negative']
>> -> 'positive'
>> ]]]
>>
>> ${slide:title=Yes ifTrue\:ifFalse\: is a message!}$
>>
>> [[[language=smalltalk
>> Weather isRaining
>> ifTrue: [self takeMyUmbrella]
>> ifFalse: [self takeMySunglasses]
>> ]]]
>>
>> - Conceptually ==ifTrue:ifFalse:== is a message sent to an object: a
>> boolean!
>> - ==ifTrue:ifFalse:== is in fact radically optimized by the compiler
>> but you can implement another one such ==siAlors:sinon:== and check.
>>
>> ${slide:title=Booleans}$
>>
>> In Pharo booleans have nothing special
>> - & | not
>> - or: and: (lazy)
>> - xor:
>> - ifTrue:ifFalse:
>> - ifFalse:ifTrue:
>> - ...
>>
>> ${slide:title=Lazy Logical Operators}$
>>
>> *LINK>@frm:really*
>>
>> [[[language=smalltalk
>> false and: [1 error: 'crazy']
>> -> false and not an error
>> ]]]
>>
>> ! Exercices
>> ${toc:depthLevel=1|level=0|highlight=1}$
>>
>> !! Exercise 1: Implement not
>>
>> ${slide:title=Exercise 1\: Implement not}$
>>
>> - Propose an implementation of not in a world where you do not have
>> Booleans.
>> - You only have objects and messages.
>> [[[language=smalltalk
>> false not
>> -> true
>>
>> true not
>> -> false
>> ]]]
>>
>> !!Exercise 2: Implement | (Or) ifTrue: ifFalse:
>>
>> ${toc:depthLevel=2|level=0|highlight=1}$
>>
>> ${slide:title=Exercise 2\: Implement \| (Or)}$
>>
>> - Propose an implementation of or in a world where you do not have
>> Booleans.
>> - You only have objects and messages.
>>
>> [[[language=smalltalk
>> true | true -> true
>> true | false -> true
>> true | anything -> true
>>
>> false | true -> true
>> false | false -> false
>> false | anything -> anything
>> ]]]
>>
>> ${slide:title=Exercise2\: Variation - Implement ifTrue\:ifFalse\:}$
>>
>> - Propose an implementation of not in a world where you do not have
>> Booleans.
>> - You only have objects, messages and closures.
>>
>> [[[language=smalltalk
>> false ifTrue: [ 3 ] ifFalse: [ 5 ]
>> -> 5
>> true ifTrue: [ 3 ] ifFalse: [ 5 ]
>> -> 3
>> ]]]
>>
>> ! Boolean Implementation
>>
>> ${toc:depthLevel=1|level=0|highlight=1}$
>>
>> ${slide:title=Booleans Implementation Hint One}$
>>
>> - The solution does not use conditionals
>> - else we would obtain a recursive definition of ==ifTrue:ifFalse:==
>>
>> ${slide:title=Boolean Implementation Hint Two}$
>>
>> - The solution uses three classes: ==Boolean==, ==True== and ==False==
>> - ==false== and ==true== are unique instances described by their own
>> classes
>> - ==false== is an instance of the class ==False==
>> - ==true== is an instance of the class ==True==
>>
>> +Boolean
>> Hierarchy>file://figures/BooleanHiearchyAndInstances.png|width=50+
>>
>> ${slide:title=How do we express choice in OOP?}$
>>
>> - We send messages to objects
>>
>> [[[language=smalltalk
>> aButton color
>> -> Color red
>>
>> aPane color
>> -> Color blue
>>
>> aWindow color
>> -> Color grey
>> ]]]
>>
>> - Let's the receiver decide
>>
>> - Do not ask, tell
>>
>> ${slide:title=Boolean not implementation}$
>>
>> - Class ==Boolean== is an abstract class that implements behavior
>> common to true and false. Its subclasses are ==True== and ==False==.
>> Subclasses must implement methods for logical operations ==&==,
>> ==not==, and controls ==and:==, ==or:==, ==ifTrue:==, ==ifFalse:==,
>> ==ifTrue:ifFalse:==, ==ifFalse:ifTrue:==
>>
>> [[[language=smalltalk
>> Boolean>>not
>> "Negation. Answer true if the receiver is false, answer false if the
>> receiver is true."
>> self subclassResponsibility
>> ]]]
>>
>> ${slide:title=Not implementation in two methods}$
>>
>> [[[language=smalltalk
>> False>>not
>> "Negation -- answer true since the receiver is false."
>> ^ true
>> ]]]
>>
>> [[[language=smalltalk
>> True>>not
>> "Negation--answer false since the receiver is true."
>> ^ false
>> ]]]
>>
>> ${slide:title=Not implementation in two methods}$
>>
>> +Not
>>
>> implementation.>file://figures/BooleanHiearchyAndInstancesWithNotMethods.png|width=80+
>>
>> ${slide:title=\| (Or)}$
>> [[[language=smalltalk
>>
>> true | true -> true
>> true | false -> true
>> true | anything -> true
>>
>> false | true -> true
>> false | false -> false
>> false | anything -> anything
>>
>> ]]]
>>
>> ${slide:title=Boolean>> \| aBoolean}$
>>
>> [[[language=smalltalk
>> Boolean>> | aBoolean
>> "Evaluating disjunction (OR). Evaluate the argument. Answer true if
>> either the receiver or the argument is
>> true."
>> self subclassResponsibility
>> ]]]
>>
>> ${slide:title=False>> \| aBoolean}$
>>
>> [[[language=smalltalk
>> false | true -> true
>> false | false -> false
>> false | anything -> anything
>> ]]]
>>
>> [[[language=smalltalk
>> False >> | aBoolean
>> "Evaluating disjunction (OR) -- answer with the argument, aBoolean."
>> ^ aBoolean
>> ]]]
>>
>> ${slide:title=True>> \| aBoolean}$
>>
>> [[[language=smalltalk
>> true | true -> true
>> true | false -> true
>> true | anything -> true
>> ]]]
>>
>> [[[language=smalltalk
>> True>> | aBoolean
>> "Evaluating disjunction (OR) -- answer true since the receiver is true."
>> ^ self
>> ]]]
>>
>> ${slide:title=Or implementation in two methods}$
>>
>> +>file://figures/BooleanHiearchyAndInstancesWithOrMethods.png|width=80+
>>
>> ${slide:title=Implementing ifTrue\:ifFalse\:}$
>>
>> - Do you see the pattern?
>> - Remember that a closure freezes execution and that value launches
>> the execution of a frozen code.
>>
>> [[[language=smalltalk
>> True>>ifTrue: aTrueBlock ifFalse: aFalseBlock
>> ^ aTrueBlock value
>> ]]]
>>
>> [[[language=smalltalk
>> False>>ifTrue: aTrueBlock ifFalse: aFalseBlock
>> ^ aFalseBlock value
>> ]]]
>>
>> ${slide:title=Implementation Note}$
>>
>> - Note that the Virtual Machine shortcuts calls to boolean such as
>> condition for speed reason.
>> - But you can implement your own conditional method and debug to see
>> that sending a message is dispatching to the right object.
>>
>> ! So what ?
>>
>> ${toc:depthLevel=1|level=0|highlight=1}$
>>
>> ${slide:title=Ok so what?}$
>>
>> - You will probably not implement another Boolean classes
>> - So is it really that totally useless?
>>
>>
>> ${slide:title=Message sends act as case statements}$
>>
>> - The execution engine will select the right method in the class of the
>> receiver
>> - The case statements is dynamic in the sense that it depends on the
>> classes loaded and the objects to which the message is sent.
>> - Each time you send a message, the system will select the method
>> corresponding to the receiver.
>>
>>
>> ${slide:title=A Class Hierarchy is a Skeleton for Dynamic Dispatch}$
>>
>> - If we would have said that the ==Boolean== would be composed of only
>> one class, we could not have use dynamic binding.
>> - A class hierarchy is the exoskeleton for dynamic binding
>>
>> - Compare the solution with one class vs. a hierarchy.
>>
>> +One single class vs. a nice
>> hierarchy.>file://figures/Design-FatVsDispatch.png|width=70+
>>
>> - The hierarchy provides a way to specialize behavior.
>> - It is also more declarative in the sense that you only focus on one
>> class.
>> - It is more modular in the sense that you can package different
>> classes in different packages.
>>
>> ${slide:title=Avoid Conditionals}$
>>
>> - Use objects and messages, when you can
>> - The execution engine acts as a conditional switch: Use it!
>> - Check the AntiIfCampaign.
>>
>> ${slide:title=Follow-up: Implement ternary logic}$
>>
>> - Boolean: ==true==, ==false==, ==unknown==
>> +Ternaru Logic decision table
>>
>> file://figures/ArrayBoolean.png|width=30|label=fig:ternLogic+
>>
>> - Implementing in your own classes.
>>
>> ! Summary
>>
>> ${toc:depthLevel=1|level=0|highlight=1}$
>>
>> ${slide:title=Summary}$
>> - Tell, do not ask
>> - Let the receiver decide
>> - Message sends as potential dynamic conditional
>> - Class hiearchy builds a skeleton for dynamic dispatch
>> - Avoid conditional
>>
>>
>>
>>
>> -----------------------------------------
>> [4] Bloc
>> Load Bloc with executing in a playground (Pharo 6.1)
>>
>> Metacello new
>> baseline: 'Bloc';
>> repository: 'github://pharo-graphics/Bloc:pharo6.1/src';
>> load: #core
>>
>>
>> A tutorial to use bloc is available on
>> http://files.pharo.org/books/
>> Bloc Memory Game (alpha) is a first tutorial on Bloc the new graphics
>> core for Pharo. Booklet written by A. Chis, S. Ducasse, A. Syrel.
>>
>> http://files.pharo.org/books-pdfs/booklet-Bloc/2017-11-09-memorygame.pdf
>>
>> To load the memory game
>>
>> Metacello new
>> baseline: 'BlocTutorials';
>> repository: 'github://pharo-graphics/Tutorials/src';
>> load
>>
>>
>> A similar booklet could be done for the title
>> 'Doing a presentation / slide show / assitant with Bloc' (or similar,
>> adapt .....)
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> "Obvious things are difficult to teach."
>>
>>
>>
>>
>>
>>
>>
> --
> Cheers,
> Alex
Nov. 14, 2017
Re: [Pharo-users] extending STON
by henry
Thank you, Sven. That was a much better place for internalizing after reconstituting. I now have bi-directional substitutions working with STON. Iâm grateful.
Sent from ProtonMail Mobile
On Tue, Nov 14, 2017 at 09:24, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
> Henry, > On 14 Nov 2017, at 15:02, henry wrote: > > Hello, I am trying to extend STON to allow for substitutions as data is written out or read in. On the write side I got it working as #nextPut: is recursively called, so that is the perfect place to substitute before an object is written. I have tested and my changes work well, where I have an arbitrary object as a subObject and it gets substituted out for my Descriptor object. OK good. > I am having difficult on the read side identifying where a substitution lookup should occur after decoding the object on the input stream. I want to inflate the Descritpor object, with its data, and call for a possible substitution. As it is a Descriptor, it should get substituted with the right bits on the read side. I chose to try and do this in the method #setReference:to: and put the substitute into the objects list. This did not work. Where is a good place to look within STON to do a read-side post-substitution? In STONReader>>#parseObject | targetClass reference object | [ reference := self newReference. targetClass := self parseClass. object := targetClass fromSton: self. self setReference: reference to: object ] ... I would try just re-assigning object with your custom substitute. Like this MySTONReader>>#parseObject | targetClass reference object | [ reference := self newReference. targetClass := self parseClass. object := targetClass fromSton: self. object := object resolveSubstitution. self setReference: reference to: object ] ... The references are used if the same (#==) object is used twice, then you get something like STON fromString: '[Point[1,2],@2]'. which is an 2 element Array where the exact same object is in both positions (structure sharing). This works with circular references too (but be careful because the inspector might loop). HTH, Sven > Thank you. > > - HH > > @callistohouse.club>
Nov. 14, 2017
Re: [Pharo-users] About implementing a "Mini Pillar" in-image renderer for Pharo ...
by Aliaksei Syrel
Hi Offray,
I understand your frustration, but with all respect, the fact that you have
problems with Iceberg does not mean that GT Documenter or any other GT tool
is responsible for described problems.
Most complains about bloc, brick, whatever is because of unrelated stuff.
It is a little bit disappointing. Especially for me, as one of the
maintainers. But it is ok, I got used to it :)
I donât remember when last time I used stable Pharo (not because it does
not exist), simply live on the edge since Pharo4. If no one will use Git
and report problems Iceberg will never progress. If no one will use Bloc it
will never get âthereâ. Unfortunately, living on the edge is dangerous,
requires effort, motivation and time.
The script that Doru provided works flawlessly on OSX, we load it almost
everyday. !! Bloc is tested on CI and builds are green on Windows, Linux
and OSX !!. If computer (CI) manages to install it, I am pretty sure human
can do it too. Looks like there is something missing in your configuration,
something tiny :) Error handling in Iceberg can be definitely improved, but
it is a different story.
P.S. Documenter can be installed without enabled Iceberg integration. This
is how CI does it. You will just not be able to contribute.
Cheers,
Alex
On Tue, 14 Nov 2017 at 16:37, Offray Vladimir Luna Cárdenas <
offray.luna(a)mutabit.com> wrote:
> I have been just trying to install GT Documenter and is really frustrating
> (I have been unable to install it even for the first time!).
>
> This was the list of errors I got and steps I followed, in almost
> sequential order, just to get a (bittersweet!) taste of GT Documenter:
>
> - 1st: LGit_GIT_ERROR: No ssh-agent suitable credentials found. So I
> go to GitHub, follow the five pages of documentation to get my SSH
> credentials that start at [1], then, because I still get the same error, go
> to the Iceberg FAQ [2], try to surpass the erro,r via command line and
> doesn't work, so I go to the Iceberg settings and try the manual
> configuration, going to the next item
>
> [1]
> https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-…
> [2] https://github.com/pharo-vcs/iceberg/blob/master/README.md
>
> - Now I get "Instance of LGitCredentialsSSH class did not understand
> #ifTrue:ifFalse:". I try to make sense of it in the debugger, but is
> something I cannot. Anyway, I rerun it and now I get: LGit_GIT_EEXISTS:
> '/home/offray/Programas/Pharo/6.1a/Dev24/pharo-local/iceberg/feenkcom/gtoolkit'
> exists and is not an empty directory. I delete that directory and try an
> installation... again
> - Now I get: "Instance of FileReference did not understand #notEmpty".
> I try to make sense of it in the debugger. My user is git, my public and
> private ssh keys are not empty. Despite of not making sense of all I
> understand that is trying to clone something at
> git@github.com:feenkcom/gtoolkit.git. I go to my image dir and then to
> `iceberg/feenkcom/gtoolkit/`. There is a git repository there, but is empty.
> - Now I wonder, maybe if I can just clone the directory there, but how
> I say Iceberg to load it? So I run now only the Metacello part. Same error
> and solution that the last time but now for gtoolkit-visualizer, Brick,
> gtoolkit-examples, Bloc and Sparta.
> - After getting my ssh keys, overcome config problems in shell and the
> Pharo settings, chasing these errors and solving them by cloning the
> repositories manually, I'm, a couple of hours later, ready to test GT
> Documenter, but with the last Iceberg's duplicated repository message about
> Sparta I give up. Is not nice to start your day accumulating frustration...
> that sets a bad mood for the rest of it, and you need to actively fight
> against.
>
> I have thought that Git is overcomplicated for most of the developers'
> tasks and communities. I don't know if the root of previous issues is in
> the "Iceberg enableMetacelloIntegration: true" line, but having to get your
> pair of keys working to just install software is overkill for the common
> user (and when LibGit errors are present, the documented solutions don't
> work seamlessly). Maybe a more sensitive solution would be just to use
> libgit, without any ssh auth to clone repositories and its prerequisites or
> even better, some download that goes to the files in the tip (or other)
> version without all this overhead.
>
> Anyway, as I said, I have been unable to test GT Documenter properly and
> getting feedback over GT Tools from the team usually requires a lot of
> effort in my case (insisting on getting answers or getting none). And that
> is just to test a promising tech that still doesn't offer saving features
> (just and awesome preview). I think that a more sensible approach for a
> good documentation toolkit for now is on Spec and creating custom syntax
> highlighters with SmaCC[3], that is well documented and works today.
>
> [3]
> https://medium.com/@juliendelplanque/hacking-a-simple-syntactic-highlighter…
> I understand that community is trying its best, but expressing how current
> offerings are not mature and constructive criticism can help on that. At
> the moment my feeling is that if you want to try the new shinny alpha stuff
> from GT Documenter, you will need to be prepared for a lot of frustration
> and silence.
>
> Cheers,
>
> Offray
>
>
> On 10/11/17 12:41, Tudor Girba wrote:
>
> Hi,
>
> As shown at ESUG, GT Documenter offers an advanced viewer (and editor) for Pillar working on top of Bloc.
>
> You can get it by loading:
>
> Iceberg enableMetacelloIntegration: true.
> Metacello new
> baseline: 'GToolkit';
> repository: 'github://feenkcom/gtoolkit/src';
> load.
>
> For example, you can then inspect:
> 'PATH_TO_ICEBERG/feenkcom/gtoolkit/doc/transcript/index.pillarâ asFileReference
>
> Cheers,
> Doru
>
>
>
> On Nov 10, 2017, at 12:58 PM, H. Hirzel <hannes.hirzel(a)gmail.com> <hannes.hirzel(a)gmail.com> wrote:
>
> A note:
>
> Tudor Girba wrote:<tudor(a)tudorgirba.com> <tudor(a)tudorgirba.com> Fri, Aug 25, 2017 at 1:31 PM
> Reply-To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org> <pharo-users(a)lists.pharo.org>
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org> <pharo-users(a)lists.pharo.org>
>
> Hi,
>
> As mentioned in an announcement about 10 days ago, we are building a
> Pillar editor with inline viewing abilities in Bloc. Here is how it
> looked like. Please note the embedded picture. We continued working on
> it since then and we will probably announce the next version this
> weekend:
>
>
> Maybe there is now enough progress to do simple presentations in Bloc?
>
>
> On 11/10/17, H. Hirzel <hannes.hirzel(a)gmail.com> <hannes.hirzel(a)gmail.com> wrote:
>
> Hello
>
> In the thread 'including Pillar in Pharo image by default' it was
> suggested by Stephane Ducasse to include a subset of Pillar in the
> Pharo image[1] .
>
> I'd like to extend that proposal a little bit it in order to do very
> simple presentations. This should allow to describe at least part of
> the slides used in the MOOC course [3].
>
> This will be _a possible_ solution to the question brought up in the
> thread 'Writing "powerpoint" like presentations in Pharo?'.
>
> Another use is to write instructions with executable content within
> the image ("Assistants").
>
> So below is the a proposal for a Pillar syntax _subset_ for class
> comments and _simple_ presentations.
> The numbering scheme follows the 'Pillar syntax cheat sheet' [2]
>
>
>
>
> MINI PILLAR SYNTAX (a subset of Pillar)
>
> 1. Headers
>
> !Header 1
> !!Header 2
> !!!Header 3
>
>
> 2. Lists
>
> - Unordered List
> # Ordered list
>
>
>
> 5. Emphasis
>
> ""bold""
>
>
> 6. Code blocks
>
> [[[
> Transcript show: 'Hello World'.
> \]]]
>
>
> 9. Annotation
>
> ${slide:title=About Pharo}$
>
>
>
>
> Next week I plan to implement the rendering of this 'Mini Pillar' in
> Morphic using the Morphic API subset that works in Pharo and Squeak.
>
> A renderer using Bloc would also be nice. [4]
>
> Comments, suggestions, code snippets and other help is welcome.
>
> Regards
> Hannes
>
>
>
>
> --------------------------------------------------------------------------------------------------
> [1] Pillar subset for class comments
>
> Stephane Ducasse<stepharo.self(a)gmail.com> <stepharo.self(a)gmail.com> Fri, Aug 11, 2017 at 7:09 PM
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org> <pharo-users(a)lists.pharo.org>
>
> Tx cyril
>
> For class comment I image that we want
>
> !
>
> -
> -
> *url*
> and bold
> [[[
>
> ]]]
>
> Did I miss something.
>
> Stef
>
>
>
>
>
> --------------------------------------------------------------------------------------------------
> [2]http://pillarhub.pharocloud.com/hub/pillarhub/pillarcheatsheet
> --------------------------------------------------------------------------------------------------
>
>
> 1. Headers
>
> !Header 1
> !!Header 2
> !!!Header 3
> !!!!Header 4
> !!!!!Header 5
> !!!!!!Header 6
>
> 2. Lists
>
> - Unordered List
> # Ordered list
>
> 3. Table
>
> |! Left |! Right |! Centered
> |{Left |}Right| Centered
>
>
> 4. Description
> Note
> on a new line
>
> ;head
> :item
>
>
> 5. Emphasis
>
> ""bold""
> ''italic''
> --strikethrough--
> __underscore__
> ==inline code==
> @@subscript@@
> ^^sub-script^^
>
> 6. Code blocks
>
> [[[labÂel=ÂhelÂloSÂcriÂpt|ÂcapÂtioÂn=How to print Hello
> World|ÂlanÂguaÂge=ÂSmaÂlltalk
> Transcript show: 'Hello World'.
> \]]]
>
>
> 7. Raw
>
>
> {{{latex:
> this is how you inject raw \LaTeX in your output file
> }}}
>
> {{{marÂkdown:
> this is how you inject raw `markdown` in your output file
> }}}
>
> {{{html:
> this is how you inject raw <b>ÂhtmÂl</Âb> in your output file
> }}}
>
>
> 8. Links
>
> Anchor @anchor (new line)
> Internal link *anchor*
> External link *Google>http://google.com*
> Image +Caption>file://image.png|width=50|label=label+
>
>
> 9. Annotation
> Note
> on a new line
>
> Annotation @@note this is a note
> Todo item @@todo this is to do
>
>
> 10. Comments
>
> % each line starting with % is commented
>
>
> 11. References
>
> This document is copied fromhttp://www.cheatography.com/benjaminvanryseghem/cheat-sheets/pillar/
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ----------------------------------------------------------------------
> [3] Example pillar code for slides
> ----------------------------------------------------------------------
> https://github.com/SquareBracketAssociates/PharoMooc/blob/master/Slides/1-T…
>
> {
> "title":"To the Roots of Objects",
> "subtitle":"Learning from beauty",
> "author":"Stephane Ducasse",
> "complement":"http://stephane.ducasse.free.fr/ \\\\
> stephane.ducasse(a)inria.fr" <http://stephane.ducasse.free.fr/%5C%5C%5C%5Cstephane.ducasse@inria.fr>
> }
>
>
> ${toc:depthLevel=2|level=0|highlight=0}$
>
> %Les sections ne sont pas des titres de slide mais définnissent la
> structure du doucment. Il est possible de rajouter
> "renderStructureAsSlide":false dans pillar.conf pour ne pas créer de
> slide à partir d'un titre.
>
>
> ${slide:title=License}$
>
> +>file://figures/CreativeCommons.png|width=50|label=figCreativeCommons+
>
>
> ! Introduction
>
> %
> ${toc:depthLevel=1|level=0|highlight=1}$
>
>
> ${slide:title=Really?!|label=really}$
>
> ${columns}$
>
> ${column:width=50}$
>
> %the width parameter take an Int between 1 and 100
> %For now we have to pass a line before and after an annotation, I'll
> correct that soon in Pillar.
> - No primitive types
> - No hardcoded constructs for conditional
> - Only messages
> - Only objects
>
> ${column:width=50}$
>
> - and this works?
> - I mean really?
> - Not even slow?
> - Can't be real!
>
> ${endColumns}$
>
> ${slide:title=Motto}$
>
> - Let's open our eyes, look, understand, and deeply understand the
> underlying design aspects of object-oriented programming.
>
>
> *@really*
>
> *TEST !>@really*
>
> ${slide:title=Booleans}$
>
> [[[language=smalltalk
> 3 > 0
> ifTrue: ['positive']
> ifFalse: ['negative']
> -> 'positive'
> ]]]
>
> ${slide:title=Yes ifTrue\:ifFalse\: is a message!}$
>
> [[[language=smalltalk
> Weather isRaining
> ifTrue: [self takeMyUmbrella]
> ifFalse: [self takeMySunglasses]
> ]]]
>
> - Conceptually ==ifTrue:ifFalse:== is a message sent to an object: a
> boolean!
> - ==ifTrue:ifFalse:== is in fact radically optimized by the compiler
> but you can implement another one such ==siAlors:sinon:== and check.
>
> ${slide:title=Booleans}$
>
> In Pharo booleans have nothing special
> - & | not
> - or: and: (lazy)
> - xor:
> - ifTrue:ifFalse:
> - ifFalse:ifTrue:
> - ...
>
> ${slide:title=Lazy Logical Operators}$
>
> *LINK>@frm:really*
>
> [[[language=smalltalk
> false and: [1 error: 'crazy']
> -> false and not an error
> ]]]
>
> ! Exercices
> ${toc:depthLevel=1|level=0|highlight=1}$
>
> !! Exercise 1: Implement not
>
> ${slide:title=Exercise 1\: Implement not}$
>
> - Propose an implementation of not in a world where you do not have
> Booleans.
> - You only have objects and messages.
> [[[language=smalltalk
> false not
> -> true
>
> true not
> -> false
> ]]]
>
> !!Exercise 2: Implement | (Or) ifTrue: ifFalse:
>
> ${toc:depthLevel=2|level=0|highlight=1}$
>
> ${slide:title=Exercise 2\: Implement \| (Or)}$
>
> - Propose an implementation of or in a world where you do not have
> Booleans.
> - You only have objects and messages.
>
> [[[language=smalltalk
> true | true -> true
> true | false -> true
> true | anything -> true
>
> false | true -> true
> false | false -> false
> false | anything -> anything
> ]]]
>
> ${slide:title=Exercise2\: Variation - Implement ifTrue\:ifFalse\:}$
>
> - Propose an implementation of not in a world where you do not have
> Booleans.
> - You only have objects, messages and closures.
>
> [[[language=smalltalk
> false ifTrue: [ 3 ] ifFalse: [ 5 ]
> -> 5
> true ifTrue: [ 3 ] ifFalse: [ 5 ]
> -> 3
> ]]]
>
> ! Boolean Implementation
>
> ${toc:depthLevel=1|level=0|highlight=1}$
>
> ${slide:title=Booleans Implementation Hint One}$
>
> - The solution does not use conditionals
> - else we would obtain a recursive definition of ==ifTrue:ifFalse:==
>
> ${slide:title=Boolean Implementation Hint Two}$
>
> - The solution uses three classes: ==Boolean==, ==True== and ==False==
> - ==false== and ==true== are unique instances described by their own
> classes
> - ==false== is an instance of the class ==False==
> - ==true== is an instance of the class ==True==
>
> +Boolean Hierarchy>file://figures/BooleanHiearchyAndInstances.png|width=50+
>
> ${slide:title=How do we express choice in OOP?}$
>
> - We send messages to objects
>
> [[[language=smalltalk
> aButton color
> -> Color red
>
> aPane color
> -> Color blue
>
> aWindow color
> -> Color grey
> ]]]
>
> - Let's the receiver decide
>
> - Do not ask, tell
>
> ${slide:title=Boolean not implementation}$
>
> - Class ==Boolean== is an abstract class that implements behavior
> common to true and false. Its subclasses are ==True== and ==False==.
> Subclasses must implement methods for logical operations ==&==,
> ==not==, and controls ==and:==, ==or:==, ==ifTrue:==, ==ifFalse:==,
> ==ifTrue:ifFalse:==, ==ifFalse:ifTrue:==
>
> [[[language=smalltalk
> Boolean>>not
> "Negation. Answer true if the receiver is false, answer false if the
> receiver is true."
> self subclassResponsibility
> ]]]
>
> ${slide:title=Not implementation in two methods}$
>
> [[[language=smalltalk
> False>>not
> "Negation -- answer true since the receiver is false."
> ^ true
> ]]]
>
> [[[language=smalltalk
> True>>not
> "Negation--answer false since the receiver is true."
> ^ false
> ]]]
>
> ${slide:title=Not implementation in two methods}$
>
> +Not
> implementation.>file://figures/BooleanHiearchyAndInstancesWithNotMethods.png|width=80+
>
> ${slide:title=\| (Or)}$
> [[[language=smalltalk
>
> true | true -> true
> true | false -> true
> true | anything -> true
>
> false | true -> true
> false | false -> false
> false | anything -> anything
>
> ]]]
>
> ${slide:title=Boolean>> \| aBoolean}$
>
> [[[language=smalltalk
> Boolean>> | aBoolean
> "Evaluating disjunction (OR). Evaluate the argument. Answer true if
> either the receiver or the argument is
> true."
> self subclassResponsibility
> ]]]
>
> ${slide:title=False>> \| aBoolean}$
>
> [[[language=smalltalk
> false | true -> true
> false | false -> false
> false | anything -> anything
> ]]]
>
> [[[language=smalltalk
> False >> | aBoolean
> "Evaluating disjunction (OR) -- answer with the argument, aBoolean."
> ^ aBoolean
> ]]]
>
> ${slide:title=True>> \| aBoolean}$
>
> [[[language=smalltalk
> true | true -> true
> true | false -> true
> true | anything -> true
> ]]]
>
> [[[language=smalltalk
> True>> | aBoolean
> "Evaluating disjunction (OR) -- answer true since the receiver is true."
> ^ self
> ]]]
>
> ${slide:title=Or implementation in two methods}$
>
> +>file://figures/BooleanHiearchyAndInstancesWithOrMethods.png|width=80+
>
> ${slide:title=Implementing ifTrue\:ifFalse\:}$
>
> - Do you see the pattern?
> - Remember that a closure freezes execution and that value launches
> the execution of a frozen code.
>
> [[[language=smalltalk
> True>>ifTrue: aTrueBlock ifFalse: aFalseBlock
> ^ aTrueBlock value
> ]]]
>
> [[[language=smalltalk
> False>>ifTrue: aTrueBlock ifFalse: aFalseBlock
> ^ aFalseBlock value
> ]]]
>
> ${slide:title=Implementation Note}$
>
> - Note that the Virtual Machine shortcuts calls to boolean such as
> condition for speed reason.
> - But you can implement your own conditional method and debug to see
> that sending a message is dispatching to the right object.
>
> ! So what ?
>
> ${toc:depthLevel=1|level=0|highlight=1}$
>
> ${slide:title=Ok so what?}$
>
> - You will probably not implement another Boolean classes
> - So is it really that totally useless?
>
>
> ${slide:title=Message sends act as case statements}$
>
> - The execution engine will select the right method in the class of the
> receiver
> - The case statements is dynamic in the sense that it depends on the
> classes loaded and the objects to which the message is sent.
> - Each time you send a message, the system will select the method
> corresponding to the receiver.
>
>
> ${slide:title=A Class Hierarchy is a Skeleton for Dynamic Dispatch}$
>
> - If we would have said that the ==Boolean== would be composed of only
> one class, we could not have use dynamic binding.
> - A class hierarchy is the exoskeleton for dynamic binding
>
> - Compare the solution with one class vs. a hierarchy.
>
> +One single class vs. a nice
> hierarchy.>file://figures/Design-FatVsDispatch.png|width=70+
>
> - The hierarchy provides a way to specialize behavior.
> - It is also more declarative in the sense that you only focus on one
> class.
> - It is more modular in the sense that you can package different
> classes in different packages.
>
> ${slide:title=Avoid Conditionals}$
>
> - Use objects and messages, when you can
> - The execution engine acts as a conditional switch: Use it!
> - Check the AntiIfCampaign.
>
> ${slide:title=Follow-up: Implement ternary logic}$
>
> - Boolean: ==true==, ==false==, ==unknown==
> +Ternaru Logic decision table
>
> file://figures/ArrayBoolean.png|width=30|label=fig:ternLogic+
>
> - Implementing in your own classes.
>
> ! Summary
>
> ${toc:depthLevel=1|level=0|highlight=1}$
>
> ${slide:title=Summary}$
> - Tell, do not ask
> - Let the receiver decide
> - Message sends as potential dynamic conditional
> - Class hiearchy builds a skeleton for dynamic dispatch
> - Avoid conditional
>
>
>
>
> -----------------------------------------
> [4] Bloc
> Load Bloc with executing in a playground (Pharo 6.1)
>
> Metacello new
> baseline: 'Bloc';
> repository: 'github://pharo-graphics/Bloc:pharo6.1/src';
> load: #core
>
>
> A tutorial to use bloc is available onhttp://files.pharo.org/books/
> Bloc Memory Game (alpha) is a first tutorial on Bloc the new graphics
> core for Pharo. Booklet written by A. Chis, S. Ducasse, A. Syrel.
> http://files.pharo.org/books-pdfs/booklet-Bloc/2017-11-09-memorygame.pdf
>
> To load the memory game
>
> Metacello new
> baseline: 'BlocTutorials';
> repository: 'github://pharo-graphics/Tutorials/src';
> load
>
>
> A similar booklet could be done for the title
> 'Doing a presentation / slide show / assitant with Bloc' (or similar,
> adapt .....)
>
>
> --www.tudorgirba.comwww.feenk.com
>
> "Obvious things are difficult to teach."
>
>
>
>
>
>
>
>
> --
Cheers,
Alex
Nov. 14, 2017
Re: [Pharo-users] About implementing a "Mini Pillar" in-image renderer for Pharo ...
by Tudor Girba
What operating system are you on? What version of Pharo do you use? Is it 32b or 64b?
Cheers,
Doru
> On Nov 14, 2017, at 5:33 PM, Offray Vladimir Luna Cárdenas <offray.luna(a)mutabit.com> wrote:
>
>
>
> On 14/11/17 10:36, Offray Vladimir Luna Cárdenas wrote:
>
> [...]
>> I have thought that Git is overcomplicated for most of the developers'
>> tasks and communities. I don't know if the root of previous issues is
>> in the "Iceberg enableMetacelloIntegration: true" line, but having to
>> get your pair of keys working to just install software is overkill for
>> the common user (and when LibGit errors are present, the documented
>> solutions don't work seamlessly). Maybe a more sensitive solution
>> would be just to use libgit, without any ssh auth to clone
>> repositories and its prerequisites or even better, some download that
>> goes to the files in the tip (or other) version without all this
>> overhead.
>
> In fact, using "Iceberg enableMetacelloIntegration: false" produce a
> smoother installing experience. Putting this as the first line of the
> script doesn't help to most of the users if we want to enable easy
> feedback. Anyway, after a mostly successful installation, Moz2D
> installation failed, downloading a ~20Mb file and after that saying:
> "Moz2D library is not installed correctly. Select Proceed to continue,
> or close this window to cancel the operation." That made most of the
> examples non functional because of the lack of Moz2D or because some
> deprecation.
>
> Any other way to install Moz2D on Manjaro/Arch Linux or to disable it an
> still be able to use Pillar preview features?
>
> Cheers,
>
> Offray
>
>
--
www.tudorgirba.com
www.feenk.com
"When people care, great things can happen."
Nov. 14, 2017
Re: [Pharo-users] About implementing a "Mini Pillar" in-image renderer for Pharo ...
by Tudor Girba
Hi Offray,
There are two issues that I take from your email. So, please allow me to address them separately:
1. The process of installing the new GT (with Documenter)
GT is meant to load in Pharo 6.1. It is tested tested automatically several times a day both on Windows (Appveyor) and on Linux (Travis CI), and we load it automatically on Mac when we develop. Other people managed to load it as well. That does not mean that there are no problems, but it does mean that there are no problems that we are aware of. So, we need to understand what the issue is.
>From your email I understand that you are using Pharo 6.1. Is it the latest image and VM?
What is the operating system?
What is the exact loading snippet that you used?
Now, please bare in mind that GT relies on the common way of organizing GitHub projects. So, what you describe seems to have to do with Iceberg, not with GT. For example, did you manage to load any other Pharo project from GitHub?
2. There is something about silence which I do not understand. I do not remember a particular question that you asked and you got no answer to. If there was one, I am sorry. Please repost it.
Cheers,
Doru
> On Nov 14, 2017, at 4:36 PM, Offray Vladimir Luna Cárdenas <offray.luna(a)mutabit.com> wrote:
>
> I have been just trying to install GT Documenter and is really frustrating (I have been unable to install it even for the first time!).
>
> This was the list of errors I got and steps I followed, in almost sequential order, just to get a (bittersweet!) taste of GT Documenter:
>
> ⢠1st: LGit_GIT_ERROR: No ssh-agent suitable credentials found. So I go to GitHub, follow the five pages of documentation to get my SSH credentials that start at [1], then, because I still get the same error, go to the Iceberg FAQ [2], try to surpass the erro,r via command line and doesn't work, so I go to the Iceberg settings and try the manual configuration, going to the next item
>
> [1] https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-…
> [2] https://github.com/pharo-vcs/iceberg/blob/master/README.md
>
> ⢠Now I get "Instance of LGitCredentialsSSH class did not understand #ifTrue:ifFalse:". I try to make sense of it in the debugger, but is something I cannot. Anyway, I rerun it and now I get: LGit_GIT_EEXISTS: '/home/offray/Programas/Pharo/6.1a/Dev24/pharo-local/iceberg/feenkcom/gtoolkit' exists and is not an empty directory. I delete that directory and try an installation... again
> ⢠Now I get: "Instance of FileReference did not understand #notEmpty". I try to make sense of it in the debugger. My user is git, my public and private ssh keys are not empty. Despite of not making sense of all I understand that is trying to clone something at git@github.com:feenkcom/gtoolkit.git. I go to my image dir and then to `iceberg/feenkcom/gtoolkit/`. There is a git repository there, but is empty.
> ⢠Now I wonder, maybe if I can just clone the directory there, but how I say Iceberg to load it? So I run now only the Metacello part. Same error and solution that the last time but now for gtoolkit-visualizer, Brick, gtoolkit-examples, Bloc and Sparta.
> ⢠After getting my ssh keys, overcome config problems in shell and the Pharo settings, chasing these errors and solving them by cloning the repositories manually, I'm, a couple of hours later, ready to test GT Documenter, but with the last Iceberg's duplicated repository message about Sparta I give up. Is not nice to start your day accumulating frustration... that sets a bad mood for the rest of it, and you need to actively fight against.
> I have thought that Git is overcomplicated for most of the developers' tasks and communities. I don't know if the root of previous issues is in the "Iceberg enableMetacelloIntegration: true" line, but having to get your pair of keys working to just install software is overkill for the common user (and when LibGit errors are present, the documented solutions don't work seamlessly). Maybe a more sensitive solution would be just to use libgit, without any ssh auth to clone repositories and its prerequisites or even better, some download that goes to the files in the tip (or other) version without all this overhead.
>
> Anyway, as I said, I have been unable to test GT Documenter properly and getting feedback over GT Tools from the team usually requires a lot of effort in my case (insisting on getting answers or getting none). And that is just to test a promising tech that still doesn't offer saving features (just and awesome preview). I think that a more sensible approach for a good documentation toolkit for now is on Spec and creating custom syntax highlighters with SmaCC[3], that is well documented and works today.
> [3] https://medium.com/@juliendelplanque/hacking-a-simple-syntactic-highlighter…
> I understand that community is trying its best, but expressing how current offerings are not mature and constructive criticism can help on that. At the moment my feeling is that if you want to try the new shinny alpha stuff from GT Documenter, you will need to be prepared for a lot of frustration and silence.
>
> Cheers,
>
> Offray
>
> On 10/11/17 12:41, Tudor Girba wrote:
>> Hi,
>>
>> As shown at ESUG, GT Documenter offers an advanced viewer (and editor) for Pillar working on top of Bloc.
>>
>> You can get it by loading:
>>
>> Iceberg enableMetacelloIntegration: true.
>> Metacello new
>> baseline: 'GToolkit';
>> repository: 'github://feenkcom/gtoolkit/src';
>> load.
>>
>> For example, you can then inspect:
>> 'PATH_TO_ICEBERG/feenkcom/gtoolkit/doc/transcript/index.pillarâ asFileReference
>>
>> Cheers,
>> Doru
>>
>>
>>
>>> On Nov 10, 2017, at 12:58 PM, H. Hirzel <hannes.hirzel(a)gmail.com>
>>> wrote:
>>>
>>> A note:
>>>
>>> Tudor Girba wrote:
>>>
>>> <tudor(a)tudorgirba.com>
>>> Fri, Aug 25, 2017 at 1:31 PM
>>> Reply-To: Any question about pharo is welcome
>>> <pharo-users(a)lists.pharo.org>
>>>
>>> To: Any question about pharo is welcome
>>> <pharo-users(a)lists.pharo.org>
>>>
>>>
>>> Hi,
>>>
>>> As mentioned in an announcement about 10 days ago, we are building a
>>> Pillar editor with inline viewing abilities in Bloc. Here is how it
>>> looked like. Please note the embedded picture. We continued working on
>>> it since then and we will probably announce the next version this
>>> weekend:
>>>
>>>
>>> Maybe there is now enough progress to do simple presentations in Bloc?
>>>
>>>
>>> On 11/10/17, H. Hirzel
>>> <hannes.hirzel(a)gmail.com>
>>> wrote:
>>>
>>>> Hello
>>>>
>>>> In the thread 'including Pillar in Pharo image by default' it was
>>>> suggested by Stephane Ducasse to include a subset of Pillar in the
>>>> Pharo image[1] .
>>>>
>>>> I'd like to extend that proposal a little bit it in order to do very
>>>> simple presentations. This should allow to describe at least part of
>>>> the slides used in the MOOC course [3].
>>>>
>>>> This will be _a possible_ solution to the question brought up in the
>>>> thread 'Writing "powerpoint" like presentations in Pharo?'.
>>>>
>>>> Another use is to write instructions with executable content within
>>>> the image ("Assistants").
>>>>
>>>> So below is the a proposal for a Pillar syntax _subset_ for class
>>>> comments and _simple_ presentations.
>>>> The numbering scheme follows the 'Pillar syntax cheat sheet' [2]
>>>>
>>>>
>>>>
>>>>
>>>> MINI PILLAR SYNTAX (a subset of Pillar)
>>>>
>>>> 1. Headers
>>>>
>>>> !Header 1
>>>> !!Header 2
>>>> !!!Header 3
>>>>
>>>>
>>>> 2. Lists
>>>>
>>>> - Unordered List
>>>> # Ordered list
>>>>
>>>>
>>>>
>>>> 5. Emphasis
>>>>
>>>> ""bold""
>>>>
>>>>
>>>> 6. Code blocks
>>>>
>>>> [[[
>>>> Transcript show: 'Hello World'.
>>>> \]]]
>>>>
>>>>
>>>> 9. Annotation
>>>>
>>>> ${slide:title=About Pharo}$
>>>>
>>>>
>>>>
>>>>
>>>> Next week I plan to implement the rendering of this 'Mini Pillar' in
>>>> Morphic using the Morphic API subset that works in Pharo and Squeak.
>>>>
>>>> A renderer using Bloc would also be nice. [4]
>>>>
>>>> Comments, suggestions, code snippets and other help is welcome.
>>>>
>>>> Regards
>>>> Hannes
>>>>
>>>>
>>>>
>>>>
>>>> --------------------------------------------------------------------------------------------------
>>>> [1] Pillar subset for class comments
>>>>
>>>> Stephane Ducasse
>>>>
>>>> <stepharo.self(a)gmail.com>
>>>> Fri, Aug 11, 2017 at 7:09 PM
>>>> To: Any question about pharo is welcome
>>>> <pharo-users(a)lists.pharo.org>
>>>>
>>>>
>>>> Tx cyril
>>>>
>>>> For class comment I image that we want
>>>>
>>>> !
>>>>
>>>> -
>>>> -
>>>> *url*
>>>> and bold
>>>> [[[
>>>>
>>>> ]]]
>>>>
>>>> Did I miss something.
>>>>
>>>> Stef
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --------------------------------------------------------------------------------------------------
>>>> [2]
>>>>
>>>> http://pillarhub.pharocloud.com/hub/pillarhub/pillarcheatsheet
>>>>
>>>> --------------------------------------------------------------------------------------------------
>>>>
>>>>
>>>> 1. Headers
>>>>
>>>> !Header 1
>>>> !!Header 2
>>>> !!!Header 3
>>>> !!!!Header 4
>>>> !!!!!Header 5
>>>> !!!!!!Header 6
>>>>
>>>> 2. Lists
>>>>
>>>> - Unordered List
>>>> # Ordered list
>>>>
>>>> 3. Table
>>>>
>>>> |! Left |! Right |! Centered
>>>> |{Left |}Right| Centered
>>>>
>>>>
>>>> 4. Description
>>>> Note
>>>> on a new line
>>>>
>>>> ;head
>>>> :item
>>>>
>>>>
>>>> 5. Emphasis
>>>>
>>>> ""bold""
>>>> ''italic''
>>>> --strikethrough--
>>>> __underscore__
>>>> ==inline code==
>>>> @@subscript@@
>>>> ^^sub-script^^
>>>>
>>>> 6. Code blocks
>>>>
>>>> [[[labÂel=ÂhelÂloSÂcriÂpt|ÂcapÂtioÂn=How to print Hello
>>>> World|ÂlanÂguaÂge=ÂSmaÂlltalk
>>>> Transcript show: 'Hello World'.
>>>> \]]]
>>>>
>>>>
>>>> 7. Raw
>>>>
>>>>
>>>> {{{latex:
>>>> this is how you inject raw \LaTeX in your output file
>>>> }}}
>>>>
>>>> {{{marÂkdown:
>>>> this is how you inject raw `markdown` in your output file
>>>> }}}
>>>>
>>>> {{{html:
>>>> this is how you inject raw <b>ÂhtmÂl</Âb> in your output file
>>>> }}}
>>>>
>>>>
>>>> 8. Links
>>>>
>>>> Anchor @anchor (new line)
>>>> Internal link *anchor*
>>>> External link *Google>http://google.com*
>>>> Image +Caption>
>>>> file://image.png|width=50|label=label+
>>>>
>>>>
>>>>
>>>> 9. Annotation
>>>> Note
>>>> on a new line
>>>>
>>>> Annotation @@note this is a note
>>>> Todo item @@todo this is to do
>>>>
>>>>
>>>> 10. Comments
>>>>
>>>> % each line starting with % is commented
>>>>
>>>>
>>>> 11. References
>>>>
>>>> This document is copied from
>>>>
>>>> http://www.cheatography.com/benjaminvanryseghem/cheat-sheets/pillar/
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ----------------------------------------------------------------------
>>>> [3] Example pillar code for slides
>>>> ----------------------------------------------------------------------
>>>>
>>>>
>>>> https://github.com/SquareBracketAssociates/PharoMooc/blob/master/Slides/1-T…
>>>>
>>>>
>>>> {
>>>> "title":"To the Roots of Objects",
>>>> "subtitle":"Learning from beauty",
>>>> "author":"Stephane Ducasse",
>>>> "complement":
>>>> "http://stephane.ducasse.free.fr/ \\\\
>>>> stephane.ducasse(a)inria.fr"
>>>>
>>>> }
>>>>
>>>>
>>>> ${toc:depthLevel=2|level=0|highlight=0}$
>>>>
>>>> %Les sections ne sont pas des titres de slide mais définnissent la
>>>> structure du doucment. Il est possible de rajouter
>>>> "renderStructureAsSlide":false dans pillar.conf pour ne pas créer de
>>>> slide à partir d'un titre.
>>>>
>>>>
>>>> ${slide:title=License}$
>>>>
>>>> +>
>>>> file://figures/CreativeCommons.png|width=50|label=figCreativeCommons+
>>>>
>>>>
>>>>
>>>> ! Introduction
>>>>
>>>> %
>>>> ${toc:depthLevel=1|level=0|highlight=1}$
>>>>
>>>>
>>>> ${slide:title=Really?!|label=really}$
>>>>
>>>> ${columns}$
>>>>
>>>> ${column:width=50}$
>>>>
>>>> %the width parameter take an Int between 1 and 100
>>>> %For now we have to pass a line before and after an annotation, I'll
>>>> correct that soon in Pillar.
>>>> - No primitive types
>>>> - No hardcoded constructs for conditional
>>>> - Only messages
>>>> - Only objects
>>>>
>>>> ${column:width=50}$
>>>>
>>>> - and this works?
>>>> - I mean really?
>>>> - Not even slow?
>>>> - Can't be real!
>>>>
>>>> ${endColumns}$
>>>>
>>>> ${slide:title=Motto}$
>>>>
>>>> - Let's open our eyes, look, understand, and deeply understand the
>>>> underlying design aspects of object-oriented programming.
>>>>
>>>>
>>>> *@really*
>>>>
>>>> *TEST !>@really*
>>>>
>>>> ${slide:title=Booleans}$
>>>>
>>>> [[[language=smalltalk
>>>> 3 > 0
>>>> ifTrue: ['positive']
>>>> ifFalse: ['negative']
>>>> -> 'positive'
>>>> ]]]
>>>>
>>>> ${slide:title=Yes ifTrue\:ifFalse\: is a message!}$
>>>>
>>>> [[[language=smalltalk
>>>> Weather isRaining
>>>> ifTrue: [self takeMyUmbrella]
>>>> ifFalse: [self takeMySunglasses]
>>>> ]]]
>>>>
>>>> - Conceptually ==ifTrue:ifFalse:== is a message sent to an object: a
>>>> boolean!
>>>> - ==ifTrue:ifFalse:== is in fact radically optimized by the compiler
>>>> but you can implement another one such ==siAlors:sinon:== and check.
>>>>
>>>> ${slide:title=Booleans}$
>>>>
>>>> In Pharo booleans have nothing special
>>>> - & | not
>>>> - or: and: (lazy)
>>>> - xor:
>>>> - ifTrue:ifFalse:
>>>> - ifFalse:ifTrue:
>>>> - ...
>>>>
>>>> ${slide:title=Lazy Logical Operators}$
>>>>
>>>> *LINK>@frm:really*
>>>>
>>>> [[[language=smalltalk
>>>> false and: [1 error: 'crazy']
>>>> -> false and not an error
>>>> ]]]
>>>>
>>>> ! Exercices
>>>> ${toc:depthLevel=1|level=0|highlight=1}$
>>>>
>>>> !! Exercise 1: Implement not
>>>>
>>>> ${slide:title=Exercise 1\: Implement not}$
>>>>
>>>> - Propose an implementation of not in a world where you do not have
>>>> Booleans.
>>>> - You only have objects and messages.
>>>> [[[language=smalltalk
>>>> false not
>>>> -> true
>>>>
>>>> true not
>>>> -> false
>>>> ]]]
>>>>
>>>> !!Exercise 2: Implement | (Or) ifTrue: ifFalse:
>>>>
>>>> ${toc:depthLevel=2|level=0|highlight=1}$
>>>>
>>>> ${slide:title=Exercise 2\: Implement \| (Or)}$
>>>>
>>>> - Propose an implementation of or in a world where you do not have
>>>> Booleans.
>>>> - You only have objects and messages.
>>>>
>>>> [[[language=smalltalk
>>>> true | true -> true
>>>> true | false -> true
>>>> true | anything -> true
>>>>
>>>> false | true -> true
>>>> false | false -> false
>>>> false | anything -> anything
>>>> ]]]
>>>>
>>>> ${slide:title=Exercise2\: Variation - Implement ifTrue\:ifFalse\:}$
>>>>
>>>> - Propose an implementation of not in a world where you do not have
>>>> Booleans.
>>>> - You only have objects, messages and closures.
>>>>
>>>> [[[language=smalltalk
>>>> false ifTrue: [ 3 ] ifFalse: [ 5 ]
>>>> -> 5
>>>> true ifTrue: [ 3 ] ifFalse: [ 5 ]
>>>> -> 3
>>>> ]]]
>>>>
>>>> ! Boolean Implementation
>>>>
>>>> ${toc:depthLevel=1|level=0|highlight=1}$
>>>>
>>>> ${slide:title=Booleans Implementation Hint One}$
>>>>
>>>> - The solution does not use conditionals
>>>> - else we would obtain a recursive definition of ==ifTrue:ifFalse:==
>>>>
>>>> ${slide:title=Boolean Implementation Hint Two}$
>>>>
>>>> - The solution uses three classes: ==Boolean==, ==True== and ==False==
>>>> - ==false== and ==true== are unique instances described by their own
>>>> classes
>>>> - ==false== is an instance of the class ==False==
>>>> - ==true== is an instance of the class ==True==
>>>>
>>>> +Boolean Hierarchy>
>>>> file://figures/BooleanHiearchyAndInstances.png|width=50+
>>>>
>>>>
>>>> ${slide:title=How do we express choice in OOP?}$
>>>>
>>>> - We send messages to objects
>>>>
>>>> [[[language=smalltalk
>>>> aButton color
>>>> -> Color red
>>>>
>>>> aPane color
>>>> -> Color blue
>>>>
>>>> aWindow color
>>>> -> Color grey
>>>> ]]]
>>>>
>>>> - Let's the receiver decide
>>>>
>>>> - Do not ask, tell
>>>>
>>>> ${slide:title=Boolean not implementation}$
>>>>
>>>> - Class ==Boolean== is an abstract class that implements behavior
>>>> common to true and false. Its subclasses are ==True== and ==False==.
>>>> Subclasses must implement methods for logical operations ==&==,
>>>> ==not==, and controls ==and:==, ==or:==, ==ifTrue:==, ==ifFalse:==,
>>>> ==ifTrue:ifFalse:==, ==ifFalse:ifTrue:==
>>>>
>>>> [[[language=smalltalk
>>>> Boolean>>not
>>>> "Negation. Answer true if the receiver is false, answer false if the
>>>> receiver is true."
>>>> self subclassResponsibility
>>>> ]]]
>>>>
>>>> ${slide:title=Not implementation in two methods}$
>>>>
>>>> [[[language=smalltalk
>>>> False>>not
>>>> "Negation -- answer true since the receiver is false."
>>>> ^ true
>>>> ]]]
>>>>
>>>> [[[language=smalltalk
>>>> True>>not
>>>> "Negation--answer false since the receiver is true."
>>>> ^ false
>>>> ]]]
>>>>
>>>> ${slide:title=Not implementation in two methods}$
>>>>
>>>> +Not
>>>> implementation.>
>>>> file://figures/BooleanHiearchyAndInstancesWithNotMethods.png|width=80+
>>>>
>>>>
>>>> ${slide:title=\| (Or)}$
>>>> [[[language=smalltalk
>>>>
>>>> true | true -> true
>>>> true | false -> true
>>>> true | anything -> true
>>>>
>>>> false | true -> true
>>>> false | false -> false
>>>> false | anything -> anything
>>>>
>>>> ]]]
>>>>
>>>> ${slide:title=Boolean>> \| aBoolean}$
>>>>
>>>> [[[language=smalltalk
>>>> Boolean>> | aBoolean
>>>> "Evaluating disjunction (OR). Evaluate the argument. Answer true if
>>>> either the receiver or the argument is
>>>> true."
>>>> self subclassResponsibility
>>>> ]]]
>>>>
>>>> ${slide:title=False>> \| aBoolean}$
>>>>
>>>> [[[language=smalltalk
>>>> false | true -> true
>>>> false | false -> false
>>>> false | anything -> anything
>>>> ]]]
>>>>
>>>> [[[language=smalltalk
>>>> False >> | aBoolean
>>>> "Evaluating disjunction (OR) -- answer with the argument, aBoolean."
>>>> ^ aBoolean
>>>> ]]]
>>>>
>>>> ${slide:title=True>> \| aBoolean}$
>>>>
>>>> [[[language=smalltalk
>>>> true | true -> true
>>>> true | false -> true
>>>> true | anything -> true
>>>> ]]]
>>>>
>>>> [[[language=smalltalk
>>>> True>> | aBoolean
>>>> "Evaluating disjunction (OR) -- answer true since the receiver is true."
>>>> ^ self
>>>> ]]]
>>>>
>>>> ${slide:title=Or implementation in two methods}$
>>>>
>>>> +>
>>>> file://figures/BooleanHiearchyAndInstancesWithOrMethods.png|width=80+
>>>>
>>>>
>>>> ${slide:title=Implementing ifTrue\:ifFalse\:}$
>>>>
>>>> - Do you see the pattern?
>>>> - Remember that a closure freezes execution and that value launches
>>>> the execution of a frozen code.
>>>>
>>>> [[[language=smalltalk
>>>> True>>ifTrue: aTrueBlock ifFalse: aFalseBlock
>>>> ^ aTrueBlock value
>>>> ]]]
>>>>
>>>> [[[language=smalltalk
>>>> False>>ifTrue: aTrueBlock ifFalse: aFalseBlock
>>>> ^ aFalseBlock value
>>>> ]]]
>>>>
>>>> ${slide:title=Implementation Note}$
>>>>
>>>> - Note that the Virtual Machine shortcuts calls to boolean such as
>>>> condition for speed reason.
>>>> - But you can implement your own conditional method and debug to see
>>>> that sending a message is dispatching to the right object.
>>>>
>>>> ! So what ?
>>>>
>>>> ${toc:depthLevel=1|level=0|highlight=1}$
>>>>
>>>> ${slide:title=Ok so what?}$
>>>>
>>>> - You will probably not implement another Boolean classes
>>>> - So is it really that totally useless?
>>>>
>>>>
>>>> ${slide:title=Message sends act as case statements}$
>>>>
>>>> - The execution engine will select the right method in the class of the
>>>> receiver
>>>> - The case statements is dynamic in the sense that it depends on the
>>>> classes loaded and the objects to which the message is sent.
>>>> - Each time you send a message, the system will select the method
>>>> corresponding to the receiver.
>>>>
>>>>
>>>> ${slide:title=A Class Hierarchy is a Skeleton for Dynamic Dispatch}$
>>>>
>>>> - If we would have said that the ==Boolean== would be composed of only
>>>> one class, we could not have use dynamic binding.
>>>> - A class hierarchy is the exoskeleton for dynamic binding
>>>>
>>>> - Compare the solution with one class vs. a hierarchy.
>>>>
>>>> +One single class vs. a nice
>>>> hierarchy.>
>>>> file://figures/Design-FatVsDispatch.png|width=70+
>>>>
>>>>
>>>> - The hierarchy provides a way to specialize behavior.
>>>> - It is also more declarative in the sense that you only focus on one
>>>> class.
>>>> - It is more modular in the sense that you can package different
>>>> classes in different packages.
>>>>
>>>> ${slide:title=Avoid Conditionals}$
>>>>
>>>> - Use objects and messages, when you can
>>>> - The execution engine acts as a conditional switch: Use it!
>>>> - Check the AntiIfCampaign.
>>>>
>>>> ${slide:title=Follow-up: Implement ternary logic}$
>>>>
>>>> - Boolean: ==true==, ==false==, ==unknown==
>>>> +Ternaru Logic decision table
>>>>
>>>>> file://figures/ArrayBoolean.png|width=30|label=fig:ternLogic+
>>>> - Implementing in your own classes.
>>>>
>>>> ! Summary
>>>>
>>>> ${toc:depthLevel=1|level=0|highlight=1}$
>>>>
>>>> ${slide:title=Summary}$
>>>> - Tell, do not ask
>>>> - Let the receiver decide
>>>> - Message sends as potential dynamic conditional
>>>> - Class hiearchy builds a skeleton for dynamic dispatch
>>>> - Avoid conditional
>>>>
>>>>
>>>>
>>>>
>>>> -----------------------------------------
>>>> [4] Bloc
>>>> Load Bloc with executing in a playground (Pharo 6.1)
>>>>
>>>> Metacello new
>>>> baseline: 'Bloc';
>>>> repository: 'github://pharo-graphics/Bloc:pharo6.1/src';
>>>> load: #core
>>>>
>>>>
>>>> A tutorial to use bloc is available on
>>>>
>>>> http://files.pharo.org/books/
>>>>
>>>> Bloc Memory Game (alpha) is a first tutorial on Bloc the new graphics
>>>> core for Pharo. Booklet written by A. Chis, S. Ducasse, A. Syrel.
>>>>
>>>>
>>>> http://files.pharo.org/books-pdfs/booklet-Bloc/2017-11-09-memorygame.pdf
>>>>
>>>>
>>>> To load the memory game
>>>>
>>>> Metacello new
>>>> baseline: 'BlocTutorials';
>>>> repository: 'github://pharo-graphics/Tutorials/src';
>>>> load
>>>>
>>>>
>>>> A similar booklet could be done for the title
>>>> 'Doing a presentation / slide show / assitant with Bloc' (or similar,
>>>> adapt .....)
>>>>
>>>>
>> --
>>
>> www.tudorgirba.com
>> www.feenk.com
>>
>>
>> "Obvious things are difficult to teach."
>>
>>
>>
>>
>>
>>
>>
>
--
www.tudorgirba.com
www.feenk.com
"Don't give to get. Just give."
Nov. 14, 2017
Re: [Pharo-users] About implementing a "Mini Pillar" in-image renderer for Pharo ...
by Offray Vladimir Luna Cárdenas
On 14/11/17 10:36, Offray Vladimir Luna Cárdenas wrote:
[...]
> I have thought that Git is overcomplicated for most of the developers'
> tasks and communities. I don't know if the root of previous issues is
> in the "Iceberg enableMetacelloIntegration: true" line, but having to
> get your pair of keys working to just install software is overkill for
> the common user (and when LibGit errors are present, the documented
> solutions don't work seamlessly). Maybe a more sensitive solution
> would be just to use libgit, without any ssh auth to clone
> repositories and its prerequisites or even better, some download that
> goes to the files in the tip (or other) version without all this
> overhead.
In fact, using "Iceberg enableMetacelloIntegration: false" produce a
smoother installing experience. Putting this as the first line of the
script doesn't help to most of the users if we want to enable easy
feedback. Anyway, after a mostly successful installation, Moz2D
installation failed, downloading a ~20Mb file and after that saying:
"Moz2D library is not installed correctly. Select Proceed to continue,
or close this window to cancel the operation." That made most of the
examples non functional because of the lack of Moz2D or because some
deprecation.
Any other way to install Moz2D on Manjaro/Arch Linux or to disable it an
still be able to use Pillar preview features?
Cheers,
Offray
Nov. 14, 2017
Re: [Pharo-users] Pharo-Chrome (was: Soup bug(fix))
by Alistair Grant
I've committed some fixes to the development branch:
1. MacOS hopefully works now (I don't have access to the platform, so
can't test it).
2. The development version of Beacon is loaded (which is required for
the InMemoryLogger).
3. The README is a tiny bit better.
4. Added #extractTables.
As an example of how historical stock market data can be extracted,
the following retrieves data for the Australian S&P200 index from
yahoo:
| rootNode tables historicalData dataFrame |
rootNode := GoogleChrome get:
'https://finance.yahoo.com/quote/%5EAXJO/history?p=%5EAXJO'.
tables := rootNode extractTables.
historicalData := (tables sorted: #size ascending) last.
dataFrame := DataFrame fromRows: (historicalData select: [ :each |
each size = 7 ]).
dataFrame asStringTable.
"
| 1 2 3 4 5 6
7
-----+-----------------------------------------------------------------------------
1 | Date Open High Low Close* Adj
Close** Volume
2 | Nov 14, 2017 6,021.80 6,021.80 5,957.10 5,966.00 5,966.00
-
3 | Nov 13, 2017 6,029.40 6,029.40 6,010.70 6,021.80 6,021.80
-
4 | Nov 10, 2017 6,049.40 6,049.40 6,020.70 6,029.40 6,029.40
-
etc.
"
To load the development version on MacOS or Linux in a 32 bit image:
"Assuming you don't have OSProcess loaded:"
Metacello new
configuration: 'OSSubprocess';
repository: 'github://marianopeck/OSSubprocess:master/repository';
version: #stable;
load.
Metacello new
baseline: 'Chrome';
repository: 'github://akgrant43/Pharo-Chrome:development/repository';
load.
Cheers,
Alistair
On 12 November 2017 at 20:09, Alistair Grant <akgrant0710(a)gmail.com> wrote:
> Hi Sean,
>
> Thanks for your feedback! (responses below)
>
>
> On 12 November 2017 at 18:11, Sean P. DeNigris <sean(a)clipperadams.com> wrote:
>> Alistair Grant wrote
>>> https://github.com/akgrant43/Pharo-Chrome
>>
>> Wow, that was a wild ride!
>
> Sorry about that.
>
>
>> Lessons learned along the way:
>> 1. On a Mac, to use the snazzy `chrome` terminal command referenced all over
>> the place in the docs, you must first `alias chrome="/Applications/Google\
>> Chrome.app/Contents/MacOS/Google\ Chrome"`
>
> I'm an Ubuntu Linux user, however if you look at OSXChromePlatform
> class>>defaultExecutableLocation you can see that is where it should
> be looking for the exe, so the alias shouldn't really be necessary.
> Torsten wrote this, so maybe has more insight.
>
>
>> 2. Chrome must be started with certain flags: `chrome
>> --remote-debugging-port=9222 --disable-gpu` (not sure if the last flag is
>> needed, but `#get:` seemed to hang before using; reference
>> https://developers.google.com/web/updates/2017/04/headless-chrome)
>
> I've been using this without headless mode. I'll add a headless flag
> that also disables the gpu.
>
>
>
>> 3. Beacon has renamed InMemoryLogger to MemoryLogger
>> 4. I guess Beacon has renamed `#log` to `#emit`
>
> Sorry about that. I didn't realise that the Pharo-Chrome baseline is
> loading Beacon stable while my install script upgrades it to
> #development. #development is more recent, so I'll update the
> baseline.
>
>
>
>> 5. I had to comment out `chromeProcess sigterm.` because `chromeProcess` was
>> nil and also #sigterm seemed not to be defined anywhere in the image. I'm
>> not sure what the issue is there.
>
> chromeProcess is set in GoogleChrome>>openURL:. Can you give me a
> small example that demonstrates the problem?
>
> #sigterm is implemented by OSSUnixSubprocess, which is what I
> ultimately use to launch the Chrome process on Ubuntu.
>
> But... this will be broken on Mac at the moment because the current
> method of launching chrome doesn't keep track of the process, so
> doesn't support #sigterm. Do you know if OSSUnixSubprocess works on
> Mac? If it does, I can update the code (but not test it :-().
>
>
>> Pull request issued for #3 & #4.
>
> Once I update the baseline this shouldn't be required.
>
>
>> Also, I'm not sure what platforms you
>> support, but you may want to tag the example methods with <gtExample> or
>> similar so that they are runnable from the browser and open an inspector if
>> there is an interesting return value.
>
> Good idea, I'll do this.
>
> I'm also making a few other changes:
>
> 1. Add an #extractTables method that searches through the page and
> returns an array of rows for each table it finds in the page
> (something that can easily be loaded in to DataFrame using #fromRows:,
> but I don't want to make Pharo-Chrome dependent on DataFrame at the
> moment). Most of the time I use Pharo-Chrome it is extracting data
> from tables.
>
> 2. I don't know of any reliable way to tell when a page has loaded
> since there can always be javascript that periodically updates the
> page. At the moment it waits until the page hasn't changed for a
> configurable amount of time. I'm planning to add a check for specific
> content to determine if the page is considered loaded.
>
> 3. Add some documentation to the readme :-)
>
>
>
>> -----
>> Cheers,
>> Sean
>
> I'll let you know when I have a new version available (hopefully in
> the next few days).
>
>
> Thanks again,
> Alistair
Nov. 14, 2017
Re: [Pharo-users] FFIExternalEnumeration int versus long
by Todd Blanchard
Yeah, I don't know if that is necessarily worth doing TBH.
Generally enumerations are going to be default int size unless you have values that are out of range.
In this case you have a function that returns a long. In a strictly typed language you would be required to do a type cast anyhow.
If this were done in Swift, you'd have to do something heinous like
FPDF_ERR.fromRaw(FPDF_GetLastError()) // older Swift
FPDF_ERR(rawValue: FPDF_GetLastError())
even C++ would require you cast from unsigned long to the enum type.
So, to me, it makes sense with this kind of api that you'd have to explicitly convert in the method that does the ffiCall:, get the result, then look up the proper enum.
> On Nov 14, 2017, at 2:44 AM, Esteban Lorenzano <estebanlm(a)gmail.com> wrote:
>
> right now FFIExternalEnumeration support int32 and uint32 types, but I think is not hard to create a FFIExternalLongEnumeration or whatever is need.
>
> FFIExternalEnumeration >> initializeEnumeration, however, could be better refactored, I admit ;)
>
>> On 13 Nov 2017, at 23:41, Ben Coman <btc(a)openInWorld.com <mailto:btc@openInWorld.com>> wrote:
>>
>> I have a C definition...
>> unsigned long FPDF_GetLastError();
>>
>> whose return values are...
>> #define FPDF_ERR_SUCCESS 0 // No error.
>> #define FPDF_ERR_UNKNOWN 1 // Unknown error.
>> #define FPDF_ERR_FILE 2 // File not found or could not be opened.
>> #define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted.
>> #define FPDF_ERR_PASSWORD 4 // Password required or incorrect password.
>> #define FPDF_ERR_SECURITY 5 // Unsupported security scheme.
>> #define FPDF_ERR_PAGE 6 // Page not found or content error.
>>
>> I was thinking of turning those #define's into an FFIExternalEnumeration,
>> but I was wondering if I'll hit some undefined behaviour with the underlying representation being a "long" rather than an "int" ?
>>
>> I do see here that C enumerations can be a range of types including "long"
>> * https://stackoverflow.com/questions/7093360/c-sharp-enum-of-long-values <https://stackoverflow.com/questions/7093360/c-sharp-enum-of-long-values>
>> but I'm not sure how it works in the Pharo context to know what the size underlying representation.
>>
>> cheers -ben
>
Nov. 14, 2017