<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 16, 2015 at 5:40 PM, Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>On 16.07.2015 22:17, Maciej Izak wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>
2015-07-16 17:23 GMT+02:00 Sven Barth <<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a><br></span>
<mailto:<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>>>:<div><div><br>
<br>
    Then let me tell you that generic methods will arrive in mode ObjFPC<br>
    (and thus its syntax) first, because the Delphi syntax is a PITA to<br>
    parse/handle.<br>
<br>
    (in fact generic methods are already working in mode ObjFPC in my<br>
    local repo, I just want to get the Delphi ones working a little bit<br>
    before commiting to trunk)<br>
<br>
<br>
@Sven, @Michael<br>
<br>
I am using generics all the time for many things.<br>
<br>
IMO using "generic/specialize" syntax because it is more simple to<br>
implement in compiler is very strange motivation. Using specialize<br>
keyword maybe is good in pure theory but is non practical (generic<br>
keyword in type declaration is not so bad).<br>
<br>
You can torture me (!!!) but I will not use so many unnecessary words<br>
for simple things.<br>
By using this complicated syntax you will kill all functional/generic<br>
approach.<br>
<br>
Advice "if you like shorter syntax then go to other language" is no<br>
solution for me. I like some modern versions of Pascal like presented in<br>
Oxygen and till Delphi XE2 (! many things after XE2 is pure evil).<br>
<br>
I am working on smart pointers/objects (some evolution/for the purposes<br>
of Generics.Collections). Syntax with generic/specialize is not "smart"<br>
for my branch:<br>
<br>
=============== CODE BEGIN ===============<br>
{$MODE SPARTA}<br>
var<br>
   X: strong TDictionary<weak TList<Integer>, string>;<br>
</div></div></blockquote>
<br>
Prefixed modifiers are the /worst/ you can do for Pascal.<span><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
{ sugar syntax for<br>
var<br>
   X: SmartObj<TDictionary<WeakObj<TList<Integer>>, string>>;  }<br>
===============  CODE END  ===============<br>
so probably in ObjFPC, code above will become:<br>
=============== CODE BEGIN ===============<br>
{$MODE OBJFPC}<br>
type<br>
   TList_Integer = specialize TList<Integer>;<br>
   WeakObj_TList_Integer = specialize WeakObj<TList_Integer>;<br>
   TDictionary_WeakObj_TList_Integer_String = specialize<br>
TDictionary<WeakObj_TList_Integer, string>;<br>
   SmartObj_TDictionary_WeakObj_TList_Integer_String = specialize<br>
SmartObj<TDictionary_WeakObj_TList_Integer_String>;<br>
var<br>
   X: SmartObj_TDictionary_WeakObj_TList_Integer_String;<br>
===============  CODE END  ===============<br>
<br>
Another simple example. Maybe not a good example to follow, but it shows<br>
the problems:<br>
</blockquote>
<br></span>
The generic and specialize keywords and inline specialization are two completely different topics (plus nested specializations, which are simply not supported yet). While currently mode FPC uses the keywords, but does not allow inline specializations I'm in favor of allowing the latter in mode ObjFPC as well, because with the future addition of generic methods it would simply be strange to not allow it. Also we already allow it for parameters and partially for variable declarations as well, so not allowing it in code is simply inconsistent...<br>
<br>
In the end your code above will look like this in mode ObjFPC:<br>
<br>
=== code begin ===<br>
<br>
var<br>
  X: specialize SmartObj<specialize TDictionary<specialize WeakObj<specialize TList<Integer> >, string> >;<br>
// the spaces between the "> >" are added, because I don't know yet whether I'll be able to deal with the fact that the scanner always converts ">>" to "shr" (and "<<" to "shl")<br>
<br>
=== code end ===<br>
<br>
Regards,<br>
Sven</blockquote></div><div><br></div><div>Hm... and more, the 'i := 1 << 1' isn't a "more Pascal-like" syntax, IMHO. =)</div><div><br></div><div>It compiles in '$mode delphi', but the BCC doesn't allows this sintax, returning an "Expression expected but '<' found". What do you think about doing it (... Integer>>) possible in $mode delphi? =)</div><div><br></div>-- <br><div>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a></div>
</div></div>