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] About implementing a "Mini Pillar" in-image renderer for Pharo ...
by H. Hirzel
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 .....)
>
Nov. 10, 2017
Re: [Pharo-users] Writing "powerpoint" like presentations in Pharo?
by Marcus Denker
>>
>> My Bloc experiments on vimeo are helping me test hypotheses on how I'd
>> want to work with it.
>
> Links to the videos?
>
Creating Bloc Widgets in Pharo
https://vimeo.com/235934701
Creating Bloc Widgets in Pharo 2: ColorPanel
https://vimeo.com/236419682
I will add that to the next Monthly pharo newsletter, too.
Marcus
Nov. 10, 2017
Re: [Pharo-users] I18n in pharo
by Cédrick Béler
>
> A cleaner Pharo will help there.
>
> To be frank, I found later Pharo releases not inspiring. Bigger, bigger and bigger with added code, protocol changes, and bugs at will. It is becoming too complicated for a hobby use of it.
Itâs quite a moving target with so many fundamental changes (GIT being one, Bootstrap another huge one).
But I have the opposite impression (of course I donât have to maintain a big project like yours - I wouldnât say youâre the hobby user :) ). But I really find P6 more consistent than what I used to try in the past (last squeaks up to 3.9 and firsts pharo).
And the bootstrapping of P7 will (I think) finally solve big image issues (allowing to build cleaner distributions). I believe it will be a huge step forward. At least for me and especially to convince others to try out Pharo.
I just dream of having a network of small images running and communicating, eventually accessed and programmed by a larger developper image (with TelePharo).
I havenât tried the bootstrap yet but sure in the future.
Plus I have the impression Morphic mess is about to be solved.
Whatâs more problematic to me (as I guess for newcomers) is to find the âgoodâ packages'. For instance, Iâm still puzzled when I have to choose between OSProcess and OSSubprocess (and sometimes depending on loaded projects, we need bothâ¦).
>
> I decided I will not finish porting DrGeo to P6 or P7, and it will likely die with P3.
>
> Pharo should have been clean up to the bones before adding. It was the initial moto, no?
I have the (naive) impression that bootstrap will help a lot here, so be patient ;). Maybe porting to P7/P8 will be more appropriate.
What I would like, is a kind of notation for package to know its state and usage possibilities.
We see for instance that several I18N exists already (but not 100% integrated hence this post)...
My 2 cents,
Cédrick
OT question: Would it be possible in the future to generate a bootstrap image of a given program from a bigger developer image containing running program (like if running tests where activating all code dependancies ? ⦠like tracing usage⦠I guess this is not trivial at all ! I guess this is particularly difficult to trace all use cases and as dynamically bound, it sure must be hard).
>
>
> Le 10/11/2017 à 11:14, Marcus Denker a écrit :
>> It would be nice if someone who uses it would take the lead
>> so we can improve the default that is shipped with Pharo.
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>
Nov. 10, 2017
Re: [Pharo-users] Writing "powerpoint" like presentations in Pharo?
by H. Hirzel
On 11/3/17, Stephan Eggermont <stephan(a)stack.nl> wrote:
> On 03/11/17 12:33, Tim Mackinnon wrote:
>> Cool - great minds think alike ;)
>
> :)
>
>> In your photo - there is keynote, are you creating there and then
>> rendering in Pharo - or are you exporting to keynote to had out
>> afterwards?
>
> That was the first experiment. I took a slide from a keynote
> presentation I have made and tried reproducing it in Bloc. The quality
> of the graphics and typographical support is now good enough to do that.
> It is a page from
> https://medium.com/concerning-pharo/pharo-50c66685913c
Is the code available somewhere?
> I'm not yet sure how I'd want it integrated with gtInspector, how to
> have a slide-specific DSL and what kind of storage format to use.
>
> My Bloc experiments on vimeo are helping me test hypotheses on how I'd
> want to work with it.
Links to the videos?
Thanks in advance
Hannes
> Last week I was distracted by private reasons, the
> weeks before that with PharoLauncher, P3, Iceberg...
>
> Interaction between text areas and drag and drop was not yet working as
> I wanted it to.
>
> Earlier experiments I've done with a glamour based browser, including
> exercises where save would recompile a method and show the results
>
> Stephan
>
>
>
Nov. 10, 2017
Re: [Pharo-users] Pharo 6.1 UTF8InvalidText error
by Sven Van Caekenberghe
Denis,
His problem is much more fundamental: his Pharo image does not start up (correctly) because some of its paths (his directory/folder names) where Pharo is located uses Cyrillic characters. He has no chance to fix this. I think this is a problem with FileSystem path decoding on Windows. First we needed a way to reproduce this exactly, as always.
Sven
> On 10 Nov 2017, at 11:44, Denis Kudriashov <dionisiydk(a)gmail.com> wrote:
>
> Hi.
> Sorry for the late response. I skipped your mail somehow.
>
> You need to try CP1251 converter. In past I used CP1251TextConverter from http://www.squeaksource.com/RussianSupport.html.
> But now there is very nice ZnCharacterEncoder hierarchy which provides out of the box main encodings. To get cp1251 encoder evaluate:
> 'cp1251' asZnCharacterEncoder
> I not tried to use it in practice. So I could not give you examples for this. But I hope it gives you directions to look at.
>
> And question for others: should not we deprecate old TextConverter's and move to zn encoders completely?
>
> 2017-11-01 7:15 GMT+01:00 ÐикенÑий ÐоÑапов <vikenti.potapov(a)gmail.com>:
>
> Good day!
> Now i download fresh latest pharo archive and unzipped it to C:\Pharo 6.1.
> The error still exists.
> Debugging shows that error comes with reading from environment varaible:
> ...
> ByteString(String) convertFromWithConverter:
> FilePathEncoder class decode:
> WindowsResolver(platformResolver) resolveString:
> WindowsResolver(platformResolver) directoryFromEnvVariableNamed:or:
> ...
>
> it tries to read 'USERPROFILE', get envValue 'C:\Users\ÐикенÑий' and can't parse cyrillic characters in this path.
>
> Please, tell me how to fix it by myself.
>
> Best regards, Vikenti.
>
>
>
>
>
Nov. 10, 2017
Re: [Pharo-users] I18n in pharo
by H. Hirzel
Maybe in a different thread...
On 11/10/17, H. Hirzel <hannes.hirzel(a)gmail.com> wrote:
> On 11/10/17, Hilaire <hilaire(a)drgeo.eu> wrote:
>> A cleaner Pharo will help there.
>>
>> To be frank, I found later Pharo releases not inspiring. Bigger, bigger
>> and bigger with added code, protocol changes, and bugs at will. It is
>> becoming too complicated for a hobby use of it.
>>
>> I decided I will not finish porting DrGeo to P6 or P7, and it will
>> likely die with P3.
>
> What are the main show stoppers which make it difficult to port your
> application to P6?
>
>>
>> Pharo should have been clean up to the bones before adding. It was the
>> initial moto, no?
>>
>>
>> Le 10/11/2017 à 11:14, Marcus Denker a écrit :
>>> It would be nice if someone who uses it would take the lead
>>> so we can improve the default that is shipped with Pharo.
>>
>> --
>> Dr. Geo
>> http://drgeo.eu
>>
>>
>>
>>
>
Nov. 10, 2017
Re: [Pharo-users] I18n in pharo
by H. Hirzel
On 11/10/17, Hilaire <hilaire(a)drgeo.eu> wrote:
> A cleaner Pharo will help there.
>
> To be frank, I found later Pharo releases not inspiring. Bigger, bigger
> and bigger with added code, protocol changes, and bugs at will. It is
> becoming too complicated for a hobby use of it.
>
> I decided I will not finish porting DrGeo to P6 or P7, and it will
> likely die with P3.
What are the main show stoppers which make it difficult to port your
application to P6?
>
> Pharo should have been clean up to the bones before adding. It was the
> initial moto, no?
>
>
> Le 10/11/2017 à 11:14, Marcus Denker a écrit :
>> It would be nice if someone who uses it would take the lead
>> so we can improve the default that is shipped with Pharo.
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>
>
Nov. 10, 2017
Re: [Pharo-users] I18n in pharo
by Hilaire
A cleaner Pharo will help there.
To be frank, I found later Pharo releases not inspiring. Bigger, bigger
and bigger with added code, protocol changes, and bugs at will. It is
becoming too complicated for a hobby use of it.
I decided I will not finish porting DrGeo to P6 or P7, and it will
likely die with P3.
Pharo should have been clean up to the bones before adding. It was the
initial moto, no?
Le 10/11/2017 à 11:14, Marcus Denker a écrit :
> It would be nice if someone who uses it would take the lead
> so we can improve the default that is shipped with Pharo.
--
Dr. Geo
http://drgeo.eu
Nov. 10, 2017
Re: [Pharo-users] Pharo 6.1 UTF8InvalidText error
by Denis Kudriashov
Hi.
Sorry for the late response. I skipped your mail somehow.
You need to try CP1251 converter. In past I used CP1251TextConverter from
http://www.squeaksource.com/RussianSupport.html.
But now there is very nice ZnCharacterEncoder hierarchy which provides out
of the box main encodings. To get cp1251 encoder evaluate:
'cp1251' asZnCharacterEncoder
I not tried to use it in practice. So I could not give you examples for
this. But I hope it gives you directions to look at.
And question for others: should not we deprecate old TextConverter's and
move to zn encoders completely?
2017-11-01 7:15 GMT+01:00 ÐикенÑий ÐоÑапов <vikenti.potapov(a)gmail.com>:
>
> Good day!
> Now i download fresh latest pharo archive and unzipped it to C:\Pharo 6.1.
> The error still exists.
> Debugging shows that error comes with reading from environment varaible:
> ...
> ByteString(String)
> convertFromWithConverter:
> FilePathEncoder class decode:
> WindowsResolver(platformResolver) resolveString:
> WindowsResolver(platformResolver) directoryFromEnvVariableNamed:or:
> ...
>
> it tries to read 'USERPROFILE', get envValue 'C:\Users\ÐикенÑий' and can't
> parse cyrillic characters in this path.
>
> Please, tell me how to fix it by myself.
>
> Best regards, Vikenti.
>
>
>
>
>
Nov. 10, 2017
About implementing a "Mini Pillar" in-image renderer for Pharo ...
by H. Hirzel
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 .....)
Nov. 10, 2017