<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Pragmas has given me a powerful hook into the Compiler/Parser complex.
I may be misusing them, but my experiment worked and gave me the
insights I needed into the relationships between static and dynamic
variables.<br>
<br>
A small and simple extension to the Parser made it generate in-line
code for special pragmas. (Thanks to Klaus for helping me with this).
An example method:<br>
<blockquote><b>animateStars </b><br>
" Add and remove stars randomly, trying to keep total number of
stars = 'numberOfStars' "<br>
<Role: <i>#<b>Collab</b>> </i><Role: <i>#<b>StarsCount</b>></i><br>
[maestro currentState == #STARS] whileTrue:<br>
<i>[<b>Collab </b></i>refresh.<br>
<i><b>StarsCount </b></i>>= maxNumberOfStars ifTrue: [self
deleteStar].<br>
<i><b>StarsCount </b></i><= maxNumberOfStars ifTrue: [self
placeStar]]<br>
</blockquote>
The Parser extends role variable names such as <i><b>StarsCount </b></i>into<br>
<blockquote>self playerForRole: <i>#<b>StarsCount</b></i><br>
</blockquote>
which looks up the binding for <i>#<b>StarsCount </b></i>in a dynamic
name space. (The name space object lives on the stack)<br>
<br>
This was just a step in a larger experiment; more later.<br>
--Trygve<br>
<br>
On 19.03.2008 14:57, itsme213 wrote:
<blockquote cite="mid:frr64s$g7s$1@ger.gmane.org" type="cite">
<pre wrap="">"Ramon Leon" <a class="moz-txt-link-rfc2396E" href="mailto:ramon.leon@allresnet.com"><ramon.leon@allresnet.com></a> wrote in message
</pre>
<blockquote type="cite">
<pre wrap="">Pragmas are static and aren't nearly as flexible as
Magritte descriptors, which are real objects and don't face the
limitations
of pragmas.
</pre>
</blockquote>
<pre wrap=""><!---->
Perhaps it need not be either-or? e.g. The pragma could be evaluated to
record the "static" descriptions on the classes as any kind of real objects,
including Magritte-like Descriptions:
Foo>>x
<setUpMeta: #bar>
PragmaInterpreter>>setUpMeta: aSymbol for: aClass
aClass recordMeta: aSymbol
And there could still be instance-level access from objects, which by
default just uses the "static" descriptions that PragmaInterpreter recorded
on the classes, but has a hook for dynamic (instance-specific) behavior:
Object>>getMeta: aSymbol
(self class getMeta: aSymbol)
overridenBy: (self dynamicGetMeta: aSymbol)
Just a thought.
- Sophie
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="ProgId" content="Word.Document">
<meta name="Generator" content="Microsoft Word 10">
<meta name="Originator" content="Microsoft Word 10">
<link rel="File-List" href="TrygveSignature-filer/filelist.xml">
<title>-- </title>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:DrawingGridHorizontalSpacing>6 pt</w:DrawingGridHorizontalSpacing>
<w:DrawingGridVerticalSpacing>6 pt</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>3</w:DisplayVerticalDrawingGridEvery>
<w:UseMarginsForDrawingGridOrigin/>
<w:DoNotShadeFormData/>
<w:Compatibility>
<w:FootnoteLayoutLikeWW8/>
<w:ShapeLayoutLikeWW8/>
<w:AlignTablesRowByRow/>
<w:ForgetLastTabAlignment/>
<w:LayoutRawTableWidth/>
<w:LayoutTableRowsApart/>
<w:UseWord97LineBreakingRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
span.GramE
        {mso-style-name:"";
        mso-gram-e:yes;}
/* Page Definitions */
@page
        {mso-page-border-surround-header:no;
        mso-page-border-surround-footer:no;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;
        mso-header-margin:35.4pt;
        mso-footer-margin:35.4pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
        {mso-style-name:"Vanlig tabell";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
        mso-para-margin:0cm;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="2050"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
<div class="Section1">
<p class="MsoNormal" style=""><span class="SpellE"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Trygve</span></span><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">
Reenskaug<span style=""> </span>mailto: <span class="SpellE"><a class="moz-txt-link-abbreviated" href="mailto:trygver@ifi.uio.no">trygver@ifi.uio.no</a></span></span><span
style="font-size: 10pt; font-family: Arial;"><o:p></o:p></span></p>
<p class="MsoNormal" style=""><span class="SpellE"><span class="GramE"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Morgedalsvn</span></span></span><span
class="GramE"><span style="font-size: 10pt; font-family: Arial;"
lang="EN-GB">.</span></span><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> 5A <span
style=""> </span><a class="moz-txt-link-freetext" href="http://heim.ifi.uio.no/~trygver">http://heim.ifi.uio.no/~trygver</a><o:p></o:p></span></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: Arial;">N-0378
Oslo<span style=""> </span>Tel: (+47) 22 49 57 27<o:p></o:p></span></p>
<p class="MsoNormal" style=""><span class="SpellE"><span
style="font-size: 10pt; font-family: Arial;">Norway</span></span><span
style="font-size: 10pt; font-family: Arial;"><o:p></o:p></span></p>
</div>
</div>
</body>
</html>