Re: [Pharo-users] need help with workingDirectory...

2020-05-26 Thread Cyril Ferlicot
On Tue, May 26, 2020 at 1:59 PM Cyril Ferlicot  wrote:
>
> HI,
>
> You have two different things:
> - working copy

working directory*

> - image directory
>
> The working copy return the folder from which the image was launched.
> Most of the time it is the image directory but not all the time.
>
> For example ./pharo-ui ../../test/pharo.image will have the working
> directory be the location of the pharo-ui script.
>
> The image directory is what you are looking for.
>
> On Tue, May 26, 2020 at 1:45 PM Russ Whaley  wrote:
> >
> > I'm on MacOS 10.13.6, Pharo v9 (but have same issue on v8).
> >
> > When I want to get the directory where the current image was launched, I 
> > use the following:
> >
> > FileSystem workingDirectory
> >
> > The comments from this method are:
> >  "Returns a reference to the directory from where the image was launched"
> >
> > What I get (from Playground) is: FileSystem workingDirectory >>> File @ /
> >
> > Perhaps I am misunderstanding the comments?  I can specifically tell Pharo 
> > where to find my files, but I have to then change code each time I 
> > change/update/upgrade images (across a number of applications).
> >
> > If there is no way, I'll move everything to a standard folder (outside the 
> > image) - this just made USB backups quick and easy to have everything in 
> > one folder... I can adapt :)
> >
> > Thanks,
> > Russ
> >
> > --
> > Russ Whaley
> > whaley.r...@gmail.com
>
>
>
> --
> Cyril Ferlicot
> https://ferlicot.fr



-- 
Cyril Ferlicot
https://ferlicot.fr



[Pharo-users] Repost from twitter : running 1983 Smalltalk. Today

2020-05-26 Thread Davide Grandi

From Torsten Bergman - @TorstenAstares
https://twitter.com/TorstenAstares/status/1264820045840027649

"Dan Banay just released a few days ago, on the day of the 80th 
anniversary of Alan Kay,
a fully functional Smalltalk-80 VM capable of running the original ST-80 
images

as distributed by Xerox Parc in 1979 and 1980"
https://github.com/dbanay/Smalltalk

very very intriguing.

--
Ing. Davide Grandi
linkedin : http://linkedin.com/in/davidegrandi




Re: [Pharo-users] Find/Replace class scoped

2020-05-26 Thread Vitor Medina Cruz
Will wait then.

I tried to use the RB classes but with no success. There are few docs and
test code are hard to understand (still not sure if I should use transform
ou primitiveExecute). I did this:

(RBRenameMethodRefactoring new
renameMethod: #with:doThis:
in: RefactoringReformatExample
to: #withh:doThis:
permutation: #(1 2)) primitiveExecute

and

(RBRenameMethodRefactoring new
renameMethod: #with:doThis:
in: RefactoringReformatExample
to: #withh:doThis:
permutation: #(1 2)) tranform

but nothing happens... It is really odd, I expected an error at least.

I am assuming permutation means the change of params order.


On Fri, May 22, 2020 at 3:50 AM Stéphane Ducasse 
wrote:

> we are working with sebastian jordan on a better rewriter.
>
> S.
>
> On 21 May 2020, at 17:17, Vitor Medina Cruz  wrote:
>
> Interesting, I will have a look at it.
>
> On Thu, May 21, 2020 at 11:52 AM Thierry Goubier <
> thierry.goub...@gmail.com> wrote:
>
>> Hi Vitor,
>>
>> as a matter of fact, the infrastructure for doing what you're looking
>> for is already there.
>>
>> The algorithm is the following:
>>
>> - create a scope (something based on RBBrowserEnvironment, such as
>> RBClassEnvironment or based on regexes and AND / OR operations:
>> RBAndEnvironment, RBNotEnvironment, which allows for virtually
>> anything, such as all #printString methods in the package X that do
>> not belong to class Y)
>>
>> - create a refactoring command: if it is not a pre-existing command
>> such as rename class, etc..., then writing a pattern matcher is
>> possible with RBTreeRewriter.
>>
>> - execute the refactoring command on the environment, changing only
>> for the subset of code visible in the environment.
>>
>> Normally, the system browser or the search tools should automatically
>> setup the environment for you, and scope accordingly most of the
>> refactoring commands. As far as I know, there isn't yet a shell giving
>> you the full pattern matching rewrite power, but some work was
>> underway (GUI tools).
>>
>> Going with the source files as you did also work...
>>
>> Regards,
>>
>> Thierry
>>
>> Le jeu. 21 mai 2020 à 15:30, Vitor Medina Cruz  a
>> écrit :
>> >
>> > Well, as it seems, there is no way of find/replacing other than inside
>> a single method.
>> >
>> > As a workaround, I did the following:
>> >
>> > 1- Committed all my image work in progress;
>> > 2- Opened the project structure in an external tool (notepad++ in this
>> case) and did the find/replace there;
>> > 3- Committed it using git command line;
>> > 4- Back to the image, I did a repair repository from iceberg checking
>> out and ignoring changes to the image (safe because I did commit everything
>> before)
>> >
>> > If there are many places to change, it is worth.
>> >
>> > Regards,
>> > Vitor
>> >
>> > On Tue, May 19, 2020 at 12:56 PM Vitor Medina Cruz <
>> vitormc...@gmail.com> wrote:
>> >>
>> >> Hello,
>> >>
>> >> Is there a way to make find replace in a class scoped way? I can do
>> that with finder, but I figured only with package scoping. I wanna to
>> change the name of a variable in multiple methods, and also I would like to
>> regex replace an expression also in multiple methods.
>> >>
>> >> Regards,
>> >> Vitor
>>
>>
> 
> Stéphane Ducasse
> http://stephane.ducasse.free.fr / http://www.pharo.org
> 03 59 35 87 52
> Assistant: Aurore Dalle
> FAX 03 59 57 78 50
> TEL 03 59 35 86 16
> S. Ducasse - Inria
> 40, avenue Halley,
> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
> Villeneuve d'Ascq 59650
> France
>
>


[Pharo-users] Name of coding pattern

2020-05-26 Thread Kasper Osterbye
Hi.

I was looking at the zink stream, and noticed this pattern with

strm tag: 'h1' do: aBlockWhichWriteTheTitle

It is also used in baselines, and I have used it myself a few times.

Is anyone aware of this having a name?

Best,

Kasper


Re: [Pharo-users] Name of coding pattern

2020-05-26 Thread Richard O'Keefe
In my library it would be
  strm
tag: 'h1';
  do: aBlockWhichWritesTheTitle;
end.
because one so very often needs to add attributes and/or a namespace.
#tag:do: is related to the C++ "Resource Allocation is Initialisation"
pattern, where the point is to automatically clean up.  In RAII, the clean
up is to release a lock or free a resource.  In this case, it is to write
an end-tag.  In a similar way, it is related to the Common Lisp with...
pattern, where (with-open-file (variable filespec option...) body...)
ensures that the file is closed, to unwind-protect, and of course to the
#critical: method on Semaphores, Mutexes, 

I don't know if there is an official name other than RAII;
I've always thought of it as "automatic cleanup".  The difference
between this and #ensure: or try-finally or unwind-protect is that
in those you have to say what the clean-up action is while in this
it is implicit.

On Wed, 27 May 2020 at 01:52, Kasper Osterbye 
wrote:

> Hi.
>
> I was looking at the zink stream, and noticed this pattern with
>
> strm tag: 'h1' do: aBlockWhichWriteTheTitle
>
> It is also used in baselines, and I have used it myself a few times.
>
> Is anyone aware of this having a name?
>
> Best,
>
> Kasper
>


[Pharo-users] need help with workingDirectory...

2020-05-26 Thread Russ Whaley
I'm on MacOS 10.13.6, Pharo v9 (but have same issue on v8).

When I want to get the directory where the current image was launched, I
use the following:

FileSystem workingDirectory

The comments from this method are:
 "Returns a reference to the directory from where the image was launched"

What I get (from Playground) is: FileSystem workingDirectory >>> File @ /

Perhaps I am misunderstanding the comments?  I can specifically tell
Pharo where to find my files, but I have to then change code each time I
change/update/upgrade images (across a number of applications).

If there is no way, I'll move everything to a standard folder (outside the
image) - this just made USB backups quick and easy to have everything in
one folder... I can adapt :)

