[Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

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

[Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Hannes Hirzel
Hello

I am inspecting a collection of strings in Pharo 5.

I wonder how I get at an edit pane to modify a particular string?

Thank you for the answer in advance

--Hannes

Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Tudor Girba-2
Hi,

Strings are supposed to be immutable, and that is why we do not support editing by default :).

If you would want to provide editing tools for a String, you would need to create a new inspector extension. This would probably be a bit cumbersome because you would probably have to work with basic things like String>>at:put:.

A different way would be to not work with Strings directly, but with some wrapper objects that hold those strings. In this case, it would be easy to replace the wrapped string every time the editor changes.

Cheers,
Doru


> On Dec 19, 2015, at 11:53 AM, H. Hirzel <[hidden email]> wrote:
>
> Hello
>
> I am inspecting a collection of strings in Pharo 5.
>
> I wonder how I get at an edit pane to modify a particular string?
>
> Thank you for the answer in advance
>
> --Hannes
>

--
www.tudorgirba.com
www.feenk.com

“Live like you mean it."


Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Marcus Denker-4


On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <[hidden email]> wrote:
Hi,

Strings are supposed to be immutable, and that is why we do not support editing by default :).


I do not think this is good... yes, it would be nice if *literal* strings *would* be immutable, but they are not.

The tools should not put artificial constraints on the language model. Strings can be changed, so the inspector
has to allow that. It is a debugging tool, after all...

    Marcus
Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Clément Béra


2015-12-20 8:15 GMT+01:00 Marcus Denker <[hidden email]>:


On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <[hidden email]> wrote:
Hi,

Strings are supposed to be immutable, and that is why we do not support editing by default :).


I do not think this is good... yes, it would be nice if *literal* strings *would* be immutable, but they are not.

Actually, that is something I work on and that should be the case in the incoming months. All literals will be immutable by default, except if you explicitly ask the compiler to compile mutable literals. 


The tools should not put artificial constraints on the language model. Strings can be changed, so the inspector
has to allow that. It is a debugging tool, after all...


Agreed, the strings should be able to be changed, if they are immutable you will have a runtime error anyway.
 
    Marcus

Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Marcus Denker-4

On 20 Dec 2015, at 09:13, Clément Bera <[hidden email]> wrote:



2015-12-20 8:15 GMT+01:00 Marcus Denker <[hidden email]>:


On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <[hidden email]> wrote:
Hi,

Strings are supposed to be immutable, and that is why we do not support editing by default :).


I do not think this is good... yes, it would be nice if *literal* strings *would* be immutable, but they are not.

Actually, that is something I work on and that should be the case in the incoming months. All literals will be immutable by default, except if you explicitly ask the compiler to compile mutable literals. 


Very good! 

Marcus
Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Tudor Girba-2
Awesome. Then could you tell me what is the preferred api to modify strings?

Cheers,
Doru


> On Dec 20, 2015, at 10:03 AM, Marcus Denker <[hidden email]> wrote:
>
>
>> On 20 Dec 2015, at 09:13, Clément Bera <[hidden email]> wrote:
>>
>>
>>
>> 2015-12-20 8:15 GMT+01:00 Marcus Denker <[hidden email]>:
>>
>>
>> On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <[hidden email]> wrote:
>> Hi,
>>
>> Strings are supposed to be immutable, and that is why we do not support editing by default :).
>>
>>
>> I do not think this is good... yes, it would be nice if *literal* strings *would* be immutable, but they are not.
>>
>> Actually, that is something I work on and that should be the case in the incoming months. All literals will be immutable by default, except if you explicitly ask the compiler to compile mutable literals.
>>
>
> Very good!
>
> Marcus

--
www.tudorgirba.com
www.feenk.com

"Quality cannot be an afterthought."


Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Sven Van Caekenberghe-2
In reply to this post by Tudor Girba-2
I think the original question was how to change one element from a collection by another one, in this case, replace a string by another one, by 'editing' an item, not to destructively modify a string (which would be a bad idea (tm)).

Inspect:

  #('foo' 'bar') copy

Go to the Raw view, double-click 'foo', edit it and press Return to accept -> no go.

