Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

In place of ArraySeq, using Seq and SeqView

Moderators: larsivi kris

Posted: 08/23/09 09:47:49

Two questions:

1. What do you used instead of ArraySeq??

2. How do you use for example Seq and SeqView??

Thanks

Author Message

Posted: 08/23/09 20:18:29

As for ArraySeq?, just use built-in arrays. I seem to remember I've answered this question before...

I assume that Seq and SeqView? are deprecated too. Can't remember what Seq is, but SeqView? is probably a read-only 'view' of a a sequence. Simply put, it exists because D and Java doesn't have 'const'. IIRC, there's also a PathView? in the FilePath? module.

Posted: 08/23/09 22:49:12

Yes, I've asked this question before. Maybe your right, about using built in arrays instead of a tango data structure.

With Seq and SeqView?. I wanted to know how to use them, I'm new at using interfaces and abstract classes, and I haven't done much inheritance. Abstract class's should be marked so, or are they all deprecated any way?

I don't know about D not having 'const'. For example you can put:

const NUM_OF_DOTS=1_000;

I'm actually doing Java at University, I'd have to say I'm struggling at the moment. And I don't know how to use Java's API much.

Thanks for your reply torhu.

Posted: 08/24/09 00:26:35

I should have said that by const I mean read-only parameters.

In C/C++ (and D2 but not D1), you can do this:

void func(const char* x);

That way, x is an input-only parameter, the data that it points to cannot be changed by func. Technically it can if you want to, but you really shouldn't do it. Java doesn't have that.

Good luck with your studies :)