ooc-dev team mailing list archive
-
ooc-dev team
-
Mailing list archive
-
Message #00051
Re: Request for comments - Arrays (Literals, Types, C Arrays, Stack allocation, Optimizations), and Constructors
So,
Regarding arrays, it would be nice to not have the var: Type[#] syntax
become var:=ArrayList<Type> new(#), and instead remain as a static C array.
This becomes crutial for covering C structures and speed-crutial functions.
Besides, if a person is using var: Type[#] syntax, they more than likely
already know what size the array is supposed to be, negating the usefulness
of having it as a resizable ArrayList.
For C structures, pointer syntax (Type*) can be used pretty much anywhere
(as Fred suggested), right?
Also, raw C arrays are unsafe (e.g. potential segmentation fault/undefined
behavior in case you access a wrong index), and have no notions of size (not
a too big problem for 1D arrays, but much more annoying for 2D/3D arrays).
Maybe there should be D-like ooc arrays that aren't "objects" per se, with
checked access, storing the size, etc?
About derived constructors: the idea is not to forbid overloading
constructors - that should be legal. The trick is to forbid calling a parent
constructor from a subclass.
Amos Wenger aka nddrylliog
On Sun, Feb 28, 2010 at 2:57 PM, Friedrich Weber <
fred.reichbier@xxxxxxxxxxxxxx> wrote:
> Hi there,
>
> I like the array literal changes!
>
>
> In Java, calling 'Dog new()' would be illegal. Should we forbid it in ooc
>> too? (Based on the name of the method, even if it's user-defined).
>> I think it's a wise choice, except it will maybe require more boilerplate
>> code in some classes.
>>
> Do we (the language users, not compiler developers) have any advantages if
> we forbid derived constructors?
>
> And I agree that we have to think about c-style arrays in functions and
> covers, too. Can we really just replace all C array declarations with
> pointer declarations?
>
> Cheers,
>
> Friedrich
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ooc-dev<https://launchpad.net/%7Eooc-dev>
> Post to : ooc-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ooc-dev<https://launchpad.net/%7Eooc-dev>
> More help : https://help.launchpad.net/ListHelp
>
References
-
Request for comments - Arrays (Literals, Types, C Arrays, Stack allocation, Optimizations), and Constructors
From: Amos Wenger, 2010-02-26
-
Re: Request for comments - Arrays (Literals, Types, C Arrays, Stack allocation, Optimizations), and Constructors
From: Friedrich Weber, 2010-02-28