Thanks,
Russ

-- 
Russ Whaley
whaley.r...@gmail.com


Re: [Pharo-users] need help with workingDirectory...

2020-05-26 Thread Sven Van Caekenberghe
Hmm, I am getting another result:

FileSystem workingDirectory.
 "File @ /Users/sven/Develop/Pharo/Pharo-Daily/2020-05-06"

Which is correct for me.

This is recent 9.0 on macOS 10.15.4

> On 26 May 2020, at 13:44, Russ Whaley  wrote:
> 
> I'm on MacOS 10.13.6, Pharo v9 (but have same issue on v8).
> 
> When I want to get the directory where the current image was launched, I use 
> the following:
> 
> FileSystem workingDirectory
> 
> The comments from this method are:
>  "Returns a reference to the directory from where the image was launched"
> 
> What I get (from Playground) is: FileSystem workingDirectory >>> File @ /
> 
> Perhaps I am misunderstanding the comments?  I can specifically tell Pharo 
> where to find my files, but I have to then change code each time I 
> change/update/upgrade images (across a number of applications).
> 
> If there is no way, I'll move everything to a standard folder (outside the 
> image) - this just made USB backups quick and easy to have everything in one 
> folder... I can adapt :)
> 
> Thanks,
> Russ
> 
> -- 
> Russ Whaley
> whaley.r...@gmail.com




Re: [Pharo-users] need help with workingDirectory...

2020-05-26 Thread Cyril Ferlicot
HI,

You have two different things:
- working copy
- image directory

The working copy return the folder from which the image was launched.
Most of the time it is the image directory but not all the time.

For example ./pharo-ui ../../test/pharo.image will have the working
directory be the location of the pharo-ui script.

The image directory is what you are looking for.

On Tue, May 26, 2020 at 1:45 PM Russ Whaley  wrote:
>
> I'm on MacOS 10.13.6, Pharo v9 (but have same issue on v8).
>
> When I want to get the directory where the current image was launched, I use 
> the following:
>
> FileSystem workingDirectory
>
> The comments from this method are:
>  "Returns a reference to the directory from where the image was launched"
>
> What I get (from Playground) is: FileSystem workingDirectory >>> File @ /
>
> Perhaps I am misunderstanding the comments?  I can specifically tell Pharo 
> where to find my files, but I have to then change code each time I 
> change/update/upgrade images (across a number of applications).
>
> If there is no way, I'll move everything to a standard folder (outside the 
> image) - this just made USB backups quick and easy to have everything in one 
> folder... I can adapt :)
>
> Thanks,
> Russ
>
> --
> Russ Whaley
> whaley.r...@gmail.com



-- 
Cyril Ferlicot
https://ferlicot.fr