new pharo cheatsheet

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

Re: new pharo cheatsheet

stepharo
new syntaxsheet



pharoCheatSheet.pdf (757K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Eliot Miranda-2

Hi Stef,


"boolean objects" => "the boolean objects"
"the receiver, in the superclass context" => "ditto, for accessing overridden inherited methods"
"the current invocation on the call stack" => "the current method or block activation"

_,,,^..^,,,_ (phone)

On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:

new syntaxsheet


<pharoCheatSheet.pdf>
Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Eliot Miranda-2
In reply to this post by stepharo
In the "common constructs" conditionals and iterations tables, the Java appears on the left and the Smalltalk on the right.  In other tables the Smalltalk occurs on the left and the explanation appears on the right.  Hence, in the conditionals and iterations tables, put the Java on the right.

Personally I very much /would/ include ". statement separator" in the reserved syntactic constructs table.  I might try and split the table into "syntax" ( "comment" ; . and ^ ) and "object constructors" tables (everything else).

_,,,^..^,,,_ (phone)

> On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:
>
> new syntaxsheet
>
>
> <pharoCheatSheet.pdf>

Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Eliot Miranda-2
In reply to this post by stepharo
#(4 3 1) at: 3 put: 6 => either

#(4 3 1) copy at: 3 put: 6

or

{ 4. 3. 1} at: 3 put: 6

Sooner or later literals are going to be immutable and then #(4 3 1) at: 3 put: 6 will raise an exception.

_,,,^..^,,,_ (phone)

> On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:
>
> new syntaxsheet
>
>
> <pharoCheatSheet.pdf>

Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Eliot Miranda-2
In reply to this post by stepharo
"There is no type declaration, ..." => "There are no type declarations, ..."

_,,,^..^,,,_ (phone)

> On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:
>
> new syntaxsheet
>
>
> <pharoCheatSheet.pdf>

Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Eliot Miranda-2
In reply to this post by stepharo
"a debugger, a workspace and object inspectors" => "compiler, debugger, workspace, object inspectors"
 and maybe drop "object"

then it flows into "and much, much more".  That the compiler is implemented in Smalltalk is v important, IMO.

_,,,^..^,,,_ (phone)

> On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:
>
> new syntaxsheet
>
>
> <pharoCheatSheet.pdf>

Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

stepharo
In reply to this post by Eliot Miranda-2


Le 12/4/16 13:39, Eliot Miranda a écrit :
> #(4 3 1) at: 3 put: 6 => either
>
> #(4 3 1) copy at: 3 put: 6
>
> or
>
> { 4. 3. 1} at: 3 put: 6
>
> Sooner or later literals are going to be immutable and then #(4 3 1) at: 3 put: 6 will raise an exception.

eager to have that :)

I used the copy.

>
> _,,,^..^,,,_ (phone)
>
>> On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:
>>
>> new syntaxsheet
>>
>>
>> <pharoCheatSheet.pdf>
>


Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

stepharo
In reply to this post by Eliot Miranda-2
Hi eliot

I took everything into account except the

Personally I very much /would/ include ". statement separator" in the reserved syntactic constructs table.  I might try and split the table into "syntax" ( "comment" ; . and ^ ) and "object constructors" tables (everything else).


I have to digest it and now I should finish some other work for the mooc.
I'm fighting a lot with the space :)

Stef


Le 12/4/16 13:35, Eliot Miranda a écrit :

> In the "common constructs" conditionals and iterations tables, the Java appears on the left and the Smalltalk on the right.  In other tables the Smalltalk occurs on the left and the explanation appears on the right.  Hence, in the conditionals and iterations tables, put the Java on the right.
>
> Personally I very much /would/ include ". statement separator" in the reserved syntactic constructs table.  I might try and split the table into "syntax" ( "comment" ; . and ^ ) and "object constructors" tables (everything else).
>
> _,,,^..^,,,_ (phone)
>
>> On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:
>>
>> new syntaxsheet
>>
>>
>> <pharoCheatSheet.pdf>
>


