tag:blogger.com,1999:blog-6173836134826281546.post7920688341931199727..comments2024-03-18T00:40:47.641-07:00Comments on Zdeněk Troníček's blog: Nonlocal transferZdeněk Troníčekhttp://www.blogger.com/profile/12818559511505042249noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-6173836134826281546.post-90618327754736860112021-04-25T11:31:12.971-07:002021-04-25T11:31:12.971-07:00Compre documentos en línea, documentos originales ...<b>Compre documentos en línea, documentos originales y registrados.</b><br />Acerca de Permisodeespana, algunos dicen que somos los solucionadores de problemas, mientras que otros se refieren a nosotros como vendedores de soluciones. Contamos con cientos de clientes satisfechos a nivel mundial. Hacemos documentos falsos autorizados y aprobados como Permiso de Residencia Español, DNI, Pasaporte Español y Licencia de Conducir Española. Somos los fabricantes y proveedores de primer nivel de estos documentos, reconocidos a nivel mundial.<br /><br />Comprar permiso de residencia,<br />permiso de residenciareal y falso en línea,<br />Compre licencia de conducir en línea,<br /><a href="https://permisodeespana.com/" rel="nofollow">Compre una licencia de conducir española falsa en línea</a>,<br />Comprar tarjeta de identificación,<br />Licencia de conducir real y falsa,<br />Compre pasaporte real en línea,<br /><br /> Visit Here fpr more information. :- <a href="https://permisodeespana.com/" rel="nofollow">https://permisodeespana.com/licencia-de-conducir-espanola/</a><br />Address: 56 Guild Street, London, EC4A 3WU (UK)<br />Email: contact@permisodeespana.com<br />WhatsApp: +443455280186<br />Plumbing & HVAC Services San Diegohttps://www.blogger.com/profile/14331873086079628144noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-6229895498979325032008-09-19T01:56:00.000-07:002008-09-19T01:56:00.000-07:00Hi Dimitris,I agree with you that you must think w...Hi Dimitris,<BR/><BR/>I agree with you that you must think when you read this example. But does it contain anything that has not been explained before? Definitely no because the semantics of 'return' should be known from the previous example.<BR/><BR/>Anyway, to make you happy, I changed the example slightly.Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-11389488822980544812008-09-18T08:54:00.000-07:002008-09-18T08:54:00.000-07:00"int" is overloaded in this example, Dennis is rig..."int" is overloaded in this example, Dennis is right that this creates ambiguity.<BR/><BR/>"Nothing" (or anything apart from int) would easily make it clear as to where "return 1;" is actually returning.Anonymoushttps://www.blogger.com/profile/07286834543482860937noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-39691727917468067702008-09-04T09:06:00.000-07:002008-09-04T09:06:00.000-07:00"what does return do when it is found in a closure...<I>"what does return do when it is found in a closure?"</I><BR/><BR/>This is explained in the example that preceeds the example you find confusing.<BR/><BR/><I>"what does a single value at the end of the closure body do?"</I><BR/><BR/>The "confusing" example is not supposed to explain this. The example is, as is clearly stated in the text, about the UnmatchedTransfer exception.<BR/><BR/>As for Nothing, it is not common to use it as return type in a function type. Its primary use is in compiler generated code.Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-63670078399527953852008-09-04T03:45:00.000-07:002008-09-04T03:45:00.000-07:00I am not sure I should continue this discussion......I am not sure I should continue this discussion... You do not seem to see the problem.<BR/><BR/>In the latest example the semantics of p are "<I>In the correct context,</I>, if some random number is less than 0.5 then return from m1 with the value 1; otherwise the expression evaluates to 2."<BR/><BR/>Because both p and m1 return an integer, the type annotations in the example do not help readers to understand the semantics of p. In other words, that example is <B>confusing</B>. It relies on information found elsewhere (what does return do when it is found in a closure? what does a single value at the end of the closure body do?) for its interpretation.<BR/><BR/>A <B>good</B> example is self-documenting, does not rely on much prior knowledge from the reader for understanding. I suggest that using the appropriate type for the return value of p (in that case, Nothing) would make the example in the article better.<BR/><BR/>Well that was my last post here, I will quit complaining now.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-79854804741192994892008-08-29T07:03:00.000-07:002008-08-29T07:03:00.000-07:00Another example of UnmatchedTransfer exception:sta...Another example of UnmatchedTransfer exception:<BR/><BR/><I><BR/>static { ==> int } p;<BR/> <BR/>static int m1() {<BR/> p = { ==> if (Math.random() < 0.5) return 1; 2 };<BR/> return 0;<BR/>}<BR/> <BR/>public static void main(String[] args) {<BR/> System.out.println(m1());<BR/> System.out.println(p.invoke());<BR/>}<BR/></I>Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-88221455567700807402008-08-28T05:01:00.000-07:002008-08-28T05:01:00.000-07:00Perhaps it is confusing but Nothing is not a bette...Perhaps it is confusing but Nothing is not a better choice in my opinion.<BR/><BR/>Regarding the question "what is p.invoke() supposed to return?": it is expected to return int because p is of type { ==> int }. Even closures that are supposed to return a value can use the return statement. This is shown in 'p = { ==> return 1; };'. If you call such a closure in right context, the missing return value will not cause any problem. But if you call it in wrong context (as is done in the example), you will get the UnmatchedTransfer exception.Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-37199157074659603932008-08-28T01:59:00.000-07:002008-08-28T01:59:00.000-07:00That is why I wrote "This example is confusing". I...That is why I wrote "This example is confusing". IMHO you need to revise it.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-73600772559504355872008-08-27T22:50:00.000-07:002008-08-27T22:50:00.000-07:00p.invoke() does not return anything because the cl...p.invoke() does not return anything because the closure always ends with the return statement that is bound to the enclosing method. The closure can have any return type (int, Nothing, void,...) in such case.Zdeněk Troníčekhttps://www.blogger.com/profile/12818559511505042249noreply@blogger.comtag:blogger.com,1999:blog-6173836134826281546.post-4391837504764597892008-08-27T18:01:00.000-07:002008-08-27T18:01:00.000-07:00This example is confusing. What is p.invoke() supp...This example is confusing. What is p.invoke() supposed to return?<BR/><BR/><I> static { ==> int } p;<BR/> <BR/> static int m1() {<BR/> p = { ==> return 1; };<BR/> return 0;<BR/> }<BR/> <BR/> public static void main(String[] args) {<BR/> System.out.println(m1());<BR/> System.out.println(p.invoke());<BR/> }<BR/></I><BR/><BR/>I would suggest:<BR/><BR/><I> static { ==> Nothing } p;<BR/>....<BR/> System.out.println(m1());<BR/> p.invoke();<BR/></I>Anonymousnoreply@blogger.com