On Sunday, 3 May 2015 at 05:20:34 UTC, Ali Çehreli wrote:
We know that 'in' is "equivalent to const scope":
http://dlang.org/function.html#parameters
So, the constness of 'in' is transitive as well, right?
Ali
Of course, there's no concept of non-transitive const in D:
struct S
{
char
On Saturday, May 02, 2015 22:20:33 Ali Çehreli via Digitalmars-d-learn wrote:
> We know that 'in' is "equivalent to const scope":
>
>http://dlang.org/function.html#parameters
>
> So, the constness of 'in' is transitive as well, right?
Of course. in is identical to const scope. It doesn't intro
Feels pretty silly, but I can't compile this:
import std.random;
auto i = uniform(0, 10);
DMD spits this:
/usr/include/dmd/phobos/std/random.d(1188): Error: static
variable initialized cannot be read at compile time
/usr/include/dmd/phobos/std/random.d(1231):called from
here: rndGen
On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote:
Feels pretty silly, but I can't compile this:
import std.random;
auto i = uniform(0, 10);
DMD spits this:
/usr/include/dmd/phobos/std/random.d(1188): Error: static
variable initialized cannot be read at compile time
/usr/include/dmd/p
On Sunday, 3 May 2015 at 08:48:52 UTC, Dennis Ritchie wrote:
On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote:
Feels pretty silly, but I can't compile this:
import std.random;
auto i = uniform(0, 10);
DMD spits this:
/usr/include/dmd/phobos/std/random.d(1188): Error: static
variable
On Sunday, 3 May 2015 at 09:04:07 UTC, tired_eyes wrote:
On Sunday, 3 May 2015 at 08:48:52 UTC, Dennis Ritchie wrote:
On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote:
Feels pretty silly, but I can't compile this:
import std.random;
auto i = uniform(0, 10);
DMD spits this:
/usr/incl
Hmmm.
hap.random from http://code.dlang.org/packages/hap behaves
exactly the same.
On Sunday, 3 May 2015 at 09:28:40 UTC, Dennis Ritchie wrote:
On Sunday, 3 May 2015 at 09:04:07 UTC, tired_eyes wrote:
On Sunday, 3 May 2015 at 08:48:52 UTC, Dennis Ritchie wrote:
On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote:
Feels pretty silly, but I can't compile this:
import std
import std.random;
struct Mystruct {
int id;
static opCall() {
Mystruct s;
s.id = uniform(0, 10);
return s;
}
}
void main() {
auto s = Mystruct();
// whatever
}
---
This make sense, thant you for the e
On Sunday, 3 May 2015 at 02:31:51 UTC, WhatMeWorry wrote:
On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote:
[...]
[1] `Vertex triangle[6]` works, but please don't do that.
Thanks. I assume you would prefer I use triangle[] but with
OpenGL calls the dynamic arrays don't work. But may
Documentation says "This fiber must be in state TERM." but in the
core.thread I see In contract only on reset without parameters
(bug maybe?) and with HOLD condition too:
"assert( m_state == State.TERM || m_state == State.HOLD );"
Does that mean its ok to reset the fiber if I'm not using things
Just did another test and it seems its not safe at all. Reusing
the fibers with reset without properly exiting the function leads
to eventual stack overflow.
On Sunday, 3 May 2015 at 12:42:23 UTC, Dzugaru wrote:
Just did another test and it seems its not safe at all. Reusing
the fibers with reset without properly exiting the function
leads to eventual stack overflow.
It won't cleanup the old stack, so it may leak resources. It will
properly reset
On Saturday, 2 May 2015 at 20:37:44 UTC, tom wrote:
i use Stephan Schiffels code from
http://forum.dlang.org/thread/djhteyhpcnaskpabx...@forum.dlang.org?page=2
See polished version at:
https://github.com/nordlow/justd/blob/master/zio.d
On Sunday, 3 May 2015 at 12:33:36 UTC, Dzugaru wrote:
Documentation says "This fiber must be in state TERM." but in
the core.thread I see In contract only on reset without
parameters (bug maybe?) and with HOLD condition too:
"assert( m_state == State.TERM || m_state == State.HOLD );"
Does that
On Friday, 1 May 2015 at 23:22:31 UTC, Dennis Ritchie wrote:
Maybe someone will show a primitive packed array. I really can
not imagine how to do it on D.
Look at BitArray for an example
https://github.com/D-Programming-Language/phobos/blob/12187d7be8b15b2f5f8ff6889cdb5ea3afb93dd1/std/bitmanip
On Saturday, 2 May 2015 at 04:08:04 UTC, Ali Çehreli wrote:
Interesting idea. I have defined a simple algorithm below to
see how it could work (my skipped() function instead of uniq()).
That's a bit above my current D experience to decide.
What about just tweaking uniq() for now to propagate S
I really don't think that it's an issue in general, but if you
do want to
guarantee that nothing affects the capacity of your array, then
you're going
to need to either wrap all access to it
I agree with everything Jonathan said in both threads EXCEPT that
this is not an issue.
The syntax
On 05/03/2015 07:56 AM, "Per =?UTF-8?B?Tm9yZGzDtnci?=
" wrote:
On Saturday, 2 May 2015 at 04:08:04 UTC, Ali Çehreli wrote:
Interesting idea. I have defined a simple algorithm below to see how
it could work (my skipped() function instead of uniq()).
That's a bit above my current D experience to
On Sunday, 3 May 2015 at 10:56:44 UTC, anonymous wrote:
On Sunday, 3 May 2015 at 02:31:51 UTC, WhatMeWorry wrote:
On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote:
[...]
[1] `Vertex triangle[6]` works, but please don't do that.
Thanks. I assume you would prefer I use triangle[] but w
On Sunday, 3 May 2015 at 10:56:44 UTC, anonymous wrote:
On Sunday, 3 May 2015 at 02:31:51 UTC, WhatMeWorry wrote:
On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote:
[...]
[1] `Vertex triangle[6]` works, but please don't do that.
Thanks. I assume you would prefer I use triangle[] but w
On Sunday, 3 May 2015 at 15:21:17 UTC, Andrew Godfrey wrote:
I really don't think that it's an issue in general, but if you
do want to
guarantee that nothing affects the capacity of your array,
then you're going
to need to either wrap all access to it
I agree with everything Jonathan said i
Hi all,
i'm working in the generation of the code but i'm failing in
extracting a function return type when invoking the
ReturnType!(T) type trait and mixing it with __traits(getMember)
function.
Can anyone help me? or explaining what is happenning?
i've created a gist here:
https://gist.gith
On Sunday, 3 May 2015 at 14:49:55 UTC, Martin Nowak wrote:
On Friday, 1 May 2015 at 23:22:31 UTC, Dennis Ritchie wrote:
Maybe someone will show a primitive packed array. I really can
not imagine how to do it on D.
Look at BitArray for an example
https://github.com/D-Programming-Language/phobo
Hi,
How can I rewrite this code to the D?
-
#include
#include
class A {
public:
std::string a() {
return std::string("foo");
}
};
class B {
public:
std::string b(){
return std::string("bar");
}
};
class C : public A, public B {};
int main
On Sunday, 3 May 2015 at 17:22:00 UTC, filcuc wrote:
Hi all,
i'm working in the generation of the code but i'm failing in
extracting a function return type when invoking the
ReturnType!(T) type trait and mixing it with
__traits(getMember) function.
Can anyone help me? or explaining what is ha
On Sun, 03 May 2015 17:21:58 +, filcuc wrote:
> Hi all,
> i'm working in the generation of the code but i'm failing in extracting
> a function return type when invoking the ReturnType!(T) type trait and
> mixing it with __traits(getMember) function.
> Can anyone help me? or explaining what is
On Sunday, 3 May 2015 at 17:35:42 UTC, Dennis Ritchie wrote:
Hi,
How can I rewrite this code to the D?
-
#include
#include
class A {
public:
std::string a() {
return std::string("foo");
}
};
class B {
public:
std::string b(){
return std::string(
On Sunday, 3 May 2015 at 17:48:55 UTC, ketmar wrote:
On Sun, 03 May 2015 17:21:58 +, filcuc wrote:
Hi all,
i'm working in the generation of the code but i'm failing in
extracting
a function return type when invoking the ReturnType!(T) type
trait and
mixing it with __traits(getMember) fun
I'd make class A and class B into mixin templates instead.
mixin template A {
string a() { return "foo"; }
}
mixin template B {
string b() { return "bar"; }
}
class C {
mixin A;
mixin B;
}
If you still need class A and class B, just make a class that
mixes in the template for them
On Sunday, 3 May 2015 at 17:35:42 UTC, Dennis Ritchie wrote:
Hi,
How can I rewrite this code to the D?
-
#include
#include
class A {
public:
std::string a() {
return std::string("foo");
}
};
class B {
public:
std::string b(){
return std::string(
On Sunday, 3 May 2015 at 17:46:54 UTC, Meta wrote:
This is not really doable right now in D. You can forward the
function calls to a and b easily enough, but you can't inherit
from more than one class. Once the multiple alias this patch
gets merged you will be able to do this in D.
On Sunday,
Hi, I have now played a around couple of hours (reading everything I
could find) to get something to work, but I think I'm missing some
basic concepts/understanding. Maybe someone can enlighten me how these
things work. I thought that some code from David Nadlinger is what I'm
searching for but
On Sunday, 3 May 2015 at 21:46:11 UTC, Robert M. Münch wrote:
Hi, I have now played a around couple of hours (reading
everything I could find) to get something to work, but I think
I'm missing some basic concepts/understanding. Maybe someone
can enlighten me how these things work. I thought tha
On Sunday, 3 May 2015 at 21:46:11 UTC, Robert M. Münch wrote:
3. TupleType is a very missleading name when you are learning
these things, because the tuple can hold values as well. Or is
there a more extensive explanation for the name I don't get?
Legacy we are trying to get rid of. See also:
On Sunday, 3 May 2015 at 14:36:04 UTC, Martin Nowak wrote:
On Sunday, 3 May 2015 at 12:33:36 UTC, Dzugaru wrote:
Actually the documentation answers your question, please help
to improve it if you don't find it clear enough.
http://dlang.org/phobos/core_thread.html#.Fiber.reset
Created a pull
On Saturday, 2 May 2015 at 20:46:32 UTC, Dennis Ritchie wrote:
On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote:
I see it by the lack of "42". :)
But why is this "receive" breaks down?
Report, please, about it (D)evepopers :)
https://issues.dlang.org/
I'm not sure that it's not
On Sunday, May 03, 2015 15:21:15 Andrew Godfrey via Digitalmars-d-learn wrote:
>
> > I really don't think that it's an issue in general, but if you
> > do want to
> > guarantee that nothing affects the capacity of your array, then
> > you're going
> > to need to either wrap all access to it
>
> I a
It seems a private class or struct defaults to public members. Just
curious if this is intended. I would have expected private all the way
down unless overriden.
--- plugh.d
module plugh;
auto makeFoo() {return new Foo;}
private:
class Foo
{
void maybepriv() {}
private void priv() {}
On Monday, 4 May 2015 at 01:03:43 UTC, Fyodor Ustinov wrote:
I'm not sure that it's not my fault. So I hope that will come
by knowledgeable people and say "Hey, buddy, your mistake
is..." :)
OK. But if one does not come within three days :), duplicate
topic in this section:
http://forum.dlan
If I have a large struct that needs to be passed around, like a 4x4 matrix
for example, how do I do that efficiently in D?
In std.datetime, "in" is used for most struct parameters, but I'm confused
by the docs for function parameter storage classes[1].
In C++, I would pass a large struct as
I remember reading that guaranteed RVO was part of the D
standard, but I am completely unable to find anything on it in
the specification.
I'm also unable to find anything in it that explicitly states the
lifetime of returning a stack-local struct from a function.
However, it does state
Destruc
On Monday, 4 May 2015 at 01:58:12 UTC, bitwise wrote:
If I have a large struct that needs to be passed around, like a
4x4 matrix for example, how do I do that efficiently in D?
In std.datetime, "in" is used for most struct parameters, but
I'm confused by the docs for function parameter storage
This following code works fine. A triangle is displayed.
GLfloat[6] verts = [ 0.0, 1.0,
-1.0, -1.0,
1.0, -1.0 ];
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo); // Some of the
types are:
On Monday, 4 May 2015 at 02:47:24 UTC, WhatMeWorry wrote:
glBufferData(GL_ARRAY_BUFFER, verts.sizeof, &verts,
GL_STATIC_DRAW);
Try
(GL_ARRAY_BUFFER, verts.length, verts.ptr, GL_STATIC_DRAW)
or maybe:
(GL_ARRAY_BUFFER, verts.length * verts[0].sizeof, verts.ptr,
GL_STATIC_DRAW)
I'm
On Monday, 4 May 2015 at 02:47:24 UTC, WhatMeWorry wrote:
This following code works fine. A triangle is displayed.
GLfloat[6] verts = [ 0.0, 1.0,
-1.0, -1.0,
1.0, -1.0 ];
glGenBuffers(1, &vbo);
glBindBuffer(GL_
On Monday, 4 May 2015 at 01:58:12 UTC, bitwise wrote:
The documentation doesn't say anything about "in" being a
reference, but it doesn't say that "out" parameters are
references either, even though it's usage in the example
clearly shows that it is.
Thanks,
Bit
http://dlang.org/function.h
On 4/05/2015 9:46 a.m., Robert M. Münch wrote:
Hi, I have now played a around couple of hours (reading everything I
could find) to get something to work, but I think I'm missing some basic
concepts/understanding. Maybe someone can enlighten me how these things
work. I thought that some code from
On Sun, 03 May 2015 22:37:52 -0400, rsw0x wrote:
Use the ref storage class. You can use more than one storage class i.e,
foo(in ref int x)
Thanks, this should work.
On Sun, 03 May 2015 23:29:59 -0400, Baz wrote:
it's specified in http://dlang.org/abi.html (at the bottom):
"out and ref are
On Monday, 4 May 2015 at 03:57:04 UTC, bitwise wrote:
I'll probably go with "in ref". I think "escape proof" is
probably a good default. Not to mention, easier to type ;)
FYI I'm unsure how well `scope` storage class is currently
implemented because it's in a state of flux at the moment as far
On Sunday, May 03, 2015 21:58:12 bitwise via Digitalmars-d-learn wrote:
> If I have a large struct that needs to be passed around, like a 4x4 matrix
> for example, how do I do that efficiently in D?
>
> In std.datetime, "in" is used for most struct parameters, but I'm confused
> by the docs for fun
On Mon, 04 May 2015 02:29:19 +, rsw0x wrote:
> This says "Goodbye!" exactly once, indicating(?) that S was NRVO'd which
> means the scope of s went from foo to main. However, is this a guarantee
> by the standard? Is an implementation allowed to define foo such that it
> returns by copy and ca
On Sun, 03 May 2015 18:07:20 -0700, Dan Olson wrote:
> It seems a private class or struct defaults to public members. Just
> curious if this is intended. I would have expected private all the way
> down unless overriden.
i bet it is intended. protection of struct/class members is independed of
On Sun, 03 May 2015 18:02:37 +, filcuc wrote:
> Yep sorry,
> i'm still learning :)
i'm not blaming you at all. what i mean i that i'm bad at explanations,
so you'd better read one of the D books to better understand my cryptic
"don't do that, do this" comments. ;-)
signature.asc
Descriptio
On 05/03/2015 06:06 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
> On Sunday, May 03, 2015 15:21:15 Andrew Godfrey via
Digitalmars-d-learn wrote:
>>
>>> I really don't think that it's an issue in general, but if you
>>> do want to
>>> guarantee that nothing affects the capacity of your a
55 matches
Mail list logo