Normally, we can in-place edit by double-clicking, but that seems to be broken (well, you can edit but it won't accept the change).

I tried this in my working 40 image, and in a recent 50 image.

> On 19 Dec 2015, at 21:24, Tudor Girba <[hidden email]> wrote:
>
> Hi,
>
> Strings are supposed to be immutable, and that is why we do not support editing by default :).
>
> If you would want to provide editing tools for a String, you would need to create a new inspector extension. This would probably be a bit cumbersome because you would probably have to work with basic things like String>>at:put:.
>
> A different way would be to not work with Strings directly, but with some wrapper objects that hold those strings. In this case, it would be easy to replace the wrapped string every time the editor changes.
>
> Cheers,
> Doru
>
>
>> On Dec 19, 2015, at 11:53 AM, H. Hirzel <[hidden email]> wrote:
>>
>> Hello
>>
>> I am inspecting a collection of strings in Pharo 5.
>>
>> I wonder how I get at an edit pane to modify a particular string?
>>
>> Thank you for the answer in advance
>>
>> --Hannes
>>
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> “Live like you mean it."
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Hannes Hirzel
In reply to this post by Marcus Denker-4
On 12/20/15, Marcus Denker <[hidden email]> wrote:

> On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <[hidden email]> wrote:
>
>> Hi,
>>
>> Strings are supposed to be immutable, and that is why we do not support
>> editing by default :).
>>
>>
> I do not think this is good... yes, it would be nice if *literal* strings
> *would* be immutable, but they are not.
>
> The tools should not put artificial constraints on the language model.
> Strings can be changed, so the inspector
> has to allow that. It is a debugging tool, after all...
+1
>     Marcus
>

Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Hannes Hirzel
In reply to this post by Sven Van Caekenberghe-2
On 12/20/15, Sven Van Caekenberghe <[hidden email]> wrote:

> I think the original question was how to change one element from a
> collection by another one, in this case, replace a string by another one, by
> 'editing' an item, not to destructively modify a string (which would be a
> bad idea (tm)).
>
> Inspect:
>
>   #('foo' 'bar') copy
>
> Go to the Raw view, double-click 'foo', edit it and press Return to accept
> -> no go.
>
> Normally, we can in-place edit by double-clicking, but that seems to be
> broken (well, you can edit but it won't accept the change).


Thanks for the more detailed description, Sven.

Yes, editing strings like this is what I aim at. Could this be fixed, please?

--Hannes


> I tried this in my working 40 image, and in a recent 50 image.
>
>> On 19 Dec 2015, at 21:24, Tudor Girba <[hidden email]> wrote:
>>
>> Hi,
>>
>> Strings are supposed to be immutable, and that is why we do not support
>> editing by default :).
>>
>> If you would want to provide editing tools for a String, you would need to
>> create a new inspector extension. This would probably be a bit cumbersome
>> because you would probably have to work with basic things like
>> String>>at:put:.
>>
>> A different way would be to not work with Strings directly, but with some
>> wrapper objects that hold those strings. In this case, it would be easy to
>> replace the wrapped string every time the editor changes.
>>
>> Cheers,
>> Doru
>>
>>
>>> On Dec 19, 2015, at 11:53 AM, H. Hirzel <[hidden email]> wrote:
>>>
>>> Hello
>>>
>>> I am inspecting a collection of strings in Pharo 5.
>>>
>>> I wonder how I get at an edit pane to modify a particular string?
>>>
>>> Thank you for the answer in advance
>>>
>>> --Hannes
>>>
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> “Live like you mean it."
>>
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Nicolai Hess-3-2


