<!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">
    Whoop I rad wrong,.... forget the asClass thing,... this would
    really not work with a following perform:<br>
    What you intend to do here is really the become: thing....<br>
    <br>
    <br>
    Am 29.10.2010 20:23, schrieb Alexandre BP:
    <blockquote cite="mid:SNT138-w1979CBBEBA097C565F6EF09F450@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
      thanks for your time,
      <div>Your second solution seems very nice I'll try it as soon as
        possible.</div>
      <div><br>
      </div>
      <div>The second one however forces me to have a big list of loops
        that look like '(selectedType = 'Book') ifTrue: [var :=
        PaperBibliArticle new]. '&nbsp;</div>
      <div>which is neither clean nor evolutive.</div>
      <div>I wanted to do something like:</div>
      <div><br>
      </div>
      <div>&nbsp;dynamicTyping := ('PaperBibli', selectedType, ' new')
        asSymbol.</div>
      <div>bibEntry := PaperBibli perform: dynamicTyping.</div>
      <div><br>
      </div>
      <div>OR</div>
      <div><br>
      </div>
      <div>
        <meta charset="utf-8">
        <div style="text-indent: 0px ! important;">&nbsp;dynamicTyping :=
          ('PaperBibli', selectedType) asSymbol.</div>
        <div style="text-indent: 0px ! important;">bibEntry :=
          PaperBibli perform: dynamicTyping new.</div>
      </div>
      <div><br>
      </div>
      <div>--&gt; it doesn't work unfortunately ...</div>
      <div><br>
      </div>
      <div>OR:</div>
      <div><br>
      </div>
      <div>As in JAVA:</div>
      <div><br>
      </div>
      <div>PaperBibli bibEntry;</div>
      <div><br>
      </div>
      <div>(when I need it)</div>
      <div>bibEntry = new PaperBibliArticle;</div>
      <div><br>
      </div>
      <div>Anyway I'll try the second solution which is more elegant.</div>
      <div>thank you very much</div>
      <div>alex</div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div>&nbsp;</div>
      <div><br>
        &gt; Date: Fri, 29 Oct 2010 13:56:14 -0300<br>
        &gt; From: <a class="moz-txt-link-abbreviated" href="mailto:andres@lifia.info.unlp.edu.ar">andres@lifia.info.unlp.edu.ar</a><br>
        &gt; To: <a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
        &gt; Subject: Re: [Seaside] Dynamic typing in smalltalk<br>
        &gt; <br>
        &gt; Hi Alexandre,<br>
        &gt; I guess you could try two approaches:<br>
        &gt; <br>
        &gt; 1. Just list the classes in a select, so that the first
        step is choosing <br>
        &gt; the entry. Once you have this you just create the
        appropriate class.<br>
        &gt; <br>
        &gt; 2. Decouple the type of the object from the object itself
        (check also <br>
        &gt; <a class="moz-txt-link-freetext" href="http://www.ksc.com/article3.htm">http://www.ksc.com/article3.htm</a>). Thus PaperBibli would
        know an object <br>
        &gt; (lets say PaperType) whose subclasses would be Book,
        Article, etc. When <br>
        &gt; the user selects the type he wants you just set the
        object's type. The <br>
        &gt; type class is the one that holds the type-specific
        information.<br>
        &gt; <br>
        &gt; HTH,<br>
        &gt; Andr&eacute;s<br>
        &gt; <br>
        &gt; Alexandre BP escribi&oacute;:<br>
        &gt; &gt; thank you for your replyI have a class named
        "PaperBibli" which keeps a list of bibliographic entries.Those
        entries are of different type: Article, Book,
        Conference,...Every type has its own fields such as:
        author,title,...<br>
        &gt; &gt; --&gt; I created SubClasses of "PaperBibli" for each
        type so that when I instanciate an bibliographic entry I don't
        have lots of variables(fields) which are empty because not
        required in a particular type.The problem is that when I
        instanciate my bibliographic entry I still don't know of which
        type it is because the user tell me so by choosing in a scroll
        list.<br>
        &gt; &gt; I hope that my explanation is clear<br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; Date: Fri, 29 Oct 2010 12:24:22 -0400<br>
        &gt; &gt; Subject: Re: [Seaside] Dynamic typing in smalltalk<br>
        &gt; &gt; From: <a class="moz-txt-link-abbreviated" href="mailto:sean@monkeysnatchbanana.com">sean@monkeysnatchbanana.com</a><br>
        &gt; &gt; To: <a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
        &gt; &gt; <br>
        &gt; &gt; There are types in smalltalk. Each object has a type.<br>
        &gt; &gt; That aside, what are you trying to accomplish with
        your example below?<br>
        &gt; &gt; <br>
        &gt; &gt; On Fri, Oct 29, 2010 at 12:13 PM, Alexandre BP
        <a class="moz-txt-link-rfc2396E" href="mailto:abalonpe@ulb.ac.be">&lt;abalonpe@ulb.ac.be&gt;</a> wrote:<br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; Hello,<br>
        &gt; &gt; I would like to know if it is possible to apply
        dynamic typing in smalltalk. For example, If I want to use
        polymorphism, it would be: <br>
        &gt; &gt; var := Class new. var := (SubClass1) message. var :=
        (SubClass2) message.<br>
        &gt; &gt; <br>
        &gt; &gt; Where message from SubClass1 is different then the one
        from SubClass2.Is there any solution for my problem? I know that
        there is no type in smalltalk but there is definitely a way to
        use polymorphism right?<br>
        &gt; &gt; <br>
        &gt; &gt; Thank you in advance,Regardsalex <br>
        &gt; &gt; <br>
        &gt; &gt; _______________________________________________<br>
        &gt; &gt; <br>
        &gt; &gt; seaside mailing list<br>
        &gt; &gt; <br>
        &gt; &gt; <a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
        &gt; &gt; <br>
        &gt; &gt;
        <a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt; _______________________________________________<br>
        &gt; &gt; seaside mailing list<br>
        &gt; &gt; <a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
        &gt; &gt;
        <a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
        <br>
        &gt; &gt; <br>
        &gt; &gt; <br>
        &gt; &gt;
        ------------------------------------------------------------------------<br>
        &gt; &gt; <br>
        &gt; &gt; _______________________________________________<br>
        &gt; &gt; seaside mailing list<br>
        &gt; &gt; <a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
        &gt; &gt;
        <a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
        &gt; _______________________________________________<br>
        &gt; seaside mailing list<br>
        &gt; <a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
        &gt;
        <a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
seaside mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>