On Wednesday, 25 June 2014 at 17:21:21 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
The term "attribute" is a bit confusing, especially since
"property" is
also used in the language to refer to something completely
different. A
better term is perhaps "annotation". The @foo is an annotation
version(DigitalMars) version = DMDAsm;
version(LDC) version = DMDAsm;
version(DMDAsm) asm {
//dmd/ldc asm here
}
version(GDC) asm {
//gdc asm here
}
http://dlang.org/version.html#VersionSpecification
On Wednesday, 25 June 2014 at 18:49:27 UTC, Stefan Frijters wrote:
Let me preface this by admitting that I'm not sure I'm using
the DDoc functionality properly at all, so let me know if my
questions are bogus.
Is it possible to:
- Add private members to documentation?
- Have DDoc do its thing
On Monday, 23 June 2014 at 22:08:59 UTC, John Carter wrote:
On Monday, 23 June 2014 at 21:26:19 UTC, Chris Williams wrote:
More likely what you want are variants:
Hmm. Interesting.
Yes, Variant and VariantArray are much closer to the dynamic
language semantics...
But the interesting thing
On Wednesday, 25 June 2014 at 20:59:29 UTC, bearophile wrote:
Is it possible and a good idea to change the D ABI to make
code like this avoid an array copy in 100% of the cases
(without inlining)?
I meant, letting the compiler rewrite that code like this:
void foo(ref ubyte[1000] __data) not
On Wednesday, 25 June 2014 at 21:12:23 UTC, Binarydepth wrote:
On Wednesday, 25 June 2014 at 16:37:13 UTC, Namespace wrote:
On Wednesday, 25 June 2014 at 14:24:11 UTC, Binarydepth wrote:
I would like to show D in "action" to other
programmers/students.
Anyone knows of a Video Game coded in D2
On Wednesday, 25 June 2014 at 20:25:50 UTC, rcor wrote:
Dummy will not exist unless compiled with -unittest, correct?
Never mind, just verified that this is true.
Thanks again.
Tobias Pankrath:
Isn't this a case for Named Return Value Optimization?
Perhaps, but then why aren't dmd/ldc doing it? And the question
was if that's possible in the ABI, so it always happens (unless
the array is very small).
Bye,
bearophile
On Wednesday, 25 June 2014 at 20:55:47 UTC, bearophile wrote:
Is it possible and a good idea to change the D ABI to make code
like this avoid an array copy in 100% of the cases (without
inlining)?
ubyte[1000] foo() nothrow @safe {
typeof(return) data;
// some code here.
return dat
On Wednesday, 25 June 2014 at 16:37:13 UTC, Namespace wrote:
On Wednesday, 25 June 2014 at 14:24:11 UTC, Binarydepth wrote:
I would like to show D in "action" to other
programmers/students.
Anyone knows of a Video Game coded in D2 ?
Thank you
Here are two:
http://dgame-dev.de/?page=show
T
On Wednesday, 25 June 2014 at 15:35:25 UTC, Leandro Motta Barros
via Digitalmars-d-learn wrote:
Hi,
Some time ago I wrote this Tetris-like game:
https://bitbucket.org/lmb/anytris (also on GitHub:
https://github.com/lmbarros/Anytris)
Nothing fancy. I am sure there are better examples out there.
Is it possible and a good idea to change the D ABI to make code
like this avoid an array copy in 100% of the cases (without
inlining)?
I meant, letting the compiler rewrite that code like this:
void foo(ref ubyte[1000] __data) nothrow @safe {
__data[] = 0;
// some code here.
}
void ma
Is it possible and a good idea to change the D ABI to make code
like this avoid an array copy in 100% of the cases (without
inlining)?
ubyte[1000] foo() nothrow @safe {
typeof(return) data;
// some code here.
return data;
}
void main() nothrow {
immutable data = foo();
}
Bye,
On Wednesday, 25 June 2014 at 20:30:28 UTC, Justin Whear wrote:
I think you mean ||, not &&. The best way I know around this
is to
define enums:
version (DigitalMars)
enum compiler_DigitalMars = true;
else
enum compiler_DigitalMars = false;
//... similar for LDC
static if (compiler_Dig
Danyal Zia:
Is there a way to check both versions at the same time? (I
can't seem to find the solution through google, sorry)
This is close to being the best solution in D (untested):
version(DigitalMars) enum myMars = true; else enum myMars = false;
version(LDC) enum myLdc = true; else enum
On Wed, 25 Jun 2014 20:24:30 +, Danyal Zia wrote:
> Hi, In the development of my library, I'm in a position where I need to
> add support for multiple compilers. For instance, supporting both the
> assembly of LDC/DMD and GDC. I want to do something like:
>
> version(DigitalMars && LDC)
> {
>
I don't completely understand your problem, but have you tried
marking the class as static?
static class Dummy { ... }
I was about to post links to the actual code to make it more
clear, but that did the trick. Thanks for the fast reply.
Just to make sure - given:
unittest {
static class
Hi, In the development of my library, I'm in a position where I
need to add support for multiple compilers. For instance,
supporting both the assembly of LDC/DMD and GDC. I want to do
something like:
version(DigitalMars && LDC)
{
}
However, it doesn't compile which forces me to rewrote the sa
I'm trying to create a set of utility functions that cache
objects of various types loaded from json files, but having
trouble testing it. One function I'd like to test uses new to
instantiate an object based on a compile-time parameter:
void loadDataFile(T)(string filename) {
...
T obj = ne
On Wednesday, 25 June 2014 at 20:17:35 UTC, rcor wrote:
I'm trying to create a set of utility functions that cache
objects of various types loaded from json files, but having
trouble testing it. One function I'd like to test uses new to
instantiate an object based on a compile-time parameter:
Let me preface this by admitting that I'm not sure I'm using the
DDoc functionality properly at all, so let me know if my
questions are bogus.
Is it possible to:
- Add private members to documentation?
- Have DDoc do its thing after mixins have been handled?
- Access UDAs?
To expand on the las
On Wed, Jun 25, 2014 at 05:10:06PM +, Chris Nicholson-Sauls via
Digitalmars-d-learn wrote:
> UDA's are compile-time metadata associated with a specific
> declaration. So in something like:
>
> @foo int x;
>
> The @foo is attached to x, but is not part of the type.
The term "attribute" is a
UDA's are compile-time metadata associated with a specific
declaration. So in something like:
@foo int x;
The @foo is attached to x, but is not part of the type.
On Wednesday, 25 June 2014 at 14:24:11 UTC, Binarydepth wrote:
I would like to show D in "action" to other
programmers/students.
Anyone knows of a Video Game coded in D2 ?
Thank you
Here are two:
http://dgame-dev.de/?page=show
I'm trying to declare format for database record in compile time.
I consider to use attributes fo this. Can I do something similar
to this code?
struct RecordFormat(T)
{}
alias Format = RecordFormat!( @("cool") int );
pragma( msg, Format );
void main()
{
}
Or I want something strang
Hi,
Some time ago I wrote this Tetris-like game:
https://bitbucket.org/lmb/anytris (also on GitHub:
https://github.com/lmbarros/Anytris)
Nothing fancy. I am sure there are better examples out there. And maybe
this is not the best code to show to students ;-)
Also, license is ZLib -- I assume it
On Tuesday, 24 June 2014 at 10:16:38 UTC, bearophile wrote:
John Colvin:
I'm getting OutOfMemoryErrors on some machines when calling
GC.malloc (or new) for anything large (more than about 1GB),
where core.stdc.malloc works fine.
I think that when you go in territories where most people have
On Thursday, 19 June 2014 at 04:07:30 UTC, Jesse Phillips wrote:
On Wednesday, 18 June 2014 at 23:41:43 UTC, GoD wrote:
@Jesse
How to use in C# projects?
You'll have to access it through a COM interface on the C# side.
http://msdn.microsoft.com/en-us/library/aa645736%28v=vs.71%29.aspx
If yo
On Thursday, 19 June 2014 at 13:59:25 UTC, Kagamin wrote:
On Wednesday, 18 June 2014 at 20:55:09 UTC, GoD wrote:
D, very fast programming language. But I can not WinForm
applications from D. I'm using C# for WinForm applications.
DWT and TkD didn't work for you?
Can you give us some Design t
I would like to show D in "action" to other programmers/students.
Anyone knows of a Video Game coded in D2 ?
Thank you
On Wednesday, 25 June 2014 at 09:30:54 UTC, seany wrote:
Given an assosiative array : int[string] k, is there a way
(either phobos or tango) to pop the first element of this array
and append it to another array?
I can come up with a primitive soluiton:
int[string] k;
// populate k here
int[s
On Wednesday, 25 June 2014 at 09:54:16 UTC, bearophile wrote:
Sean Campbell:
but which one is better conforms to the d style?
Both are valid. Use the second when you want a more precise
exception in your code, this is common in larger programs.
Keep in mind that you can allocate an excepti
seany:
int[string] k;
// populate k here
int[string] j;
foreach(sttring key, int val; k)
{
j[key] = val;
break;
}
This is OK, and you can encapsulate this into a little function.
But you are not removing the pair from the first associative
array. So you have to remove the item before the
Sean Campbell:
but which one is better conforms to the d style?
Both are valid. Use the second when you want a more precise
exception in your code, this is common in larger programs.
Keep in mind that you can allocate an exception in a point and
throw it in another. This reduces the runtim
On Wednesday, June 25, 2014 09:30:48 seany via Digitalmars-d-learn wrote:
> Given an assosiative array : int[string] k, is there a way
> (either phobos or tango) to pop the first element of this array
> and append it to another array?
>
> I can come up with a primitive soluiton:
>
> int[string] k;
i know you can use both
throw new Exception(msg);
and
module test;
class testException {
this (string msg) {
super("some error info : "~msg);
}
}
throw new testException(msg);
but which one is better conforms to the d style?
Given an assosiative array : int[string] k, is there a way
(either phobos or tango) to pop the first element of this array
and append it to another array?
I can come up with a primitive soluiton:
int[string] k;
// populate k here
int[string] j;
foreach(sttring key, int val; k)
{
j[key] = v
Aso, I wanted to mention that I did not find much info in the
manual page on this.
I wanted to create a simple application to display and edit data
from postgresql database using GtkD and ddb
(https://github.com/pszturmaj/ddb)
The application should run on WinXp or Win7. After a week of work
I throw in the towel ...
1. The first problem
$ dub build
Unexpected Terminat
On 06/24/2014 11:23 PM, Yuushi wrote:
> Yeah, I realised that when I went back and looked at what I'd tried:
>
> function string(string) transform;
That gets me all the time! :-/ That is the long version of the function
literal syntax:
auto f = function string(string s) { return "he
On 2014-06-25 03:53, WhatMeWorry wrote:
I open a command line window, and run the following 6 line program
void main()
{
string envPath = environment["PATH"];
writeln("PATH is: ", envPath);
envPath ~= r";F:\dmd2\windows\bin";
environment["PATH"] = envPath;
envPath = envir
41 matches
Mail list logo