[squeak-dev] Removing embedded pairs of single quotes [was Re: The Trunk: Collections-eem.992.mcz]

Eliot Miranda eliot.miranda at gmail.com
Wed Mar 2 19:05:13 UTC 2022


Hi Marcel,

On Tue, Mar 1, 2022 at 10:59 PM Marcel Taeumel <marcel.taeumel at hpi.de>
wrote:

> :-D
>
>
>
Off topic, but producing this pointed out what I consider is a severe
problem with the new enclose/unenclose protocol.  If one has a literal
string with embedded single quotes (as one does with codeSample above) and
one wants to edit it down to a method (imagine copying the string in
codeSmaple into a Workspace to evaluate part of it) then if one selects the
first embedded pair of single quotes 'a' (which will be ''a'') and types a
single quote, intending to replace the double quote with a single, one now
ends up with four quotes.  Instead one has to copy a single quote to the
copy buffer, select the pair of single quotes and use paste... to paste in
the single quote.  It's horrible,  Try it.

I do things like this fairly frequently.  e.g. MethodMassage is a bytecode
(dis)assembler framework I use to copy single methods between images
without having to import an entire framework.  The "interchange" format is
an assemblerString, which is an evaluable expression that creates a
CompiledMethod.  One has to convert from the string with embedded pairs of
single quotes to the expression with single quotes.

So for me we either need a way of typing a single quote which does not
enclose, or we need a one-off convert to/from literal string which does it
for us.

> Am 01.03.2022 21:40:06 schrieb commits at source.squeak.org <
> commits at source.squeak.org>:
> Eliot Miranda uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-eem.992.mcz
>
> ==================== Summary ====================
>
> Name: Collections-eem.992
> Author: eem
> Time: 1 March 2022, 12:39:53.850609 pm
> UUID: 677dd86e-ae58-41d3-b125-af837d2cdb61
> Ancestors: Collections-mt.991
>
> Add some missing features to the imfamous postcard.
>
> =============== Diff against Collections-mt.991 ===============
>
> Item was changed:
> ----- Method: Text class>>codeSample (in category 'filler text') -----
> codeSample
>
> ^ 'exampleWithNumber: x
> "A method that illustrates every part of Smalltalk method syntax
> including primitives. It has unary, binary, and keyboard messages,
> declares arguments and temporaries, accesses a global variable
> + (but not an instance variable), uses literals (array, character, symbol,
> + string, integer, float, byte array), uses the pseudo variables nil, true,
> + false, self, super, and thisContext, shows that within a literal array
> + nil, true and false are symbols not pseudo variables, and has sequence,
> + assignment, return, cascade, and tuple (array) creation. It has both
> + zero argument and one argument blocks, and has a block temporary."
> - (but not an instance variable), uses literals (array, character,
> - symbol, string, integer, float), uses the pseudo variables true,
> - false, nil, self, and super, and has sequence, assignment, return
> - and cascade. It has both zero argument and one argument blocks."
>
> | y |
> true & false not & (nil isNil) ifFalse: [self halt].
> y := self size + super size.
> + #($a #a ''a'' "a" 1 1.0 nil true false), { #[65]. thisContext. nil.
> true. false }
> + do: [ :each | | class |
> + class := each class.
> - #($a #a ''a'' "a" 1 1.0)
> - do: [ :each |
> Transcript
> + show: (class name);
> - show: (each class name);
> show: '' ''].
> ^ x < y'!
>
>
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220302/177cc763/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 204559 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220302/177cc763/attachment-0001.png>


More information about the Squeak-dev mailing list