pharoCheatSheet.pdf (758K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Hannes Hirzel
Hello

Is the cheat sheet
http://files.pharo.org/media/pharoCheatSheet.pdf

up to date for Pharo 6.1 and Pharo 7?

In particular - the references to the main web sites, are they still OK?


MainWebSites
- Codehosting http://smalltalkhub.com
- Questions http://discord.gg/Sj2rhxn
- Blog http://pharoweekly.wordpress.com
- Contributors http://pharo.org/about
- Topics http://topics.pharo.org
- Consortium http://consortium.pharo.org
- Association http://association.pharo.org

Pharo Books

Pharo books are available at: http://books.pharo.org
Pharo By Example, Deep into Pharo, Enterprise Pharo: a Web
Perspective, Numerical Methods in Pharo, TinyBlog Tutorial,
Dynamic Web Development in Seaside (http://book.seaside.st)
More books http://stephane.ducasse.free.fr/FreeBooks

--Hannes

On 4/12/16, stepharo <[hidden email]> wrote:

> Hi eliot
>
> I took everything into account except the
>
> Personally I very much /would/ include ". statement separator" in the
> reserved syntactic constructs table.  I might try and split the table into
> "syntax" ( "comment" ; . and ^ ) and "object constructors" tables
> (everything else).
>
>
> I have to digest it and now I should finish some other work for the mooc.
> I'm fighting a lot with the space :)
>
> Stef
>
>
> Le 12/4/16 13:35, Eliot Miranda a écrit :
>> In the "common constructs" conditionals and iterations tables, the Java
>> appears on the left and the Smalltalk on the right.  In other tables the
>> Smalltalk occurs on the left and the explanation appears on the right.
>> Hence, in the conditionals and iterations tables, put the Java on the
>> right.
>>
>> Personally I very much /would/ include ". statement separator" in the
>> reserved syntactic constructs table.  I might try and split the table into
>> "syntax" ( "comment" ; . and ^ ) and "object constructors" tables
>> (everything else).
>>
>> _,,,^..^,,,_ (phone)
>>
>>> On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:
>>>
>>> new syntaxsheet
>>>
>>>
>>> <pharoCheatSheet.pdf>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Stephane Ducasse-3
normally yes.


On Thu, Mar 8, 2018 at 10:48 AM, H. Hirzel <[hidden email]> wrote:

> Hello
>
> Is the cheat sheet
> http://files.pharo.org/media/pharoCheatSheet.pdf
>
> up to date for Pharo 6.1 and Pharo 7?
>
> In particular - the references to the main web sites, are they still OK?
>
>
> MainWebSites
> - Codehosting http://smalltalkhub.com
> - Questions http://discord.gg/Sj2rhxn
> - Blog http://pharoweekly.wordpress.com
> - Contributors http://pharo.org/about
> - Topics http://topics.pharo.org
> - Consortium http://consortium.pharo.org
> - Association http://association.pharo.org
>
> Pharo Books
>
> Pharo books are available at: http://books.pharo.org
> Pharo By Example, Deep into Pharo, Enterprise Pharo: a Web
> Perspective, Numerical Methods in Pharo, TinyBlog Tutorial,
> Dynamic Web Development in Seaside (http://book.seaside.st)
> More books http://stephane.ducasse.free.fr/FreeBooks
>
> --Hannes
>
> On 4/12/16, stepharo <[hidden email]> wrote:
>> Hi eliot
>>
>> I took everything into account except the
>>
>> Personally I very much /would/ include ". statement separator" in the
>> reserved syntactic constructs table.  I might try and split the table into
>> "syntax" ( "comment" ; . and ^ ) and "object constructors" tables
>> (everything else).
>>
>>
>> I have to digest it and now I should finish some other work for the mooc.
>> I'm fighting a lot with the space :)
>>
>> Stef
>>
>>
>> Le 12/4/16 13:35, Eliot Miranda a écrit :
>>> In the "common constructs" conditionals and iterations tables, the Java
>>> appears on the left and the Smalltalk on the right.  In other tables the
>>> Smalltalk occurs on the left and the explanation appears on the right.
>>> Hence, in the conditionals and iterations tables, put the Java on the
>>> right.
>>>
>>> Personally I very much /would/ include ". statement separator" in the
>>> reserved syntactic constructs table.  I might try and split the table into
>>> "syntax" ( "comment" ; . and ^ ) and "object constructors" tables
>>> (everything else).
>>>
>>> _,,,^..^,,,_ (phone)
>>>
>>>> On Apr 11, 2016, at 11:58 PM, stepharo <[hidden email]> wrote:
>>>>
>>>> new syntaxsheet
>>>>
>>>>
>>>> <pharoCheatSheet.pdf>
>>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Sean P. DeNigris
Administrator
In reply to this post by stepharo
stepharo wrote
> new cheatsheet for Pharo syntax.
> Any feedback is welcome

Looks great! (and surprise, it covers much more than just syntax).

A few observations:
1. The code examples have smart quotes. This can create confusion. If it's
not too much trouble, copy/pasteable-into-Pharo single quotes would be
better.
2. Under "Pharo: a Live Programming Environment" ends with "… program is
executing. All". I guess that sentence is continued on the other side? If
so, it might be clearer to end with (over) and move the All to the other
side with the rest of the sentence.
3. The following example reminded me of the joy of Pharo's uniformity and
expressivity vs. e.g. Java or C++ - #1:`d.put("1", "Chocolate");` vs. #2: `d
at: '1' put: 'Chocolate'`. Experience of #1 - what was the order of the
parameters? Do I need a dot or arrow? [but then I get to sit back and feel
superior that I am one of the few "gurus" to have mastered an
incomprehensible system] vs. Experience of #2 - "hey, d. please at 1 put
Chocolate. Thanks"
4. Maybe too much detail, but where it says: "Counter >> initialize is a
notation to indicate that the following text is the content of the method
initialize in the class Counter." I personally find it pretty cool that
adding $# i.e. `Counter >> #initialize` makes it executable code, especially
now that we have GT tools which will open up a handful of domain views on
the method!



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

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Eliot Miranda-2
In reply to this post by stepharo
Hi Stef,

following on from Sean, (+1000 for using ordinary quotes)

’string’ collection of characters => ’string’ sequence of characters
$a, Character space Two ways to create characters => $a, Character space two ways to denote characters (or two ways to write characters; all other explanations in this list are not capitalized; this shouldn't be either)
exp1. exp2 expression separator => expr1. expr2 statement separator
; message cascade => expr doThis ; doThat   semicolon - message cascade (c.f. exp1. exp2 expression separator)
^ expr caret - returns a result from a method => ^ expr caret - return a result from a method (or, ParcPlace preference, answer a result from a method, since we're sending messages here)

...
A unary message is one with no arguments. => A unary message has no arguments. (c.f. A binary message takes only one argument ...)
...
Set new add: 4; add: 4 ; yourself ~> aSet => Set new add: 4; add: 4 ; yourself ~> aSet(4)
Dictionary new at: #a put: 'Alpha' ; yourself a Dictionary => Dictionary new at: #a put: 'Alpha' ; yourself a Dictionary(#a->'Alpha' )

and then in the Files and Stream section I would give two more examples of exactly the same sequence that use the convenience APIs.  This is the existing text:

work := FileSystem disk workingDirectory.
stream := (work / ’foo.txt’) writeStream.
stream nextPutAll: ’Hello World’.
stream close.
stream := (work / ’foo.txt’) readStream.
stream contents.                                     ~> 'Hello World'
stream close.

I would make it read

work := FileSystem disk workingDirectory.
stream := (work / ’foo.txt’) writeStream.
stream nextPutAll: ’Hello World’.
stream close.
stream := (work / ’foo.txt’) readStream.
stream contents.                                     ~> 'Hello World'
stream close.

or, more simply

work := FileSystem disk workingDirectory.
(work / ’foo.txt’) writeStreamDo: [ :fileStream | fileStream nextPutAll: ’Hello World’ ].
(work / ’foo.txt’) readStreamDo: [ :fileStream | fileStream contents]                            ~> 'Hello World'

or, more simply still

work := FileSystem disk workingDirectory.
(work / ’foo.txt’) writeStreamDo: [ :fileStream | fileStream nextPutAll: ’Hello World’ ].
(work / ’foo.txt’) contents                                                                                             ~> 'Hello World'

or if you can't make it fit, just give the last version

Finally, this seems to have fallen off the end:
A simple, uniform and powerful model
Pharo has a simple dynamically-typed object model:

Perhaps shrink the picture of the browser.  You can save three lines by writing 
OrderedCollection new
add: 1;
add: 2;
add: 3.

as OrderedCollection new add: 1; add: 2; add: 3.
And another by writing 2=2 ifTrue: [ Error signal: ’Help’ ]. on one line.

HTH

On Fri, Apr 8, 2016 at 12:56 PM, stepharo <[hidden email]> wrote:
new cheatsheet for Pharo syntax.
Any feedback is welcome

Stef



--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: new pharo cheatsheet

Sven Van Caekenberghe-2


> On 8 Mar 2018, at 17:58, Eliot Miranda <[hidden email]> wrote:
>
> Hi Stef,
>
> following on from Sean, (+1000 for using ordinary quotes)
>
> ’string’ collection of characters => ’string’ sequence of characters
> $a, Character space Two ways to create characters => $a, Character space two ways to denote characters (or two ways to write characters; all other explanations in this list are not capitalized; this shouldn't be either)
> exp1. exp2 expression separator => expr1. expr2 statement separator
> ; message cascade => expr doThis ; doThat   semicolon - message cascade (c.f. exp1. exp2 expression separator)
> ^ expr caret - returns a result from a method => ^ expr caret - return a result from a method (or, ParcPlace preference, answer a result from a method, since we're sending messages here)
>
> ...
> A unary message is one with no arguments. => A unary message has no arguments. (c.f. A binary message takes only one argument ...)
> ...
> Set new add: 4; add: 4 ; yourself ~> aSet => Set new add: 4; add: 4 ; yourself ~> aSet(4)
> Dictionary new at: #a put: 'Alpha' ; yourself a Dictionary => Dictionary new at: #a put: 'Alpha' ; yourself a Dictionary(#a->'Alpha' )
>
> and then in the Files and Stream section I would give two more examples of exactly the same sequence that use the convenience APIs.  This is the existing text:
>
> work := FileSystem disk workingDirectory.
> stream := (work / ’foo.txt’) writeStream.
> stream nextPutAll: ’Hello World’.
> stream close.
> stream := (work / ’foo.txt’) readStream.
> stream contents.                                     ~> 'Hello World'
> stream close.
>
> I would make it read
>
> work := FileSystem disk workingDirectory.
> stream := (work / ’foo.txt’) writeStream.
> stream nextPutAll: ’Hello World’.
> stream close.
> stream := (work / ’foo.txt’) readStream.
> stream contents.                                     ~> 'Hello World'
> stream close.
>
> or, more simply
>
> work := FileSystem disk workingDirectory.
> (work / ’foo.txt’) writeStreamDo: [ :fileStream | fileStream nextPutAll: ’Hello World’ ].
> (work / ’foo.txt’) readStreamDo: [ :fileStream | fileStream contents]                            ~> 'Hello World'
>
> or, more simply still
>
> work := FileSystem disk workingDirectory.
> (work / ’foo.txt’) writeStreamDo: [ :fileStream | fileStream nextPutAll: ’Hello World’ ].
> (work / ’foo.txt’) contents                                                                                             ~> 'Hello World'

file := FileSystem disk workingDirectory / 'foo' , 'txt'.
file ensureDelete.
file writeStreamDo: [ :fileStream | fileStream nextPutAll: 'Hello World' ].
file contents.
file delete.

(to make it re-entrant and a bit more concise)

+1e10 for plain single quotes, VERY important.

> or if you can't make it fit, just give the last version
>
> Finally, this seems to have fallen off the end:
> A simple, uniform and powerful model
> Pharo has a simple dynamically-typed object model:
>
> Perhaps shrink the picture of the browser.  You can save three lines by writing
> OrderedCollection new
> add: 1;
> add: 2;
> add: 3.
>
> as OrderedCollection new add: 1; add: 2; add: 3.
> And another by writing 2=2 ifTrue: [ Error signal: ’Help’ ]. on one line.
>
> HTH
>
> On Fri, Apr 8, 2016 at 12:56 PM, stepharo <[hidden email]> wrote:
> new cheatsheet for Pharo syntax.
> Any feedback is welcome
>
> Stef
>
>
>
> --
> _,,,^..^,,,_
> best, Eliot


Reply | Threaded
Open this post in threaded view
|

FileSystem tweaks (was Re: new pharo cheatsheet)

Eliot Miranda-2
Hi Sven,

On Mar 8, 2018, at 9:55 AM, Sven Van Caekenberghe <[hidden email]> wrote:



On 8 Mar 2018, at 17:58, Eliot Miranda <[hidden email]> wrote:

Hi Stef,

following on from Sean, (+1000 for using ordinary quotes)

’string’ collection of characters => ’string’ sequence of characters
$a, Character space Two ways to create characters => $a, Character space two ways to denote characters (or two ways to write characters; all other explanations in this list are not capitalized; this shouldn't be either)
exp1. exp2 expression separator => expr1. expr2 statement separator
; message cascade => expr doThis ; doThat   semicolon - message cascade (c.f. exp1. exp2 expression separator)
^ expr caret - returns a result from a method => ^ expr caret - return a result from a method (or, ParcPlace preference, answer a result from a method, since we're sending messages here)

...
A unary message is one with no arguments. => A unary message has no arguments. (c.f. A binary message takes only one argument ...)
...
Set new add: 4; add: 4 ; yourself ~> aSet => Set new add: 4; add: 4 ; yourself ~> aSet(4)
Dictionary new at: #a put: 'Alpha' ; yourself a Dictionary => Dictionary new at: #a put: 'Alpha' ; yourself a Dictionary(#a->'Alpha' )

and then in the Files and Stream section I would give two more examples of exactly the same sequence that use the convenience APIs.  This is the existing text:

   work := FileSystem disk workingDirectory.
   stream := (work / ’foo.txt’) writeStream.
   stream nextPutAll: ’Hello World’.
   stream close.
   stream := (work / ’foo.txt’) readStream.
   stream contents.                                     ~> 'Hello World'
   stream close.

I would make it read

   work := FileSystem disk workingDirectory.
   stream := (work / ’foo.txt’) writeStream.
   stream nextPutAll: ’Hello World’.
   stream close.
   stream := (work / ’foo.txt’) readStream.
   stream contents.                                     ~> 'Hello World'
   stream close.

   or, more simply

   work := FileSystem disk workingDirectory.
   (work / ’foo.txt’) writeStreamDo: [ :fileStream | fileStream nextPutAll: ’Hello World’ ].
   (work / ’foo.txt’) readStreamDo: [ :fileStream | fileStream contents]                            ~> 'Hello World'

   or, more simply still

   work := FileSystem disk workingDirectory.
   (work / ’foo.txt’) writeStreamDo: [ :fileStream | fileStream nextPutAll: ’Hello World’ ].
   (work / ’foo.txt’) contents                                                                                             ~> 'Hello World'

file := FileSystem disk workingDirectory / 'foo' , 'txt'.
file ensureDelete.
file writeStreamDo: [ :fileStream | fileStream nextPutAll: 'Hello World' ].
file contents.
file delete.

(to make it re-entrant and a bit more concise)

that suggests 

file := FileSystem disk workingDirectory / 'foo' , 'txt'.
file newWriteStreamDo: [ :fileStream | fileStream nextPutAll: 'Hello World' ].
file contents.
file delete.

where newWriteStreamDo: includes the file ensureDelete, or better still a truncation, which saves the effort of deletion but (I *think*) has the same effect.


+1e10 for plain single quotes, VERY important.

or if you can't make it fit, just give the last version

Finally, this seems to have fallen off the end:
A simple, uniform and powerful model
Pharo has a simple dynamically-typed object model:

Perhaps shrink the picture of the browser.  You can save three lines by writing
   OrderedCollection new
       add: 1;
       add: 2;
       add: 3.

as OrderedCollection new add: 1; add: 2; add: 3.
And another by writing 2=2 ifTrue: [ Error signal: ’Help’ ]. on one line.

HTH

On Fri, Apr 8, 2016 at 12:56 PM, stepharo <[hidden email]> wrote:
new cheatsheet for Pharo syntax.
Any feedback is welcome

Stef



--
_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

Re: FileSystem tweaks (was Re: new pharo cheatsheet)

Nicolas Cellier


2018-03-08 19:44 GMT+01:00 Eliot Miranda <[hidden email]>:
Hi Sven,

On Mar 8, 2018, at 9:55 AM, Sven Van Caekenberghe <[hidden email]> wrote:



On 8 Mar 2018, at 17:58, Eliot Miranda <[hidden email]> wrote:

Hi Stef,

following on from Sean, (+1000 for using ordinary quotes)

’string’ collection of characters => ’string’ sequence of characters
$a, Character space Two ways to create characters => $a, Character space two ways to denote characters (or two ways to write characters; all other explanations in this list are not capitalized; this shouldn't be either)
exp1. exp2 expression separator => expr1. expr2 statement separator
; message cascade => expr doThis ; doThat   semicolon - message cascade (c.f. exp1. exp2 expression separator)
^ expr caret - returns a result from a method => ^ expr caret - return a result from a method (or, ParcPlace preference, answer a result from a method, since we're sending messages here)

...
A unary message is one with no arguments. => A unary message has no arguments. (c.f. A binary message takes only one argument ...)
...
Set new add: 4; add: 4 ; yourself ~> aSet => Set new add: 4; add: 4 ; yourself ~> aSet(4)
Dictionary new at: #a put: 'Alpha' ; yourself a Dictionary => Dictionary new at: #a put: 'Alpha' ; yourself a Dictionary(#a->'Alpha' )

and then in the Files and Stream section I would give two more examples of exactly the same sequence that use the convenience APIs.  This is the existing text:

   work := FileSystem disk workingDirectory.
   stream := (work / ’foo.txt’) writeStream.
   stream nextPutAll: ’Hello World’.
   stream close.
   stream := (work / ’foo.txt’) readStream.
   stream contents.                                     ~> 'Hello World'
   stream close.

I would make it read

   work := FileSystem disk workingDirectory.
   stream := (work / ’foo.txt’) writeStream.
   stream nextPutAll: ’Hello World’.
   stream close.
   stream := (work / ’foo.txt’) readStream.
   stream contents.                                     ~> 'Hello World'
   stream close.

   or, more simply

   work := FileSystem disk workingDirectory.
   (work / ’foo.txt’) writeStreamDo: [ :fileStream | fileStream nextPutAll: ’Hello World’ ].
   (work / ’foo.txt’) readStreamDo: [ :fileStream | fileStream contents]                            ~> 'Hello World'

   or, more simply still

   work := FileSystem disk workingDirectory.
   (work / ’foo.txt’) writeStreamDo: [ :fileStream | fileStream nextPutAll: ’Hello World’ ].
   (work / ’foo.txt’) contents                                                                                             ~> 'Hello World'

file := FileSystem disk workingDirectory / 'foo' , 'txt'.
file ensureDelete.
file writeStreamDo: [ :fileStream | fileStream nextPutAll: 'Hello World' ].
file contents.
file delete.

(to make it re-entrant and a bit more concise)

that suggests 

file := FileSystem disk workingDirectory / 'foo' , 'txt'.
file newWriteStreamDo: [ :fileStream | fileStream nextPutAll: 'Hello World' ].
file contents.
file delete.

where newWriteStreamDo: includes the file ensureDelete, or better still a truncation, which saves the effort of deletion but (I *think*) has the same effect.


Hi Eliot,
not exactly the same effect wrt file access rights.
 

+1e10 for plain single quotes, VERY important.

or if you can't make it fit, just give the last version

Finally, this seems to have fallen off the end:
A simple, uniform and powerful model
Pharo has a simple dynamically-typed object model:

Perhaps shrink the picture of the browser.  You can save three lines by writing
   OrderedCollection new
       add: 1;
       add: 2;
       add: 3.

as OrderedCollection new add: 1; add: 2; add: 3.
And another by writing 2=2 ifTrue: [ Error signal: ’Help’ ]. on one line.

HTH

On Fri, Apr 8, 2016 at 12:56 PM, stepharo <[hidden email]> wrote:
new cheatsheet for Pharo syntax.
Any feedback is welcome

Stef



--
_,,,^..^,,,_
best, Eliot



12