<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
Codul arata asa<br>
<br>
<tt>class int inherits intModel<br>
...<br>
local intModel x; end;<br>
...<br>
x = new int;<br>
</tt><br>
Este ok, pentru ca orice int este un intModel, asta inseamna ca o
referinta la int (new int) poate fi folosita oriunde ai nevoie de o
referinta la intModel (x). <br>
<br>
Este exact invers fata de cum ai descris mai jos.<br>
<br>
Bogdan<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/26/2015 12:38 PM, Dragos Rugescu
via cpl wrote:<br>
</div>
<blockquote
cite="mid:348709441.4112330.1448534304831.JavaMail.yahoo@mail.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:verdana, helvetica, sans-serif;font-size:10px">
<div id="yui_3_16_0_1_1448101622248_115814"><span
id="yui_3_16_0_1_1448101622248_115910">Multumesc de
promptitudine. </span></div>
<div id="yui_3_16_0_1_1448101622248_115814"><span><br>
</span></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><span
id="yui_3_16_0_1_1448101622248_115926">Cu toate acestea, in
cazul exemplului dat de mine, attr-miss3, tot nu inteleg de
ce trebuie sa se returneze respectiva eroare. Pare ca ar
intoarce eroare din linia 16, de la cast-ul unei necunoscute
variabile y, cand exista o eroare precedenta pe care codul
meu a scos-o in evidenta. Iarasi, trebuie ghicit. Cu toate
acestea</span> nu exista nicio alta variabila in acel cod
care sa dea eroare de nedefinire.</div>
<div id="yui_3_16_0_1_1448101622248_115814"><span><br>
</span></div>
<div id="yui_3_16_0_1_1448101622248_115814">Reproduc din manual
LCPL:</div>
<div id="yui_3_16_0_1_1448101622248_115814"><br>
</div>
<div id="yui_3_16_0_1_1448101622248_115814"><ID> =
<EXPR></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
id="yui_3_16_0_1_1448101622248_115929" class=""><expr
id="yui_3_16_0_1_1448101622248_115931" class="">[...] Cele
doua tipuri trebuie sa corespunda, sau tipul expresiei <expr
id="yui_3_16_0_1_1448101622248_115933" class=""> sa
poata fi convertit implicit la tipul expresiei<id
id="yui_3_16_0_1_1448101622248_115935" class="">.
[...]<string id="yui_3_16_0_1_1448101622248_115937"
class=""><expr
id="yui_3_16_0_1_1448101622248_115939" class=""> <span
id="yui_3_16_0_1_1448101622248_116049">Pentru o
variabila de un anumit tip se poate folosi orice
tip aflat mai jos in ierarhia de clase</span>.</expr></string></id></expr></expr></id><br>
</div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class="" id="yui_3_16_0_1_1448101622248_116713"><expr
class="" id="yui_3_16_0_1_1448101622248_116711"><expr
class="" id="yui_3_16_0_1_1448101622248_116709"><id
class="" id="yui_3_16_0_1_1448101622248_116707"><string
class="" id="yui_3_16_0_1_1448101622248_116705"><expr
class="" id="yui_3_16_0_1_1448101622248_116703"><br
id="yui_3_16_0_1_1448101622248_116702">
</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class="" id="yui_3_16_0_1_1448101622248_116087"><expr
class="" id="yui_3_16_0_1_1448101622248_116086"><expr
class="" id="yui_3_16_0_1_1448101622248_116085"><id
class="" id="yui_3_16_0_1_1448101622248_116084"><string
class="" id="yui_3_16_0_1_1448101622248_116083"><expr
class="" id="yui_3_16_0_1_1448101622248_116082">Concret,
in testul attr-miss3, avem situatia ierarhiei de
clase:<span id="yui_3_16_0_1_1448101622248_116373"> int
(mosteneste) <span
id="yui_3_16_0_1_1448101622248_116265">intModel</span></span></expr></string></id></expr></expr></id><span
class="" id="yui_3_16_0_1_1448101622248_116432">.</span></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class=""><expr class=""><expr class=""><id class=""><string
class=""><expr class=""><b><br>
</b></expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class="" id="yui_3_16_0_1_1448101622248_116448"><expr
class="" id="yui_3_16_0_1_1448101622248_116447"><expr
class="" id="yui_3_16_0_1_1448101622248_116446"><id
class="" id="yui_3_16_0_1_1448101622248_116445"><string
class="" id="yui_3_16_0_1_1448101622248_116444"><expr
class="" id="yui_3_16_0_1_1448101622248_116443">Pe
liniile 13 si 14 avem asa:</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class=""><expr class=""><expr class=""><id class=""><string
class=""><expr class=""><br>
</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class="" id="yui_3_16_0_1_1448101622248_116582"><expr
class="" id="yui_3_16_0_1_1448101622248_116581"><expr
class="" id="yui_3_16_0_1_1448101622248_116580"><id
class="" id="yui_3_16_0_1_1448101622248_116579"><string
class="" id="yui_3_16_0_1_1448101622248_116578"><expr
class="" id="yui_3_16_0_1_1448101622248_116577">local
intModel x; end;</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class=""><expr class=""><expr class=""><id class=""><string
class=""><expr class="">x = new int;</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class=""><expr class=""><expr class=""><id class=""><string
class=""><expr class=""><br>
</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class="" id="yui_3_16_0_1_1448101622248_116898"><expr
class="" id="yui_3_16_0_1_1448101622248_116897"><expr
class="" id="yui_3_16_0_1_1448101622248_116896"><id
class="" id="yui_3_16_0_1_1448101622248_116895"><string
class="" id="yui_3_16_0_1_1448101622248_116894"><expr
class="" id="yui_3_16_0_1_1448101622248_116893">In
cazul acesta, tipul expresiei (int) este mai "sus"
in ierarhie fata de tipul variabilei (intModel).
Ceea ce inseamna ca nu se poate reduce un tip mai
complex la unul mai simplu (are si o metoda in
plus!). Este asa?</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class=""><expr class=""><expr class=""><id class=""><string
class=""><expr class=""><br>
</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class="" id="yui_3_16_0_1_1448101622248_116882"><expr
class="" id="yui_3_16_0_1_1448101622248_116881"><expr
class="" id="yui_3_16_0_1_1448101622248_116880"><id
class="" id="yui_3_16_0_1_1448101622248_116879"><string
class="" id="yui_3_16_0_1_1448101622248_116878"><expr
class="" id="yui_3_16_0_1_1448101622248_116877">Vreau
doar sa ma asigur ca am inteles corect. Daca da,
inseamna ca eroarea intoarsa de testul respectiv
nu este cea corecta, existand una care apare mai
devreme.</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class=""><expr class=""><expr class=""><id class=""><string
class=""><expr class=""><br>
</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115814" dir="ltr"><id
class="" id="yui_3_16_0_1_1448101622248_117194"><expr
class="" id="yui_3_16_0_1_1448101622248_117193"><expr
class="" id="yui_3_16_0_1_1448101622248_117192"><id
class="" id="yui_3_16_0_1_1448101622248_117191"><string
class="" id="yui_3_16_0_1_1448101622248_117190"><expr
class="" id="yui_3_16_0_1_1448101622248_117189">Multumesc
pentru explicatii,</expr></string></id></expr></expr></id></div>
<div id="yui_3_16_0_1_1448101622248_115816"> </div>
<div class="signature" id="yui_3_16_0_1_1448101622248_115819">
<div id="yui_3_16_0_1_1448101622248_115818">Dragos-Ronald
Rugescu<span style="font-weight:bold;"></span></div>
<div style="font-family:arial, helvetica, clean, sans-serif;"
id="yui_3_16_0_1_1448101622248_115821"><span
style="font-weight:bold;"><br>
</span></div>
<div style="font-family:arial, helvetica, clean, sans-serif;"
id="yui_3_16_0_1_1448101622248_115824"><span
id="yui_3_16_0_1_1448101622248_115823">Assistant CEO</span><br>
<span id="yui_3_16_0_1_1448101622248_116293">ADDA Ltd</span></div>
<div style="font-family:arial, helvetica, clean, sans-serif;"
id="yui_3_16_0_1_1448101622248_115828"><span
id="yui_3_16_0_1_1448101622248_115827">Excellence.
Professionalism. Vision.</span><br>
18 Pictor Octav Bancila St., Sector 6, Bucharest, 060144<br>
</div>
<div style="font-family:arial, helvetica, clean, sans-serif;"
id="yui_3_16_0_1_1448101622248_115828">Romania</div>
<div style="font-family:arial, helvetica, clean, sans-serif;"
id="yui_3_16_0_1_1448101622248_115828"><a class="moz-txt-link-abbreviated" href="mailto:dragos.rugescu@yahoo.com">dragos.rugescu@yahoo.com</a></div>
</div>
<br>
<div class="qtdSeparateBR"
id="yui_3_16_0_1_1448101622248_115856"><br>
<br>
</div>
<div class="yahoo_quoted" id="yui_3_16_0_1_1448101622248_115864"
style="display: block;">
<div style="font-family: verdana, helvetica, sans-serif;
font-size: 10px;" id="yui_3_16_0_1_1448101622248_115863">
<div style="font-family: HelveticaNeue, Helvetica Neue,
Helvetica, Arial, Lucida Grande, sans-serif; font-size:
16px;" id="yui_3_16_0_1_1448101622248_115862">
<div dir="ltr" id="yui_3_16_0_1_1448101622248_115880"><font
id="yui_3_16_0_1_1448101622248_115879" size="2"
face="Arial"> On Wednesday, November 25, 2015 10:27
PM, Bogdan Nitulescu via cpl
<a class="moz-txt-link-rfc2396E" href="mailto:cpl@cursuri.cs.pub.ro"><cpl@cursuri.cs.pub.ro></a> wrote:<br>
</font></div>
<br>
<br>
<div class="y_msg_container"
id="yui_3_16_0_1_1448101622248_115861">
<div id="yiv9686699542">
<div id="yui_3_16_0_1_1448101622248_115860"> Ai
dreptate. E nevoie de un pic de ajutor aici. Dar e
simplu.<br clear="none">
<br clear="none">
OK, sa zicem ca am dat<br clear="none">
<blockquote type="cite"
id="yui_3_16_0_1_1448101622248_115878">make
run-attr-miss3<br clear="none">
</blockquote>
si primesc un fail "Wrong error:" . De unde stiu
care este "the Right error"?<br clear="none">
<br clear="none">
Well testul e implementat in C++ , si se gaseste in
tests/error/attr-miss3TestRig.cpp . Codul arata
asa:<br clear="none">
<br clear="none">
<blockquote type="cite"
id="yui_3_16_0_1_1448101622248_115867"><tt
id="yui_3_16_0_1_1448101622248_115876"> bool
test(lcpl::Program *p) noexcept override {</tt><tt><br
clear="none">
</tt><tt> try {</tt><tt><br clear="none">
</tt><tt id="yui_3_16_0_1_1448101622248_115871">
createAndRunSema(p);</tt><tt><br
clear="none">
</tt><tt id="yui_3_16_0_1_1448101622248_115869">
} catch (lcpl::UnknownVariableException
&) {</tt><tt><br clear="none">
</tt><tt id="yui_3_16_0_1_1448101622248_115866">
return pass();</tt><tt><br clear="none">
</tt><tt id="yui_3_16_0_1_1448101622248_115874">
} catch (lcpl::SemanticException &e) {</tt><tt><br
clear="none">
</tt><tt> return fail(std::string("Wrong
error: ") + e.what());</tt><tt><br clear="none">
</tt><tt> }</tt><tt><br clear="none">
</tt> <tt><br clear="none">
</tt><tt> return fail("Should error");</tt><tt><br
clear="none">
</tt><tt> }</tt></blockquote>
<br clear="none">
Si devine destul de clar. Output-ul corect este dat
de un "throw UnknownVariableException".<br
clear="none">
<br clear="none">
Adaug si in wiki.<br clear="none">
<br clear="none">
--Bogdan<br clear="none">
<br clear="none">
<div class="yiv9686699542yqt1757119249"
id="yiv9686699542yqt86815">
<div class="yiv9686699542moz-cite-prefix">On
11/25/2015 8:28 PM, Dragos Rugescu via cpl
wrote:<br clear="none">
</div>
<blockquote type="cite">
<div
style="color:#000;background-color:#fff;font-family:verdana,
helvetica, sans-serif;font-size:10px;">
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100441"><span>Buna
seara,</span></div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100443"><span><br
clear="none">
</span></div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100373">Am
o problema de depanare.</div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100370"><span><br
clear="none">
</span></div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100339"><span
id="yiv9686699542yui_3_16_0_1_1448101622248_100343">Spre exemplu, in
cazul testului attr-miss3, tester-ul
raporteaza ca am output prost.</span></div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100339"><span
id="yiv9686699542yui_3_16_0_1_1448101622248_100587">(FAIL: Wrong error:
Error in line 14 : Incompatible types
intModel and int)</span></div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100339"><span><br
clear="none">
</span></div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100339"><span
id="yiv9686699542yui_3_16_0_1_1448101622248_100503">Nu spune insa de ce,
si care ar fi cel corect. Toate testele
precedente imi trec, (inclusiv attr-miss
si attr-miss2). Holbandu-ma la fisierul
sursa, nu vad ce nu e in regula la
output-ul meu.</span></div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100337"><span><br
clear="none">
</span></div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100335">In
fazele initiale de rezolvare a temei ramanem
doar la ghicit (poate o fi atributul, poate
nu).</div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100335"><br
clear="none">
</div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100335">Avand
in vedere ca este foarte dificil de urmarit
ce se doreste a fi output-ul corect in unele
circumstante, cum putem vedea in caz de
eroare, ce trebuia sa afisam? Analizand
structura arhivei, output-ul interpretorului
imi pare obfuscat special (what's the
point?).<span><br clear="none">
</span></div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100335"><br
clear="none">
</div>
<div dir="ltr"
id="yiv9686699542yui_3_16_0_1_1448101622248_100335">Multumesc
anticipat,</div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100341"> </div>
<div class="yiv9686699542signature"
id="yiv9686699542yui_3_16_0_1_1448101622248_100323">
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100333">Dragos-Ronald
Rugescu<span style="font-weight:bold;"></span></div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100331"
style="font-family:arial, helvetica,
clean, sans-serif;"><span
style="font-weight:bold;"><br
clear="none">
</span></div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100329"
style="font-family:arial, helvetica,
clean, sans-serif;"><span
style="font-weight:bold;">Assistant CEO</span><br
clear="none">
<span style="font-weight:bold;">ADDA Ltd</span></div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100327"
style="font-family:arial, helvetica,
clean, sans-serif;"><span
id="yiv9686699542yui_3_16_0_1_1448101622248_100501"
style="font-style:italic;">Excellence.
Professionalism. Vision.</span><br
clear="none">
18 Pictor Octav Bancila St., Sector 6,
Bucharest, 060144<br clear="none">
<span
id="yiv9686699542yui_3_16_0_1_1448101622248_100499"
style="font-weight:bold;"><span
style="color:rgb(0, 0, 127);">Ro</span><span
style="color:rgb(255, 127, 0);">ma</span><span
style="color:rgb(255, 0, 0);">nia</span>,
<span style="color:rgb(0, 0, 191);">E</span><span
style="color:rgb(191, 191, 0);">U</span></span><br
clear="none">
<a moz-do-not-send="true" rel="nofollow"
shape="rect" target="_blank"
href="http://www.addastronautica.r0/">www.addastronautica.ro</a></div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100325"
style="font-family:arial, helvetica,
clean, sans-serif;"><a
moz-do-not-send="true" rel="nofollow"
shape="rect"
class="yiv9686699542moz-txt-link-abbreviated"
ymailto="mailto:dragos.rugescu@yahoo.com" target="_blank"
href="mailto:dragos.rugescu@yahoo.com"><a class="moz-txt-link-abbreviated" href="mailto:dragos.rugescu@yahoo.com">dragos.rugescu@yahoo.com</a></a><br
clear="none">
</div>
<div
id="yiv9686699542yui_3_16_0_1_1448101622248_100322"><a
moz-do-not-send="true" rel="nofollow"
shape="rect"
class="yiv9686699542moz-txt-link-abbreviated"
ymailto="mailto:dragos.rugescu@addastronautica.ro" target="_blank"
href="mailto:dragos.rugescu@addastronautica.ro"><a class="moz-txt-link-abbreviated" href="mailto:dragos.rugescu@addastronautica.ro">dragos.rugescu@addastronautica.ro</a></a><br
clear="none">
</div>
</div>
</div>
<br clear="none">
<fieldset
class="yiv9686699542mimeAttachmentHeader"></fieldset>
<br clear="none">
<pre>_______________________________________________
cpl mailing list
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="yiv9686699542moz-txt-link-abbreviated" ymailto="mailto:cpl@cursuri.cs.pub.ro" target="_blank" href="mailto:cpl@cursuri.cs.pub.ro">cpl@cursuri.cs.pub.ro</a>
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="yiv9686699542moz-txt-link-freetext" target="_blank" href="http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/cpl">http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/cpl</a>
</pre>
</blockquote>
</div>
<br clear="none">
</div>
</div>
<br>
<div class="yqt1757119249" id="yqt59087">_______________________________________________<br
clear="none">
cpl mailing list<br clear="none">
<a moz-do-not-send="true" shape="rect"
ymailto="mailto:cpl@cursuri.cs.pub.ro"
href="mailto:cpl@cursuri.cs.pub.ro">cpl@cursuri.cs.pub.ro</a><br
clear="none">
<a moz-do-not-send="true" shape="rect"
href="http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/cpl"
target="_blank">http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/cpl</a><br
clear="none">
</div>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
cpl mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cpl@cursuri.cs.pub.ro">cpl@cursuri.cs.pub.ro</a>
<a class="moz-txt-link-freetext" href="http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/cpl">http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/cpl</a>
</pre>
</blockquote>
<br>
</body>
</html>