On Saturday, 19 July 2014 at 12:02:50 UTC, Sean Campbell wrote:
is there any way for an object to make it self no longer
usable? eg
class someclass {
string somevalue;
bool someflag;
int somelength;
this (value,length,flag) {
somevalue = value;
Is there a way to take an interface and implement it generically?
e.g., All functions are implemented either as throw and/or return
defaults and properties are implemented as getter/setters.
This is for mocking up so I a simple way to create a class based
off only the interface.
Essentially
On Monday, 7 July 2014 at 17:50:35 UTC, Frustrated wrote:
when I build dustmite using dmd or gdc with no options or -O3,
it is 18M but in the dmd directory, dustmite is only 650k. I
assume I'm statically linking the whole library while in the
small one is using some dynamic link library?
when I build dustmite using dmd or gdc with no options or -O3, it
is 18M but in the dmd directory, dustmite is only 650k. I assume
I'm statically linking the whole library while in the small one
is using some dynamic link library? Or is all that debug
information or what?
On Monday, 7 July 2014 at 09:56:17 UTC, Marc Schütz wrote:
On Monday, 7 July 2014 at 02:57:09 UTC, Frustrated wrote:
So, I took all the code surrounding the error message(which
was a lot of code) and stuck it into one .d file.
No errors! Works as expected.
So, WTF?!?!
I guess now I have to
So, I took all the code surrounding the error message(which was a
lot of code) and stuck it into one .d file.
No errors! Works as expected.
So, WTF?!?!
I guess now I have to attempt to split the code across modules to
see WTF is going on? Maybe this is a modules issue. I know some
of the cod
On Friday, 4 July 2014 at 21:15:02 UTC, Frustrated wrote:
On Friday, 4 July 2014 at 20:25:28 UTC, Frustrated wrote:
On Friday, 4 July 2014 at 16:31:28 UTC, Stanislav Blinov wrote:
On Friday, 4 July 2014 at 16:28:48 UTC, Frustrated wrote:
On Friday, 4 July 2014 at 15:42:36 UTC, bearophile
On Friday, 4 July 2014 at 20:25:28 UTC, Frustrated wrote:
On Friday, 4 July 2014 at 16:31:28 UTC, Stanislav Blinov wrote:
On Friday, 4 July 2014 at 16:28:48 UTC, Frustrated wrote:
On Friday, 4 July 2014 at 15:42:36 UTC, bearophile wrote:
Frustrated:
I'm not using 2.066 though...
I
On Friday, 4 July 2014 at 16:31:28 UTC, Stanislav Blinov wrote:
On Friday, 4 July 2014 at 16:28:48 UTC, Frustrated wrote:
On Friday, 4 July 2014 at 15:42:36 UTC, bearophile wrote:
Frustrated:
I'm not using 2.066 though...
I will revert back to the dmd version I was using when it
w
On Friday, 4 July 2014 at 15:42:36 UTC, bearophile wrote:
Frustrated:
Since there is no recursion going on there, it shouldn't be a
problem.
Yes, sorry.
In dmd 2.066 this too could work:
alias Array(T) = std.container.Array!T;
Bye,
bearophile
That just gives more errors.
I'm
On Friday, 4 July 2014 at 15:37:52 UTC, Marc Schütz wrote:
On Friday, 4 July 2014 at 15:07:00 UTC, Frustrated wrote:
After upgrading to latest dmd, I get the follow error on the
code
template Array(T) { alias Array = std.container.Array!T; }
Error: Array!(iDataBlock).Array recursive alias
On Friday, 4 July 2014 at 15:10:14 UTC, bearophile wrote:
Frustrated:
After upgrading to latest dmd, I get the follow error on the
code
template Array(T) { alias Array = std.container.Array!T; }
Try to use a different name inside the template, like "Vector".
Bye,
bearophile
After upgrading to latest dmd, I get the follow error on the code
template Array(T) { alias Array = std.container.Array!T; }
Error: Array!(iDataBlock).Array recursive alias declaration
I don't see anything recursive about it... and the code worked
before. Any ideas?
On Sunday, 20 April 2014 at 16:56:59 UTC, Ali Çehreli wrote:
My understanding is not perfect. There may be compiler and CPU
optimizations that I am not aware of.
On 04/20/2014 08:03 AM, Frustrated wrote:
> is the only argument really about performance when creating
> structs vs cr
I know the difference between a struct and a class but I remember
seeing somewhere that structs are much faster than classes in D
for some strange reason.
I'm not worried too much about class allocation performance
because I will try and use classes when they will not be created
frequently an
On Tuesday, 8 April 2014 at 08:31:16 UTC, Vlad Levenfeld wrote:
Ok, starting to feel a bit sheepish at this point, that
constructor was unnecessarily verbose:
this (T) (T layer)
{
import std.string: toLower;
mixin ("this."~toLower (T.stringof)~"= layer;");
this.type = ca
On Friday, 4 April 2014 at 13:23:48 UTC, Bienlein wrote:
Hello,
I took some code snippet from some sample D code and modified
it a bit:
template TCopy(T, V) {
private int i = 2;
void copy(out T to, out V to2, T from) {
to = from;
to2 = from;
writeln("i: ", i);
}
}
On Tuesday, 1 April 2014 at 19:52:47 UTC, Steven Schveighoffer
wrote:
On Tue, 01 Apr 2014 15:00:17 -0400, Frustrated
wrote:
On Tuesday, 1 April 2014 at 12:20:06 UTC, Steven Schveighoffer
wrote:
On Tue, 01 Apr 2014 03:31:41 -0400, Frustrated
wrote:
Basically in programming to interfaces I
On Tuesday, 1 April 2014 at 12:20:06 UTC, Steven Schveighoffer
wrote:
On Tue, 01 Apr 2014 03:31:41 -0400, Frustrated
wrote:
Basically in programming to interfaces I need to decide to
call a virtual method of an object if it exists else call a
final method in the interface:
interface A
Basically in programming to interfaces I need to decide to call a
virtual method of an object if it exists else call a final method
in the interface:
interface A
{
static final void foo() { ... }
}
class B : A
{
void bar() { ... } // optional
}
class C : B
{
void bar() { ... }
On Sunday, 30 March 2014 at 12:42:16 UTC, Jack Applegame wrote:
Target is to create a template for mapping member "array
accessor" to member function.
For example:
class Foo {
...
int elementsAccessor(size_t index) { ... }
...
mixin MagicTemplateMixin!("elements", elementsAccessor);
On Tuesday, 25 March 2014 at 18:10:17 UTC, Meta wrote:
On Tuesday, 25 March 2014 at 18:05:47 UTC, Frustrated wrote:
Due to a previous issue I am trying to do the following
mixin template A()
{
mixin((function () => "int x;")() );
}
the problem is that the compiler will not l
On Tuesday, 25 March 2014 at 20:20:29 UTC, Frustrated wrote:
On Tuesday, 25 March 2014 at 18:10:17 UTC, Meta wrote:
On Tuesday, 25 March 2014 at 18:05:47 UTC, Frustrated wrote:
Due to a previous issue I am trying to do the following
mixin template A()
{
mixin((function () => &qu
Due to a previous issue I am trying to do the following
mixin template A()
{
mixin((function () => "int x;")() );
}
the problem is that the compiler will not let me use the delegate
because it has no this context. Of course the whole point here is
that the delegate will never be used at ru
On Sunday, 16 March 2014 at 18:41:51 UTC, Adam D. Ruppe wrote:
On page 249 of TDPL (Andrei's book), in a section on structs
and postblits, it says "D objects must be relocatable" and
other similar statements while banning internal pointers.
I knew this applies to structs and the context makes
On Thursday, 6 March 2014 at 17:27:35 UTC, Steve Teale wrote:
Pretty much what the subject says. Why can't template mixins
include statements ans so on?
Is it just too hard, or is it just too much like C macros?
Steve
template mixins mix in directly into the code as if you typed
them. If th
On Wednesday, 5 March 2014 at 23:36:34 UTC, Adam D. Ruppe wrote:
On Wednesday, 5 March 2014 at 23:17:45 UTC, Frustrated wrote:
is it a purely compile time construct?
I think it is the same as auto return functions. Both auto and
enum in this context are storage classes. In the compiler, it
On Wednesday, 5 March 2014 at 23:33:25 UTC, Frustrated wrote:
Maybe the problem isn't what I thought it was. I created a test
case that works:
import std.stdio, std.cstream;
mixin template C()
{
alias A = typeof(this);
mixin(B!(A));
}
template B(T)
{
pragma(m
On Wednesday, 5 March 2014 at 23:20:08 UTC, bearophile wrote:
Frustrated:
how does an enum return type work?
enum foo(string s) { return s; }
As far as I know that's not valid D (but D is extremely
tolerating).
Bye,
bearophile
Well, it works... not sure exactly what it's doing though.
Maybe the problem isn't what I thought it was. I created a test
case that works:
import std.stdio, std.cstream;
mixin template C()
{
alias A = typeof(this);
mixin(B!(A));
}
template B(T)
{
pragma(msg, T);
enum B() { return "string foo() { return `<"~T.stringof~">`; }";
how does an enum return type work?
enum foo(string s) { return s; }
is it a purely compile time construct?
That is, we can guarantee that foo, as a function, won't exist at
runtime? e.g., it is a true ctfe instead of a function that can
be executed at compile time or runtime?
On Wednesday, 5 March 2014 at 23:04:06 UTC, Ali Çehreli wrote:
On 03/05/2014 02:37 PM, Frustrated wrote:
>> import std.typetuple;
>>
>> template fooImpl(T...)
>> {
>> static assert(is (T[0] == S));// <-- COOL!
>> static assert(is (T[1]
On Wednesday, 5 March 2014 at 22:35:46 UTC, Ali Çehreli wrote:
On 03/05/2014 01:30 PM, Frustrated wrote:
I am trying to remove the unnecessary passing of the type of
class to a
template but can't seem to get it to work:
see
The code is the
mixin(AbstractToInterface!(Windo
I am trying to remove the unnecessary passing of the type of
class to a template but can't seem to get it to work:
see
The code is the
mixin(AbstractToInterface!(WindowsGui, iButton, WindowsButton,
iBorder, WindowsBorder));
which I want to not have to specify WindowsGui.
I've t
On Monday, 3 March 2014 at 18:46:24 UTC, Chris wrote:
On Monday, 3 March 2014 at 18:03:12 UTC, Frustrated wrote:
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote:
There is nothing wrong about not using templates. Almost any
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote:
There is nothing wrong about not using templates. Almost any
compile-time design can be moved to run-time and expressed in
more common OOP form. And using tool you have mastery
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
All the D aficionados seem to wet their pants over
meta-programming, but I struggle to find a place to use it.
IIRC, I used it in a couple of places when I was trying to write
library stuff for MySQL, but in my current project, I us
http://dpaste.dzfl.pl/80c6225ed090
The code above demonstrates run-time contracts using interface
based programming.
It provides two co-benfits: Simplified class implementation(you
do not have to use interfaces for types which then requires
casting that type for orthogonal behavior) and run-
Fixed code with all combination examples:
(again, only WindowsButton works with WindowsGui and same for
LinuxGui... but the classes don't use iButton like they should!!!
Oh, they break the contract!! End of the world!)
http://dpaste.dzfl.pl/02ee45225303
Output:
Trying WindowsButton with Window
On Monday, 24 February 2014 at 18:59:32 UTC, Steven Schveighoffer
wrote:
On Mon, 24 Feb 2014 11:36:50 -0500, Frustrated
wrote:
http://dpaste.dzfl.pl/c25655e2dfe9
The code above simplifies using interfaces as the programming
object. It allows one to program the derived classes as if they
http://dpaste.dzfl.pl/c25655e2dfe9
The code above simplifies using interfaces as the programming
object. It allows one to program the derived classes as if they
were not part of an abstraction by mapping the abstracted virtual
methods to concrete methods.
e.g.,
class WindowsGui : iGui
{
On Sunday, 23 February 2014 at 23:14:24 UTC, Jesse Phillips wrote:
On Sunday, 23 February 2014 at 21:06:03 UTC, Frustrated wrote:
Why does your WindowsGui violate the iGui contract?
It doesn't. It simply that one can't specify dependencies in D
if (iGui is WindowsGui) then
On Sunday, 23 February 2014 at 20:41:30 UTC, Jesse Phillips wrote:
On Saturday, 22 February 2014 at 20:17:37 UTC, Frustrated wrote:
I do this:
@property WindowsButton button(WindowsButton b)
{
}
The compiler turns this into
@property WindowsButton button(iButton _b)
{
if (is(_b
The following code craps out on the inner for each
foreach (am; __traits(derivedMembers, B))
foreach (m; [__traits(getOverloads, B, am)])
{
}
So how can I loop over all the parameters of all the overloads of
On Sunday, 23 February 2014 at 01:37:08 UTC, Steven Schveighoffer
wrote:
On Sat, 22 Feb 2014 15:17:37 -0500, Frustrated
wrote:
It is legal exactly because I will always guarantee that the
proper button will be used.
Static typing says it's not legal. D does not do dynamic type
che
On Saturday, 22 February 2014 at 05:20:25 UTC, Eric Suen wrote:
Generic?
I don't see how this would help. I'd have to specify every
concrete type in the creation of the object which might be
significant. I can't use a generic virtual method so that doesn't
help either.
It would be nice to hav
On Saturday, 22 February 2014 at 01:03:22 UTC, Steven
Schveighoffer wrote:
On Fri, 21 Feb 2014 17:54:06 -0500, Frustrated
wrote:
interface iGui
{
@property iButton button(ref iButton button);
}
class WindowsGui : iGui
{
WindowsButton _button;
@property WindowsButton
On Friday, 21 February 2014 at 23:19:19 UTC, Ali Çehreli wrote:
On 02/21/2014 02:54 PM, Frustrated wrote:
interface iGui
{
@property iButton button(ref iButton button);
}
class WindowsGui : iGui
{
WindowsButton _button;
@property WindowsButton button(ref WindowsButton button
interface iGui
{
@property iButton button(ref iButton button);
}
class WindowsGui : iGui
{
WindowsButton _button;
@property WindowsButton button(ref WindowsButton button)
//@property iButton button(ref iButton button)
{
_button = button;
On Wednesday, 19 February 2014 at 21:50:43 UTC, Meta wrote:
On Wednesday, 19 February 2014 at 19:44:12 UTC, Meta wrote:
On Wednesday, 19 February 2014 at 19:10:44 UTC, Frustrated
wrote:
Are there container templates that one can mixin to classes
that
give them container behavior?
e.g
On Wednesday, 19 February 2014 at 19:44:12 UTC, Meta wrote:
On Wednesday, 19 February 2014 at 19:10:44 UTC, Frustrated
wrote:
Are there container templates that one can mixin to classes
that
give them container behavior?
e.g.,
instead of
class A
{
Array!int x;
}
I want
class A
Are there container templates that one can mixin to classes that
give them container behavior?
e.g.,
instead of
class A
{
Array!int x;
}
I want
class A
{
mixin Array!int;
}
so that I can do something like a.Add(3) instead of a.x.Add(3).
In fact, I do want the first case because I w
On Monday, 10 February 2014 at 10:41:06 UTC, Russel Winder wrote:
On Mon, 2014-02-10 at 09:16 +, Gary Willoughby wrote:
On Monday, 10 February 2014 at 03:14:31 UTC, Jonathan Dunlap
wrote:
> (disclaimer: I'm new around here)
> Is it possible to cycle backwards? If not, what's the best
> app
On Thursday, 13 February 2014 at 02:14:02 UTC, Jakob Ovrum wrote:
On Thursday, 13 February 2014 at 02:02:38 UTC, Anton wrote:
I'm confused about how to use random.uniform to select a
member of an enum.
Say I have an enum like
enum Animals
{
cat = 0,
dog = 1,
chimpanzee =
On Tuesday, 11 February 2014 at 00:00:06 UTC, Matthew Dudley
wrote:
Here's the gist of what I'm trying to do:
struct Foo
{
public:
int i;
int j;
static opCall(int i)(int j, int k)
{
return Foo(i+j,i+k);
}
}
void main()
{
auto bob
Are you always so aggressive? :)
Not always ;) Just when I feel like it
On Friday, 31 January 2014 at 06:26:16 UTC, Dan Killebrew wrote:
On Friday, 31 January 2014 at 06:24:27 UTC, Dan Killebrew wrote:
mixin template Foo(alias a){ alias Foo=a; }
pragma(msg, Foo!2); // error
template Bar(alias a){ alias Bar=a; }
pragma(msg, Bar!2); // ok
As far as I can tell, 'mix
On Friday, 31 January 2014 at 08:40:30 UTC, Jack Applegame wrote:
Why doesn't Rebindable allow associative arrays?
import std.typecons;
Rebindable!(immutable string[]) data1; // ok
Rebindable!(immutable string[string]) data2; // error
an associative array doesn't pass the isArray test
On Friday, 31 January 2014 at 10:31:52 UTC, Namespace wrote:
So, if your notation was implemented, it would no longer be
easy
to know. The compiler would have to be context sensitive, which
is more complex and not perfect. I doubt Walter would go for
that
so you'll never be able to use an expl
On Friday, 31 January 2014 at 00:29:20 UTC, Namespace wrote:
On Thursday, 30 January 2014 at 22:34:52 UTC, Frustrated wrote:
On Thursday, 30 January 2014 at 21:33:09 UTC, Namespace wrote:
I think for your example, the first case works fine using
deduction.
Sure but this is not always
On Thursday, 30 January 2014 at 21:42:39 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 16:23:55 -0500, Frustrated
wrote:
Again, you have to get off of what has been defined. You have
the
mentality exactly the same as those that thought the earth was
flat, imaginary numbers were
On Thursday, 30 January 2014 at 21:33:09 UTC, Namespace wrote:
I think for your example, the first case works fine using
deduction.
Sure but this is not always possible. ;)
It seems that the problem occurs also with opIndex and so
probably with all op* methods. See:
http://forum.dlang.org/th
Simple question.
What are the difference between an interface and a class?
I'm not talking about what the compiler does with them. I'm
talking about what they were created to do, how they came about
etc.
If you have to explain to someone what a class is and what an
interface is, then you diff t
On Thursday, 30 January 2014 at 21:16:05 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 15:57:06 -0500, Frustrated
wrote:
On Thursday, 30 January 2014 at 20:17:23 UTC, Steven
Schveighoffer wrote:
But it's important to note that A does not define an instance
of A_vtbl, just the l
On Thursday, 30 January 2014 at 20:17:23 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 14:58:42 -0500, Frustrated
wrote:
On Thursday, 30 January 2014 at 17:11:24 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated
wrote:
Essentially what it boils down
import std.stdio;
struct B
{
template opCall(T)
{
void opCall(T x)
{
writeln(x);
}
}
}
template a(T)
{
}
void main() {
B a;
a(3); // works because template parameter can be
On Thursday, 30 January 2014 at 17:11:24 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated
wrote:
Essentially what it boils down to is treating interfaces like
classes that have no fields). To avoid the diamond problem
simply
always choose the method that is
On Thursday, 30 January 2014 at 18:02:05 UTC, Namespace wrote:
On Thursday, 30 January 2014 at 17:46:19 UTC, Frustrated wrote:
Also,
http://dlang.org/operatoroverloading.html#Dispatch
and possible solution to your problem:
http://www.digitalmars.com/d/archives/digitalmars/D
On Thursday, 30 January 2014 at 17:38:26 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 12:30:04 -0500, Frustrated
wrote:
On Thursday, 30 January 2014 at 17:11:24 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated
wrote:
Essentially what it boils down
BTW,
a() is replaced with a.opCall()
and you can use opDispatch on it.
an opCall is a member.
Either approach should work if you can get that archive example
to compile.
Also,
http://dlang.org/operatoroverloading.html#Dispatch
and possible solution to your problem:
http://www.digitalmars.com/d/archives/digitalmars/D/opDispatch_and_template_parameters_117095.html
Couldn't get code to compile though... but if it did, it should
solve your problem.
On Thursday, 30 January 2014 at 16:53:33 UTC, Namespace wrote:
On Thursday, 30 January 2014 at 16:47:46 UTC, Frustrated wrote:
On Thursday, 30 January 2014 at 16:28:42 UTC, Namespace wrote:
On Thursday, 30 January 2014 at 16:24:00 UTC, Stanislav
Blinov wrote:
void main() {
F f
On Thursday, 30 January 2014 at 17:11:24 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated
wrote:
Essentially what it boils down to is treating interfaces like
classes that have no fields). To avoid the diamond problem
simply
always choose the method that is
On Thursday, 30 January 2014 at 15:28:24 UTC, Steven
Schveighoffer wrote:
On Thu, 30 Jan 2014 09:31:05 -0500, Frustrated
wrote:
I'm not asking about a work around but if what I am talking
about
can actually be done(does the vtable support this or can made
to
support it?)
Yes. Inter
On Thursday, 30 January 2014 at 16:28:42 UTC, Namespace wrote:
On Thursday, 30 January 2014 at 16:24:00 UTC, Stanislav Blinov
wrote:
void main() {
F f;
int i = f(3,4,5);
float f_ = f!float(6, 7, 8);
}
Does not work, it fails with:
Error: template instance f!float f
On Thursday, 30 January 2014 at 15:18:12 UTC, John Chapman wrote:
On Thursday, 30 January 2014 at 14:31:05 UTC, Frustrated wrote:
I'm not asking about a work around but if what I am talking
about
can actually be done(does the vtable support this or can made
to
support it?)
It would wo
On Thursday, 30 January 2014 at 11:29:55 UTC, TheFlyingFiddle
wrote:
On Thursday, 30 January 2014 at 11:19:58 UTC, Frustrated wrote:
I was, I think, able to call an interface's method. I had the
code like the following
interface A
{
void foo();
}
class B : A { void foo() { writeln
I was, I think, able to call an interface's method. I had the
code like the following
interface A
{
void foo();
}
class B : A { void foo() { writeln("Hey"); } }
class C : A { void foo() { writeln("You"); } }
yet, when I called a.foo(); I did not get any output. (A being of
type A)
Now,
Suppose I have
class A
{
mixin t!A;
}
is there a way to replace the mixin template's dependence on the
class name?
e.g.,
class A
{
mixin t!This; // This turns in to A
}
(so, for example, renaming the above class only has to rename one
place instead of two)
(Guess is didn't get sent, I guess I'm just a big spam bot cause
I keep getting flagged every post)
The following code demonstrates a way to have an easy factory in
D requiring very little work. I imagine it can be improved to
handle the abstract case(basically dependencies/constraints).
Any ide
Here is something I just did that essentially demonstrates what I
am talking about(bugs withstanding):
http://dpaste.dzfl.pl/d82b6274
It is not exactly how I should be going about it as it is
somewhat generic but not properly designed to allow the concrete
implementations needed
void main()
{
On Sunday, 26 January 2014 at 05:19:51 UTC, Ali Çehreli wrote:
Where is the tldr; section? :)
On 01/25/2014 04:08 AM, Frustrated wrote:
> I'd like to support extensions of my own interfaced based
design
> where anyone could simply "drop" in there own inherited
classes
&
I'd like to support extensions of my own interfaced based design
where anyone could simply "drop" in there own inherited classes
and everything would work as if they designed everything using
those classes from the get go.
To do this though, I need a way to know how to generate these
unknown type
Yes, I that is what I tried initially but the error was due to
that static if.
Not sure why
but
static if (is(T : A))
{
...
}
static assert(0, "error");
doesn't work as the assert is called no matter what.
I am trying to compare a type with another type at compile time.
My code is
class Q(T)
{
static auto foo()
{
static if (T is A)
{
...
}
static assert(0, "error");
}
}
and get the error "
On Thursday, 23 January 2014 at 14:49:11 UTC, Dicebot wrote:
On Thursday, 23 January 2014 at 14:44:01 UTC, Frustrated wrote:
Functions generally are not thread safe because of reentry,
right?
No. They are not thread safe because they use shared data
(explicitly/implicitly). Functions that
So, TLS solves the data issue with threading. I just thought,
with out much thinking, what about having thread local functions?
Doesn't make sense? Let me explain.
Functions generally are not thread safe because of reentry,
right? The same data is used by the function for each thread
calling it a
On Friday, 3 January 2014 at 13:39:41 UTC, Andrea Fontana wrote:
On Friday, 3 January 2014 at 01:01:21 UTC, Frustrated wrote:
On Thursday, 2 January 2014 at 20:38:10 UTC, Jeroen Bollen
wrote:
[...]
e.g.,
seed(k);
for(i = 1..10)
print(rnd(i));
and
for(i = 1..10)
{
seed(time);
print(rnd(i
On Wednesday, 15 January 2014 at 21:00:57 UTC, Jeroen Bollen
wrote:
How do you correctly create a MersenneTwisterEngine with a
ulong as seed?
If you are trying to create a very large 2D noise generator, this
is how you do it, and you can any degree of smoothness you want:
Create a 2D RNG.
e
Lets suppose I have setup some code to use a singleton object.
Now lets suppose I want to duplicate that code(say to run
multiple times simultaneously).
The singleton pattern itself prevents multiple copies. One would
need multiple instances to be able to run multiple times BUT in
the context
I think maybe using alias this would not solve the problem? One
would have to dispatch all the calls on the class to the array.
(simply wrap the struct but prevent the compiler from thinking it
is a strut so it doesn't use value semantics on it)
On Thursday, 9 January 2014 at 14:51:33 UTC, monarch_dodra wrote:
On Thursday, 9 January 2014 at 13:32:08 UTC, Dicebot wrote:
On Thursday, 9 January 2014 at 12:19:25 UTC, Frustrated wrote:
I guess I see what is going on. Since Array is a struct, a
local copy is made and that never ends up
On Thursday, 9 January 2014 at 12:15:31 UTC, Frustrated wrote:
On Thursday, 9 January 2014 at 12:13:14 UTC, Frustrated wrote:
I've tried insert, indexing, ~=, etc but the length always
returns 0.
e.g.,
std.container.Array!int arr;
arr ~= 3;
writeln(arr.length);
works fine, but whe
On Thursday, 9 January 2014 at 12:13:14 UTC, Frustrated wrote:
I've tried insert, indexing, ~=, etc but the length always
returns 0.
e.g.,
std.container.Array!int arr;
arr ~= 3;
writeln(arr.length);
works fine, but when the array is a property of a class, it
does not work, e.g.,
cl
I've tried insert, indexing, ~=, etc but the length always
returns 0.
e.g.,
std.container.Array!int arr;
arr ~= 3;
writeln(arr.length);
works fine, but when the array is a property of a class, it does
not work, e.g.,
class x
{
std.container.Array!int _arr;
@property std.container.Array!int
On Thursday, 2 January 2014 at 20:38:10 UTC, Jeroen Bollen wrote:
D provides a set of Random Number Generators in std.random. I
am writing an application which would create a 2D map of noise.
To do this though, I'll have to calculate the same random
numbers over and over again. (I cannot store
On Wednesday, 1 January 2014 at 15:10:56 UTC, Dicebot wrote:
On 2014-01-01 08:43, Frustrated wrote:
Also, how does one get the exact code string of a member
instead of
having to piece it together from info from std.traits? (which
requires a
lot of work)?
Have a look at
https://github.com
On Wednesday, 1 January 2014 at 14:30:46 UTC, Gary Willoughby
wrote:
On Wednesday, 1 January 2014 at 12:09:40 UTC, Jacob Carlborg
wrote:
On 2014-01-01 01:52, Frustrated wrote:
Is there an easy way to implement properties of an interface
within a
class instead of having to duplicate almost the
By modifying the code I was able to achieve exactly what I
wanted(I have very complex interfaces but the classes using them
consist of just one line.
The code basically fixes your code to handle the setter and
getters better and to work with functions. It is not very robust
so I won't post it
On Wednesday, 1 January 2014 at 01:55:19 UTC, Adam D. Ruppe wrote:
On Wednesday, 1 January 2014 at 01:33:04 UTC, Frustrated wrote:
But your template mixin is still duplicating generic code that
should be easily handled automatically. (Generic properties
are just wrappers around private fields
1 - 100 of 130 matches
Mail list logo