[squeak-dev] Prevent syntax errors in preamble/postscript

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sun Mar 8 20:59:24 UTC 2020


Hi all,
Note that I did execute the snippet so as to check that it worked, but then
thought a good idea to add a comment...
So yes, syntactic color would have helped me see my typo!

Concerning StringHolder, well the name is certainly misleading.
We want to be able to write and test code from everywhere, so that's the
reason why it behaves much like a code holder...
I don't think that it is a good idea to strip this behavior, it is an
essential feature.

CodeHolder has more properties related to hosting methods (not just
snippets) like inserting a breakpoint or considering method category
(protocol).
MethodHolder seems something used exclusively by EToys, I didn't even know
about its existence until now ...

For MC, having a CodeHolder with style seems like the most elementary thing
to do.
We can eventually be pedantic and try to compile and validate the snippet
upon accept, but I see no need to store resulting compiledMethod.

Le sam. 7 mars 2020 à 14:26, Thiede, Christoph <
Christoph.Thiede at student.hpi.uni-potsdam.de> a écrit :

> Interesting idea. We could simply change the underlying representation
> of PackageInfo ('preamble postscript preambleOfRemoval postscriptOfRemoval')
> to hold CompiledMethods rather than StringHolders and rewrite the accessors
> to use Compiler and #sourceText. However, then we could not use interactive
> compilation (no requestor). Hm, or could we maybe simply store instances
> of CodeHolder? This could also solve our problem that Monticello Load
> Scripts are not styled
> <http://forum.world.st/Monticello-Load-Scripts-are-not-styled-td5109840.html>
> .
>
>
> Speaking in general, should we maybe revise the existing StringHolder,
> CodeHolder, MethodHolder hierarchy? A very large part of the StringHolder
> implementation actually describes code-specific things. MethodHolder, on
> the other hand, is located in Tools but its only three users are located in
> EToys. IMHO, an ideal StringHolder would not contain any code-related
> stuff, not even #buildCodePaneWith:. Or am I basically describing the
> behavior of a ValueHolder? In this case, the name of StringHolder is quite
> confusing.
>
>
> Best,
>
> Christoph
> ------------------------------
> *Von:* Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im
> Auftrag von Jakob Reschke <forums.jakob at resfarm.de>
> *Gesendet:* Samstag, 7. März 2020 10:02:35
> *An:* squeak-dev at lists.squeakfoundation.org
> *Betreff:* [squeak-dev] Prevent syntax errors in preamble/postscript
>
> Hello,
>
> Thank you Nicolas for fixing this error so quickly.
>
> Would it be possible to compile, but not evaluate those scripts
> automatically when they are saved? Or does something speak against it? It
> should prevent syntax errors.
>
> Kind regards,
> Jakob
>
>
> <commits at source.squeak.org> schrieb am Sa., 7. März 2020, 01:17:
>
>> Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
>> http://source.squeak.org/trunk/Morphic-nice.1637.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Morphic-nice.1637
>> Author: nice
>> Time: 7 March 2020, 1:16:54.439713 am
>> UUID: 52276ad2-7bef-40fd-a762-6309da355518
>> Ancestors: Morphic-nice.1636
>>
>> Fix broken postscript, apologies
>>
>> =============== Diff against Morphic-nice.1636 ===============
>>
>> Item was changed:
>> + (PackageInfo named: 'Morphic') postscript: '"Set a smoother scrolling,
>> especially useful for trackpads"
>> - (PackageInfo named: 'Morphic') postscript: '''Set a smoother scrolling,
>> especially useful for trackpads"
>>   HandMorph minimumWheelDelta: 20.
>>   Smalltalk sendMouseWheelEvents: true.'!
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200308/cd4f678f/attachment.html>


More information about the Squeak-dev mailing list