Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread Martin
On 21/02/2016 11:15, Sven Barth wrote: Would it be possible to implement? Yes Would that mean that instance pointers would be handled as ordinal values? No, because "case" is merely a parser construct. In principle the condition and the case labels could be anything. String constants aren't

Re: [fpc-devel] pastojs

2016-02-21 Thread Michael Van Canneyt
On Sat, 20 Feb 2016, Mohmed Abdrais wrote: Hi fpc developer. i am interested in the pastojs utility. as you know pastojs  don't support class until now, and java script also .i  propose converting class like typescript language  do please take a look at type script.i added a code to do

[fpc-devel] pastojs

2016-02-21 Thread Mohmed Abdrais
Hi fpc developer.i am interested in the pastojs utility. as you know pastojs  don't support class until now, and java script also.i  propose converting class like typescript language  do please take a look at type script.i added a code to do that(partially). but before submitting a patch i want 

Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread tha...@thaddy.com
I knew that... It is a suggestion to extend the syntax. Sven explained how it could work. On 21-Feb-16 12:16 PM, Ewald wrote: The first case will compile, the second will not, failing with a "Constant Expression expected". So, if you would somehow know the instance pointers at compile time,

Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread Ewald
On 02/21/2016 11:37 AM, tha...@thaddy.com wrote: > > 1. > procedure TFrame00.ComboBoxChanged(Sender: TObject); > 2. > Var > 3. > x : TComboBox; > 4. > begin > 5. > If (Sender Is TComboBox) Then > 6. > begin > 7. > x := (Sender As

Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread Sven Barth
Am 21.02.2016 11:38 schrieb "tha...@thaddy.com" : > > > I have been pondering with that idea ever since the implementation of strings for case. [skip] > In other words, use the instance pointer as an ordinal value. > It looks a lot more logical but as it stands it is of course

Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread tha...@thaddy.com
It is also about notational convenience. In that sense it belongs to the language level and not in the library domain. And it is somewhat obvious to have. (I know I am not the only one who at some point in time was surprised you couldn't easily use instance pointers as ordinals) On 21-Feb-16

Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread tha...@thaddy.com
That's exactly what I use (a dictionary) to circumvent this language limitation and use a case expressively. I feel though, it is a limitation that could be solved. On 21-Feb-16 11:58 AM, Maciej Izak wrote: No much sense for me. Just use dictionary, for example TDictionary from

Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread tha...@thaddy.com
Hi Nikolai, Readability. A case is often much more readable, structured. Extended else use tends to become less readable over multiple choices than a case. I often wondered why my suggestion is not already possible. Regards, Thaddy On 21-Feb-16 11:49 AM, Nikolai Zhubr wrote: Hi, 21.02.2016

Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread Maciej Izak
No much sense for me. Just use dictionary, for example TDictionary from Generics.Collections (reminder for Sven ;P). ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread Nikolai Zhubr
Hi, 21.02.2016 13:37, tha...@thaddy.com: [...] x := (Sender As TComboBox); 8. 9. case x.Name of 10. 'ComboBox01':if x.ItemIndex = -1 then x.ItemIndex := PrjIndex else 11. begin And what's wrong with just this: if Sender = Combobox1 then ... else if Sender

[fpc-devel] Ability to handle instance pointers as ordinal type.

2016-02-21 Thread tha...@thaddy.com
I have been pondering with that idea ever since the implementation of strings for case. This morning I remembered again why it may be useful. Consider this code vs the alternative I suggest. Plz. do not value the code, it is just copied from the forum and frankly not the point but an