2015-12-21 13:58 GMT+01:00 H. Hirzel <[hidden email]>:
On 12/20/15, Sven Van Caekenberghe <[hidden email]> wrote:
> I think the original question was how to change one element from a
> collection by another one, in this case, replace a string by another one, by
> 'editing' an item, not to destructively modify a string (which would be a
> bad idea (tm)).
>
> Inspect:
>
>   #('foo' 'bar') copy
>
> Go to the Raw view, double-click 'foo', edit it and press Return to accept
> -> no go.
>
> Normally, we can in-place edit by double-clicking, but that seems to be
> broken (well, you can edit but it won't accept the change).

This works only if there is an inst var name in that class (not for other inst vars from any super class).
(it worked fine in EyeInspector)

 


Thanks for the more detailed description, Sven.

Yes, editing strings like this is what I aim at. Could this be fixed, please?

--Hannes


> I tried this in my working 40 image, and in a recent 50 image.
>
>> On 19 Dec 2015, at 21:24, Tudor Girba <[hidden email]> wrote:
>>
>> Hi,
>>
>> Strings are supposed to be immutable, and that is why we do not support
>> editing by default :).
>>
>> If you would want to provide editing tools for a String, you would need to
>> create a new inspector extension. This would probably be a bit cumbersome
>> because you would probably have to work with basic things like
>> String>>at:put:.
>>
>> A different way would be to not work with Strings directly, but with some
>> wrapper objects that hold those strings. In this case, it would be easy to
>> replace the wrapped string every time the editor changes.
>>
>> Cheers,
>> Doru
>>
>>
>>> On Dec 19, 2015, at 11:53 AM, H. Hirzel <[hidden email]> wrote:
>>>
>>> Hello
>>>
>>> I am inspecting a collection of strings in Pharo 5.
>>>
>>> I wonder how I get at an edit pane to modify a particular string?
>>>
>>> Thank you for the answer in advance
>>>
>>> --Hannes
>>>
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> “Live like you mean it."
>>
>>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

Sven Van Caekenberghe-2

> On 21 Dec 2015, at 14:29, Nicolai Hess <[hidden email]> wrote:
>
>
>
> 2015-12-21 13:58 GMT+01:00 H. Hirzel <[hidden email]>:
> On 12/20/15, Sven Van Caekenberghe <[hidden email]> wrote:
> > I think the original question was how to change one element from a
> > collection by another one, in this case, replace a string by another one, by
> > 'editing' an item, not to destructively modify a string (which would be a
> > bad idea (tm)).
> >
> > Inspect:
> >
> >   #('foo' 'bar') copy
> >
> > Go to the Raw view, double-click 'foo', edit it and press Return to accept
> > -> no go.
> >
> > Normally, we can in-place edit by double-clicking, but that seems to be
> > broken (well, you can edit but it won't accept the change).
>
> This works only if there is an inst var name in that class (not for other inst vars from any super class).

Ah, good catch (as usual ;-).

I tried with an Association's key and it did not work, but it does work with its value, duh.

> (it worked fine in EyeInspector)

Yes it did.

> Thanks for the more detailed description, Sven.
>
> Yes, editing strings like this is what I aim at. Could this be fixed, please?
>
> --Hannes
>
>
> > I tried this in my working 40 image, and in a recent 50 image.
> >
> >> On 19 Dec 2015, at 21:24, Tudor Girba <[hidden email]> wrote:
> >>
> >> Hi,
> >>
> >> Strings are supposed to be immutable, and that is why we do not support
> >> editing by default :).
> >>
> >> If you would want to provide editing tools for a String, you would need to
> >> create a new inspector extension. This would probably be a bit cumbersome
> >> because you would probably have to work with basic things like
> >> String>>at:put:.
> >>
> >> A different way would be to not work with Strings directly, but with some
> >> wrapper objects that hold those strings. In this case, it would be easy to
> >> replace the wrapped string every time the editor changes.
> >>
> >> Cheers,
> >> Doru
> >>
> >>
> >>> On Dec 19, 2015, at 11:53 AM, H. Hirzel <[hidden email]> wrote:
> >>>
> >>> Hello
> >>>
> >>> I am inspecting a collection of strings in Pharo 5.
> >>>
> >>> I wonder how I get at an edit pane to modify a particular string?
> >>>
> >>> Thank you for the answer in advance
> >>>
> >>> --Hannes
> >>>
> >>
> >> --
> >> www.tudorgirba.com
> >> www.feenk.com
> >>
> >> “Live like you mean it."
> >>
> >>
> >
> >
> >