--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
Language design question - why does abstract exist?Hear me out. It unlocks some really cool features -- implicit casts, array access, ... So the question then becomes:Why can't you just add these features to class?
Haxe says that abstract classes "defines types "over" concrete types in order to modify or augment their behavior" -- so wait, why wouldn't I just extend the class?
So the devil's advocate (me) says: Haxe used the wrong word, and the awesome functionality (mainly @:from, @:to, @:arrayAccess) should just be available to all classes. Adding another class-like type with a specific and incompatible feature-set just confuses things.
Do I have a right to question Haxe language design? Perhaps not.
[..] So I'd think my perceptions represent valuable feedback from a beginner.
Do I understand abstract?
So what I find confusing is - Haxe has all these powerful constructs, but every time I try to apply them, I hit a disallowed corner case. It feels symptomatic of an overly complicated system, hence my thought on simplification - let's talk pros/cons of removing abstract.
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
Johann - I'll ignore the personal attacks, since I suppose my sarcastic / aggressive tone invited them. Thank you for the explanation. Though I will point out that some other compiler magic (static analysis?) causes your Point/Int example to output the same .js code whether using a class or an abstract (sadly, in c++, using class does cause an allocation.)Philippe - Yes, that is one of my main questions.
--
Their nature is very different from classes since they have no runtime existence they are much more similar to typedefs with stamina.
Adding these feature to regular classes would just make the class system fatty and hard to maintain, not to say confusing for users which will not understand why some classes do not have runtime existence.
The runtime existence is a crucial point for optimisation, ergonomy and type tuning, it avoid many memory indirection which allows to have a very fast primitives like efficient bytes impl etc....
Maybe the name abstract is a cognitive pain though...but the feature is needed so imvho it can't go.
Johann - I'll ignore the personal attacks, since I suppose my sarcastic / aggressive tone invited them.
Thank you for the explanation. Though I will point out that some other compiler magic (static analysis?) causes your Point/Int example to output the same .js code whether using a class or an abstract
(sadly, in c++, using class does cause an allocation.)Philippe - Yes, that is one of my main questions.
On Friday, June 12, 2015 at 2:06:31 AM UTC+2, Jeff Ward wrote:Johann - I'll ignore the personal attacks, since I suppose my sarcastic / aggressive tone invited them.
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
I don't think anyone is really suggesting to remove abstracts. It's a call for explanations.
Like macros, the more concrete examples can be provided (like the recent macro examples repo which should be linked in the doc if it isn't), the better.
--
Blast, Joshua, there I was happy and you upset the balance by introducing something new. =)Too many choices is actually bad, because I (the beginner) burn too many cycles trying to understand which is best and never actually start writing code. Partial joke, partial truth. =DAlright, I'm off to synthesize abstract enums... the C++ / Haxe / CFFI example is beyond my head-space right now.Maybe that's the overall problem with learning Haxe. Inquisitive learners want to know why, and the why is ever beyond their reach.