March 06, 2012
Jonathan M Davis wrote:
> Nick ran into this problem and ended up writing an article on it:
>
> https://www.semitwist.com/articles/article/view/don-t-use-arrays-as-stacks
>
> And, of course, if you haven't read Steven's article on arrays, you should
> read that:
>
> http://www.dsource.org/projects/dcollections/wiki/ArrayArticle
>
> In fact, we really should get Steven's article up on dlang.org. It's one of
> those articles that _every_ D programmer should read.
>
> - Jonathan M Davis

I didn't know about array.reserve() and array.capacity! Is there any other undocumented methods? Like capacityStep maybe?

March 06, 2012
On Tuesday, March 06, 2012 04:59:42 F i L wrote:
> Jonathan M Davis wrote:
> > Nick ran into this problem and ended up writing an article on it:
> > 
> > https://www.semitwist.com/articles/article/view/don-t-use-arrays-as-stacks
> > 
> > And, of course, if you haven't read Steven's article on arrays,
> > you should
> > read that:
> > 
> > http://www.dsource.org/projects/dcollections/wiki/ArrayArticle
> > 
> > In fact, we really should get Steven's article up on dlang.org.
> > It's one of
> > those articles that _every_ D programmer should read.
> > 
> > - Jonathan M Davis
> 
> I didn't know about array.reserve() and array.capacity! Is there any other undocumented methods? Like capacityStep maybe?

They _are_ documented:

http://dlang.org/phobos/object.html

Though I can see why people would miss them.

- Jonathan M Davis
March 06, 2012
Jonathan M Davis wrote:
> They _are_ documented:
>
> http://dlang.org/phobos/object.html
>
> Though I can see why people would miss them.

I see. That's odd, though. What are array (specific?) methods doing in the Object base class?


March 06, 2012
On Tuesday, March 06, 2012 06:06:54 F i L wrote:
> Jonathan M Davis wrote:
> > They _are_ documented:
> > 
> > http://dlang.org/phobos/object.html
> > 
> > Though I can see why people would miss them.
> 
> I see. That's odd, though. What are array (specific?) methods
> doing in the Object base class?

They're _not_ in the Object base class. They're just in the same file - just like Throwable and Exception are (though oddly, those two aren't documented). It makes it so that you don't have to import anything to use them. They're _always_ available.

- Jonathan M Davis
March 06, 2012
Jonathan M Davis wrote:
> They're _not_ in the Object base class. They're just in the same file - just
> like Throwable and Exception are (though oddly, those two aren't documented).
> It makes it so that you don't have to import anything to use them. They're
> _always_ available.

Makes sense, thanks for the explanation.


1 2 3 4 5
Next ›   Last »