On 2012-05-16 07:35, Simen Kjaeraas wrote:
That depends. Will the contents be modified?
I have no idea. I'm working on a tool for automatically translating C
headers. I was thinking since I don't know, I better not add any
promises that is not kept.
--
/Jacob Carlborg
This code:
--
import std.stdio;
struct Foo
{
int val;
@property bool empty() {
return val >= 5;
}
@property int front() {
return val;
}
void popFront() {
val++;
}
}
void main()
{
Foo foo;
forea
Am 14.05.2012 20:40, schrieb Stephen Jones:
Ali Çehreli post got your answer - see the last example of the post
news://news.digitalmars.com:119/jov3gn$2vtg$1...@digitalmars.com
but first: try to understand how the base-class, interface stuff realy
works - you will got the same problems in every
On Tue, 15 May 2012 21:58:46 +0200, Jacob Carlborg wrote:
On 2012-05-15 21:50, Ali Çehreli wrote:
Not possible in D. D's const is transitive. If b is const, then what it
points to is also const.
Ali
Then it would be best to not declare that as const?
That depends. Will the contents be
On 16-05-2012 05:21, H. S. Teoh wrote:
On Wed, May 16, 2012 at 05:06:54AM +0200, Alex Rønne Petersen wrote:
On 16-05-2012 05:03, H. S. Teoh wrote:
On Wed, May 16, 2012 at 04:35:17AM +0200, Alex Rønne Petersen wrote:
Hi,
Suppose that I have an AA that I'm doing lookups on from one thread,
and
On Wed, May 16, 2012 at 05:06:54AM +0200, Alex Rønne Petersen wrote:
> On 16-05-2012 05:03, H. S. Teoh wrote:
> >On Wed, May 16, 2012 at 04:35:17AM +0200, Alex Rønne Petersen wrote:
> >>Hi,
> >>
> >>Suppose that I have an AA that I'm doing lookups on from one thread,
> >>and writing to in another.
Gah, I need to proof-read my code before posting. Here's the corrected
version:
class Simpson {
string name;
}
class Bart : Simpson {
this() {
name = "Bart Simpson";
}
}
class Homer : Si
On 16-05-2012 05:03, H. S. Teoh wrote:
On Wed, May 16, 2012 at 04:35:17AM +0200, Alex Rønne Petersen wrote:
Hi,
Suppose that I have an AA that I'm doing lookups on from one thread,
and writing to in another. Is this safe at all? Naturally, I'm
willing to accept the data races involved, but the
On Wed, May 16, 2012 at 04:24:12AM +0200, Stephen Jones wrote:
[...]
> Thanks Ali for the syntax, some very useful bits and pieces I did
> not know. I do not want to use property syntax. Form a performance
> perspective I cannot see any good reason not to simply use an array
> of pointers to the di
On Wed, May 16, 2012 at 04:35:17AM +0200, Alex Rønne Petersen wrote:
> Hi,
>
> Suppose that I have an AA that I'm doing lookups on from one thread,
> and writing to in another. Is this safe at all? Naturally, I'm
> willing to accept the data races involved, but the question is
> whether the concur
On Wed, May 16, 2012 at 04:01:23AM +0200, Stephen Jones wrote:
[...]
> Using Object gives exactly the same problem as the Object super
> class does not have vcount variable. Casting is not a solution
> because the reason for throwing different sorts of widgets into a
> single array was so I did not
I'd typed the response before it displayed your reply that
already answered the question. =) Sadly Array!bool doesn't seem
to be memoizable, I assume memoization only sees container
information or something like that. How would I go about creating
an index accessible array using a struct of bit
Hi,
Suppose that I have an AA that I'm doing lookups on from one thread, and
writing to in another. Is this safe at all? Naturally, I'm willing to
accept the data races involved, but the question is whether the
concurrent lookup + mutation is guaranteed to be safe.
--
- Alex
On 05/15/2012 07:01 PM, Stephen Jones wrote:
> Using Object gives exactly the same problem as the Object super class
> does not have vcount variable.
But Object is better than void* because the latter has no safety and
completely unusable. All you can do with a void* is to cast it back to
its
On Monday, 14 May 2012 at 20:27:37 UTC, Ali Çehreli wrote:
On 05/14/2012 11:49 AM, Stephen Jones wrote:
> My
> understanding is that c# getter setters were simply syntactic
sugar
> which under the hood called standard functions incurring the
standard
> function overhead. Is this the same with D,
On Wednesday, 16 May 2012 at 02:01:25 UTC, Stephen Jones wrote:
Using Object gives exactly the same problem as the Object super
class does not have vcount variable. Casting is not a solution
because the reason for throwing different sorts of widgets into
a single array was so I did not have to
On Monday, 14 May 2012 at 19:04:46 UTC, H. S. Teoh wrote:
On Mon, May 14, 2012 at 08:40:30PM +0200, Stephen Jones wrote:
I want an array of different classes of objects. I tried to
subsume the differences by extending the classes under a single
interface/abstract class/super class (3 different a
On Tuesday, 15 May 2012 at 05:35:35 UTC, Michael Parker wrote:
On 5/15/2012 4:23 AM, WhatMeWorry wrote:
Linking happens when you build an executable. If you are
building just the libraries, there is no linking done at all.
To compile DerelictGL, you do not need to link anything.
It appear
On Tuesday, 15 May 2012 at 20:50:27 UTC, ixid wrote:
So if that will not work how would I efficiently copy an array
of
BitArray? Looping through each bit is very slow. An array of
bool
arrays is fine but I want to try to reduce the memory needed for
memoization of an algorithm.
That wouldn't
So if that will not work how would I efficiently copy an array of
BitArray? Looping through each bit is very slow. An array of bool
arrays is fine but I want to try to reduce the memory needed for
memoization of an algorithm.
On Tuesday, 15 May 2012 at 20:26:12 UTC, ixid wrote:
Sorry I made a typo in the second, it should be test2[0][0].
I'm using std.bitmanip in D2.
Aha, I see! I'm somewhat surprised, normally I just use
Array!bool.
Well, you can look in the source to see some of how it works:
https://github.com/D
On Tuesday, 15 May 2012 at 20:44:16 UTC, Chris Cain wrote:
test2[0] = 1;
and of course I mean test2[0][0] ... copy-pasta mistake :-)
On Tuesday, 15 May 2012 at 20:16:28 UTC, Chris Cain wrote:
On Tuesday, 15 May 2012 at 19:23:31 UTC, ixid wrote:
Not sure if this is a bug or just rather counter-intuitive:
BitArray test;
test.length = 7;
BitArray test2 = test.dup;
test2[0] = 1;
This is fine, test is not modified.
BitArray tes
On Tuesday, 15 May 2012 at 19:23:31 UTC, ixid wrote:
Not sure if this is a bug or just rather counter-intuitive:
BitArray test;
test.length = 7;
BitArray test2 = test.dup;
test2[0] = 1;
This is fine, test is not modified.
BitArray test[7];
foreach(ref i;test)
i.length = 7;
BitArray[7] test
On Monday, 14 May 2012 at 09:53:55 UTC, Kagamin wrote:
Try to make C dll, which loads D dll, and inject the C dll :)
I made a bootstrapper (a c DLL which loads the D Dll) and it
works fine (the D entrypoint get called (a made a msgbox test)
but then the Process freezes after it displayed the
On 2012-05-15 21:50, Ali Çehreli wrote:
Not possible in D. D's const is transitive. If b is const, then what it
points to is also const.
Ali
Then it would be best to not declare that as const?
--
/Jacob Carlborg
On Tuesday, 15 May 2012 at 18:54:51 UTC, dcoder wrote:
Okay thanks alot Matt and Ali, that helps alot, but I still
don't
get the dot in ".map" from the line above. Doesn't the dot mean
that .map is a member or a member function of the return value
of
byLine()? Which, in this case is struct B
On 05/15/2012 12:36 PM, Jacob Carlborg wrote:
I'm trying to figuring out how to translate const in C to D. I have
these examples:
const int * a;
int * const b;
const int * const c;
const int * const * d;
Which I think should be translated like this:
const(int)* a;
const int* c;
const(int*)* d;
On 05/15/2012 11:54 AM, dcoder wrote:
> On Tuesday, 15 May 2012 at 16:03:16 UTC, Matt Soucy wrote:
>>> I'm trying to learn D, by playing with code and reading this forum. I'm
>>> a slow learner. :)
>>>
>>> Anyways, I looked at std.stdio code and noticed that byLine resturns a
>>> struct ByLine, bu
I'm trying to figuring out how to translate const in C to D. I have
these examples:
const int * a;
int * const b;
const int * const c;
const int * const * d;
Which I think should be translated like this:
const(int)* a;
const int* c;
const(int*)* d;
But I don't know how to translate "b". I thi
Not sure if this is a bug or just rather counter-intuitive:
BitArray test;
test.length = 7;
BitArray test2 = test.dup;
test2[0] = 1;
This is fine, test is not modified.
BitArray test[7];
foreach(ref i;test)
i.length = 7;
BitArray[7] test2 = test.dup;
test2[0] = 1;
test has been modified. W
On Tuesday, 15 May 2012 at 16:03:16 UTC, Matt Soucy wrote:
I'm trying to learn D, by playing with code and reading this
forum. I'm
a slow learner. :)
Anyways, I looked at std.stdio code and noticed that byLine
resturns a
struct ByLine, but where does the .map come from? Thanks!
It comes fr
On Tuesday, May 15, 2012 11:14:51 Ali Çehreli wrote:
> On 05/15/2012 10:29 AM, Christian Köstlin wrote:
> > for [1, 2, 3] and iota(2, 10)?
> >
> > thanks in advance
> >
> > christian
>
> When it comes to compile-time polymorphism or duck typing, they are both
> RandomAccessRanges. (Pedantically,
On 15/05/12 20:19, Jonathan M Davis wrote:
If you want to be doing manuabl memory management, then you use malloc and
free. new _always_ uses the GC. delete is going to be _removed from the
language_, so it's not an option.
OK. It's just that this is a distinct break with C++ syntax, so might
On 5/15/12, Jonathan M Davis wrote:
> If you're going to use anything, use clear.
He might as well just use this if he wants the GC to take care of things:
arr = null;
clear(arr) is a little bit of a misnomer. If you have another slice
pointing to the same array clear() won't really release memo
On 05/15/2012 09:03 AM, Matt Soucy wrote:
>>> I believe byLine reuses the internal buffer. Try duping the lines:
>>> auto i = f.byLine().map!"a.idup"().array();
>> Can someone please explain to me the last line?
>>
>> I'm trying to learn D, by playing with code and reading this forum. I'm
>> a sl
On 05/15/2012 10:29 AM, Christian Köstlin wrote:
for [1, 2, 3] and iota(2, 10)?
thanks in advance
christian
When it comes to compile-time polymorphism or duck typing, they are both
RandomAccessRanges. (Pedantically, [1, 2, 3] is not a range (I think
:P), but a container. Although, any slice
On Tuesday, May 15, 2012 15:27:51 Namespace wrote:
> And what if i use an array of structs? Also clear instead of
> delete?
delete is going to be _removed from the language_, so just don't use it. If
you're going to use anything, use clear. Using clear on the array will set it
to null and do wha
On Tuesday, May 15, 2012 15:05:30 Joseph Rushton Wakeling wrote:
> On 15/05/12 11:43, Jonathan M Davis wrote:
> > No. _Never_ use delete. It's going to be deprecated.
>
> What if you turn the GC off?
If you want to be doing manuabl memory management, then you use malloc and
free. new _always_ us
On Tue, May 15, 2012 at 07:29:38PM +0200, Christian Köstlin wrote:
> for [1, 2, 3] and iota(2, 10)?
[...]
What are you trying to accomplish?
T
--
We've all heard that a million monkeys banging on a million typewriters
will eventually reproduce the entire works of Shakespeare. Now, thanks
to t
for [1, 2, 3] and iota(2, 10)?
thanks in advance
christian
On Tue, May 15, 2012 at 07:47:24PM +0400, Dmitry Olshansky wrote:
> On 15.05.2012 19:32, H. S. Teoh wrote:
> >On Tue, May 15, 2012 at 05:14:15PM +0200, ref2401 wrote:
> >>general question:
> >>-std.file,
> >
> >std.file is badly named. It really deals with the _filesystem_, that is,
> >pathnames, e
On 05/15/2012 10:42 AM, dcoder wrote:
On Monday, 14 May 2012 at 09:00:14 UTC, simendsjo wrote:
On Mon, 14 May 2012 10:41:54 +0200, Christian Köstlin
wrote:
Hi,
i wanted to output an ascii-file line by line, but reversed.
the idea was to open the file, use byLine to read it line-by-line,
make
On 15.05.2012 19:32, H. S. Teoh wrote:
On Tue, May 15, 2012 at 05:14:15PM +0200, ref2401 wrote:
general question:
-std.file,
std.file is badly named. It really deals with the _filesystem_, that is,
pathnames, etc.. It doesn't deal with individual files.
Bleh, std.file.read does just that -
On Tue, May 15, 2012 at 05:14:15PM +0200, ref2401 wrote:
> general question:
> -std.file,
std.file is badly named. It really deals with the _filesystem_, that is,
pathnames, etc.. It doesn't deal with individual files.
> -std.stdio.File,
Use this.
> -std.stream.File
This will soon be depreca
general question:
-std.file,
-std.stdio.File,
-std.stream.File
which of the existing approaches i have to choose when working
with files? what shall i look at?
for example, i have a binary file. i want to read the first byte,
process it and then read the following N bytes (N calculation
base
On Tue, May 15, 2012 at 04:42:39PM +0200, dcoder wrote:
> On Monday, 14 May 2012 at 09:00:14 UTC, simendsjo wrote:
[...]
> >I believe byLine reuses the internal buffer. Try duping the lines:
>
>
>
> > auto i = f.byLine().map!"a.idup"().array();
>
>
> Can someone please explain to me the last
On Monday, 14 May 2012 at 09:00:14 UTC, simendsjo wrote:
On Mon, 14 May 2012 10:41:54 +0200, Christian Köstlin
wrote:
Hi,
i wanted to output an ascii-file line by line, but reversed.
the idea was to open the file, use byLine to read it
line-by-line, make this range an array, and retro this
And what if i use an array of structs? Also clear instead of
delete?
On 15.05.2012 17:12, Ondrej Pokorny wrote:
On Tuesday, 15 May 2012 at 12:36:30 UTC, Dmitry Olshansky wrote:
On 15.05.2012 16:27, Ondrej Pokorny wrote:
On Tuesday, 15 May 2012 at 09:44:08 UTC, Jonathan M Davis wrote:
On Tuesday, May 15, 2012 11:26:49 Namespace wrote:
On Tuesday, 15 May 2012 at
On Tuesday, 15 May 2012 at 12:36:30 UTC, Dmitry Olshansky wrote:
On 15.05.2012 16:27, Ondrej Pokorny wrote:
On Tuesday, 15 May 2012 at 09:44:08 UTC, Jonathan M Davis
wrote:
On Tuesday, May 15, 2012 11:26:49 Namespace wrote:
On Tuesday, 15 May 2012 at 09:23:51 UTC, Kagamin wrote:
> Difference w
On 5/14/12 6:08 PM, Stephen Jones wrote:
I am used to languages where the w under consideration in any
iteration would be known to have been initialized as a Button or
Cursor, etc, and the value of vertStart would be found without
error.
What are the names of those languages?
On 15/05/12 11:43, Jonathan M Davis wrote:
No. _Never_ use delete. It's going to be deprecated.
What if you turn the GC off?
On 15.05.2012 16:27, Ondrej Pokorny wrote:
On Tuesday, 15 May 2012 at 09:44:08 UTC, Jonathan M Davis wrote:
On Tuesday, May 15, 2012 11:26:49 Namespace wrote:
On Tuesday, 15 May 2012 at 09:23:51 UTC, Kagamin wrote:
> Difference with what?
> new is a safe feature: it allocates in the GC heap
Th
On Tuesday, 15 May 2012 at 09:44:08 UTC, Jonathan M Davis wrote:
On Tuesday, May 15, 2012 11:26:49 Namespace wrote:
On Tuesday, 15 May 2012 at 09:23:51 UTC, Kagamin wrote:
> Difference with what?
> new is a safe feature: it allocates in the GC heap
That's what i mean. So i have to delete it you
On Tuesday, 15 May 2012 at 09:44:08 UTC, Jonathan M Davis wrote:
On Tuesday, May 15, 2012 11:26:49 Namespace wrote:
On Tuesday, 15 May 2012 at 09:23:51 UTC, Kagamin wrote:
> Difference with what?
> new is a safe feature: it allocates in the GC heap
That's what i mean. So i have to delete it you
On Tuesday, May 15, 2012 11:26:49 Namespace wrote:
> On Tuesday, 15 May 2012 at 09:23:51 UTC, Kagamin wrote:
> > Difference with what?
> > new is a safe feature: it allocates in the GC heap
>
> That's what i mean. So i have to delete it yourself with "delete
> arr;", or not?
No. _Never_ use delet
On 05/14/12 17:10, Roman D. Boiko wrote:
> (Subj.) I'm in doubt which to choose for my case, but this is a generic
> question.
>
> http://forum.dlang.org/post/odcrgqxoldrktdtar...@forum.dlang.org
>
> Cross-posting here. I would appreciate any feedback. (Whether to reply in
> this or that thread
On Tuesday, 15 May 2012 at 09:23:51 UTC, Kagamin wrote:
Difference with what?
new is a safe feature: it allocates in the GC heap
That's what i mean. So i have to delete it yourself with "delete
arr;", or not?
Difference with what?
new is a safe feature: it allocates in the GC heap
Is there any other difference if I allocate an array with "new",
except that it is initialized?
And must i delete it by myself, or take the GC care about that?
The documentary leaves me hanging there, unfortunately, and gives
me no 100% answer.
Once before, thanks for the reply.
On Tuesday, 15 May 2012 at 06:17:31 UTC, Era Scarecrow wrote:
If you don't mind doing some lite informational reading, read
up on 'lex and yacc'. ISBN: 1-56592-000-7; Hope I got that
right. I'm not telling you to use C (or the other tools mind
you), but it does go into handling tokens of multi
62 matches
Mail list logo