[Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?
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
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 <hannes.hirzel@gmail.com> 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."
On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <tudor@tudorgirba.com> 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
2015-12-20 8:15 GMT+01:00 Marcus Denker <marcus.denker@inria.fr>:
On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <tudor@tudorgirba.com> 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
On 20 Dec 2015, at 09:13, Clément Bera <bera.clement@gmail.com> wrote:
2015-12-20 8:15 GMT+01:00 Marcus Denker <marcus.denker@inria.fr <mailto:marcus.denker@inria.fr>>:
On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <tudor@tudorgirba.com <mailto:tudor@tudorgirba.com>> 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
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 <marcus.denker@inria.fr> wrote:
On 20 Dec 2015, at 09:13, Clément Bera <bera.clement@gmail.com> wrote:
2015-12-20 8:15 GMT+01:00 Marcus Denker <marcus.denker@inria.fr>:
On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <tudor@tudorgirba.com> 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."
On 12/20/15, Marcus Denker <marcus.denker@inria.fr> wrote:
On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba <tudor@tudorgirba.com> 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
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 <tudor@tudorgirba.com> 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 <hannes.hirzel@gmail.com> 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."
On 12/20/15, Sven Van Caekenberghe <sven@stfx.eu> 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 <tudor@tudorgirba.com> 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 <hannes.hirzel@gmail.com> 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."
2015-12-21 13:58 GMT+01:00 H. Hirzel <hannes.hirzel@gmail.com>:
On 12/20/15, Sven Van Caekenberghe <sven@stfx.eu> 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 <tudor@tudorgirba.com> 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 <hannes.hirzel@gmail.com> 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."
On 21 Dec 2015, at 14:29, Nicolai Hess <nicolaihess@gmail.com> wrote:
2015-12-21 13:58 GMT+01:00 H. Hirzel <hannes.hirzel@gmail.com>: On 12/20/15, Sven Van Caekenberghe <sven@stfx.eu> 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 <tudor@tudorgirba.com> 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 <hannes.hirzel@gmail.com> 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."
participants (6)
-
Clément Bera -
H. Hirzel -
Marcus Denker -
Nicolai Hess -
Sven Van Caekenberghe -
Tudor Girba