Honestly, I don't think what you're looking for is possible in
*any*
statically compiled systems language.
NaCl does feature some code verification.
On 20/12/2011 22:19, bearophile wrote:
That's also why I have said a better solution is to wrap that code into a
function
template, so there is no need for an alias.
So what you actually meant was to make TF a template parameter? That would
make more sense.
I can understand an alias being
On 20/12/2011 20:36, Philippe Sigaud wrote:
That is, it expects some values, then string/values couples as
associative arrays.
I've a recollection of seeing something like this in the PHP library, but I forget where.
I believe it's used in some functions that have a lot of options to set, s
Stewart Gordon:
> I don't quite understand - why not just use float as it is? OK, so
> abbreviating it to TF
> saves 9 characters on that line, but the alias declaration and its trailing
> line break
> take up 16 characters, so you're not saving space at all.
It's not a way to save chars, it'
On 20/12/2011 18:12, bearophile wrote:
Because in that code I have used three times a type (TF), auto allows to remove
only
one of them. The alias is not the best solution (a better solution is to put
that code
into a templated function), but repeating the same generic type more than one
time
On Mon, Dec 19, 2011 at 17:17, clk wrote:
> 2) D doesn't seem to support the list comprehension syntax available in
> python and javascript. Is this correct?
>
> [f(x) for x in list if condition]
Correct. As other have said, it's doable by combining std functions.
As fas as I know, we do not h
> On 20/12/2011 14:18, clk wrote:
>> Here's another one. Is there a way to pass arguments to functions by
>> keyword as in the
>> calls to f and g below?
I remember a discussion about year ago or so.
It seems doable to have some kind of function transformer (adaptor?) for this.
from:
int foo(in
Timon Gehr:
> I think having static foreach would greatly benefit the language.
Vote here! :-)
http://d.puremagic.com/issues/show_bug.cgi?id=4085
Bye,
bearophile
I'd say make a small test-case and file it to visuald's bugtracker.
On 12/20/2011 07:13 PM, bearophile wrote:
Michal Minich:
struct Group (Items ...)
{
// how to do this? ... no static foreach :(
static foreach (I; Items)
In D if you use foreach on a typeTuple you get a static foreach.
Bye,
bearophile
Yes, but foreach cannot be used in declaratio
On 12/20/2011 07:12 PM, bearophile wrote:
Stewart Gordon:
On 19/12/2011 12:12, bearophile wrote:
Try something like this (untested):
alias float TF;
TF[] f = (cast(TF*)std.gc.malloc(x * TF.sizeof))[0 .. x];
I fail to see any real difference from the OP's code:
- Why the alias?
Because
Michal Minich:
> struct Group (Items ...)
> {
> // how to do this? ... no static foreach :(
> static foreach (I; Items)
In D if you use foreach on a typeTuple you get a static foreach.
Bye,
bearophile
Stewart Gordon:
> On 19/12/2011 12:12, bearophile wrote:
> > Try something like this (untested):
> >
> > alias float TF;
> > TF[] f = (cast(TF*)std.gc.malloc(x * TF.sizeof))[0 .. x];
>
>
> I fail to see any real difference from the OP's code:
>
> - Why the alias?
Because in that code I have u
Dne 20.12.2011 2:22, Andrej Mitrovic napsal(a):
test.cpp: http://www.ideone.com/uh7vN
DLibrary.d: http://www.ideone.com/fOLN8
$ g++ test.cpp
$ dmd -ofDLibrary.dll DLibrary.d
$ a.exe
$ 9
Hi, Andrej,
you are right, this works. Problem is going to be either in VisualD or
cv2pdb.
For those who
On 12/19/2011 01:04 PM, Bear wrote:
Using D1, I have a program that creates tons of float[] ; for performance
reasons, I would like them to be uninitialized.
I've tried replacing
float[] f = new float[x];
by
float[] f = cast(float[])std.gc.malloc(x*4);
Unfortunately I keep running into "Access
On Tue, 20 Dec 2011 09:18:16 -0500, clk wrote:
Thank you for your quick replies. I'm impressed by the helpfulness and
dedication of the D community!
Here's another one. Is there a way to pass arguments to functions by
keyword as in the calls to f and g below?
void f(int a = 0, int b = 1) {}
v
On 12/20/2011 03:18 PM, clk wrote:
Thank you for your quick replies. I'm impressed by the helpfulness and
dedication of the D community!
Here's another one. Is there a way to pass arguments to functions by
keyword as in the calls to f and g below?
void f(int a = 0, int b = 1) {}
void g(int a) {}
On Tue, 20 Dec 2011 09:22:46 -0500, Stewart Gordon
wrote:
On 19/12/2011 18:11, Steven Schveighoffer wrote:
On Mon, 19 Dec 2011 12:24:18 -0500, Bear wrote:
gc.malloc actually returns void[]
http://www.d-programming-language.org/phobos/core_memory.html#malloc
Looks like void* to me...
O
On 12/20/2011 02:32 PM, Michal Minich wrote:
My naive approach doesn't works
struct Item1 (T) {}
struct Item2 (T) {}
struct Group (Items ...)
{
// how to do this? ... no static foreach :(
static foreach (I; Items)
mixin I!(int);
}
void main ()
{
alias Group!(Item1, Ite
On 19/12/2011 12:12, bearophile wrote:
Bear:
float[] f = cast(float[])std.gc.malloc(x*4);
Try something like this (untested):
alias float TF;
TF[] f = (cast(TF*)std.gc.malloc(x * TF.sizeof))[0 .. x];
I fail to see any real difference from the OP's code:
- Why the alias?
- std.gc.malloc
On 19/12/2011 18:11, Steven Schveighoffer wrote:
On Mon, 19 Dec 2011 12:24:18 -0500, Bear wrote:
gc.malloc actually returns void[]
http://www.d-programming-language.org/phobos/core_memory.html#malloc
Looks like void* to me...
Or is there another function I'm not aware of? I think it should
Thank you for your quick replies. I'm impressed by the helpfulness and
dedication of the D community!
Here's another one. Is there a way to pass arguments to functions by
keyword as in the calls to f and g below?
void f(int a = 0, int b = 1) {}
void g(int a) {}
void main() {
f(b = 1, a =
My naive approach doesn't works
struct Item1 (T) {}
struct Item2 (T) {}
struct Group (Items ...)
{
// how to do this? ... no static foreach :(
static foreach (I; Items)
mixin I!(int);
}
void main ()
{
alias Group!(Item1, Item2) G;
}
== Quote from Timon Gehr (timon.g...@gmx.ch)'s article
> On 12/19/2011 09:30 PM, Philippe Sigaud wrote:
> > On Mon, Dec 19, 2011 at 18:49, Timon Gehr wrote:
> >
> > Anyway, Heromyth, I'm slowly working on a D template tutorial. The
> > current pdf is at:
> >
> > https://github.com/PhilippeSigaud/D
24 matches
Mail list logo