Somewhat related to
https://github.com/D-Programming-Language/phobos/pull/2024
I wonder about the soundness of `map` in
```D
import std.algorithm, std.range, std.stdio;
void main(string[] args)
{
long[] arr;
const n = 3;
iota(n).map!(a => arr ~= a);
writeln(arr);
Thanks for detail answer. I stopped at error:
source\cpl_vsi.d(70): Error: module stat is in file
'std\c\stat.d' which cannot
be read
I do not know where I can find this module.
If someone wan't to attempt to create binding, or finish my here
is link of my half-done job
http://s000.tinyuplo
On 01/12/2015 10:09 PM, tcak wrote:
> It is just making everything dirty.
> request.HttpSocketConnectionRequest
> connection.HttpSocketConnection
You can name the files the same as their classes:
HttpSocketConnectionRequest.d, etc.
> I just want to create a file called "HttpSocketConnectionRe
On Tuesday, 13 January 2015 at 05:18:46 UTC, Ali Çehreli wrote:
On 01/12/2015 08:22 PM, tcak wrote:
>> What namespace? D has modules, unlike C++. In general it's a
bad idea
>> to have inside a module a name (like a variable name or
struct name)
>> equal to the module name, because it causes confu
On 01/12/2015 08:22 PM, tcak wrote:
>> What namespace? D has modules, unlike C++. In general it's a bad idea
>> to have inside a module a name (like a variable name or struct name)
>> equal to the module name, because it causes confusion.
>
> I am confused as well.
>
> core.stdc.errno
>
> @propert
What namespace? D has modules, unlike C++. In general it's a
bad idea to have inside a module a name (like a variable name
or struct name) equal to the module name, because it causes
confusion.
I am confused as well.
core.stdc.errno
@property int errno() { return getErrno(); }
@property int
On Monday, 12 January 2015 at 18:11:35 UTC, bearophile wrote:
D modules can contain lot of stuff, like variables, constants,
enums, types, structs, etc. And you usually put more than one
class in each D module. Also D class names should be
capitalized (like "Project").
When I do this, it w
On 13/01/2015 2:01 p.m., Andrew Grace wrote:
I am trying to play with D, but I'm getting stuck with the DUB package
manager. If use DUB to download a package to my project, how do I get
DUB to add what I downloaded to the dub.json file? I have tried DUB
--fetch --cache=local http-parser (for exa
I am trying to play with D, but I'm getting stuck with the DUB
package manager. If use DUB to download a package to my project,
how do I get DUB to add what I downloaded to the dub.json file?
I have tried DUB --fetch --cache=local http-parser (for example).
It downloads the package, but then
I had seen some stuff on alias thing, but I hadn't bothered to
try to understand it until now. If I'm understanding the first
example http://dlang.org/class.html#AliasThis";>here,
alias this let's you refer to x in s by writing either s.x (as
normally) or just s. That didn't seem that interesting,
On Monday, 12 January 2015 at 19:29:54 UTC, jmh530 wrote:
I'm new to D. I have some modest knowledge of C++, but am more
familiar with scripting languages (Matlab, Python, R). D seems
so much easier than C++ in a lot of ways (and I just learned
about rdmd today, which is pretty cool). I am conc
On Monday, 12 January 2015 at 21:54:51 UTC, ketmar via
Digitalmars-d-learn wrote:
On Mon, 12 Jan 2015 21:37:27 +
aldanor via Digitalmars-d-learn
wrote:
On Monday, 12 January 2015 at 20:30:45 UTC, ketmar via
Digitalmars-d-learn wrote:
> it even has `RefCounted!`, but it doesn't play well
On Mon, 12 Jan 2015 21:37:27 +
aldanor via Digitalmars-d-learn
wrote:
> On Monday, 12 January 2015 at 20:30:45 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > it even has `RefCounted!`, but it doesn't play well with
> > classes yet
> > (AFAIR).
> I wonder if it's possible to somehow make a
On Monday, 12 January 2015 at 20:30:45 UTC, ketmar via
Digitalmars-d-learn wrote:
it even has `RefCounted!`, but it doesn't play well with
classes yet
(AFAIR).
I wonder if it's possible to somehow make a version of refcounted
that would work with classes (even if limited/restricted in some
cer
On Mon, 12 Jan 2015 20:14:19 +
jmh530 via Digitalmars-d-learn
wrote:
> Thanks for the reply, I wasn't familiar with scoped. I was aware
> that structs are on the stack and classes are on the heap in D,
> but I didn't know it was possible to put a class on the stack.
> Might be interesting
Thanks for the reply, I wasn't familiar with scoped. I was aware
that structs are on the stack and classes are on the heap in D,
but I didn't know it was possible to put a class on the stack.
Might be interesting to see how this is implemented.
After looking up some more C++, I think what I wa
On Mon, 12 Jan 2015 19:29:53 +
jmh530 via Digitalmars-d-learn
wrote:
the proper answer is too long to write (it will be more an article that
a forum answer ;-), so i'll just give you some directions:
import std.typecons;
{
auto b = scoped!B(); // `auto` is important here!
...
I'm new to D. I have some modest knowledge of C++, but am more
familiar with scripting languages (Matlab, Python, R). D seems so
much easier than C++ in a lot of ways (and I just learned about
rdmd today, which is pretty cool). I am concerned about
performance of D vs. C++, so I wanted to learn
tcak:
One way I achieved it, though I cannot put namespace on it.
file: project.d
==
module project;
class project{}
D modules can contain lot of stuff, like variables, constants,
enums, types, structs, etc. And you usually put more than one
class in each D module. Also D
In java, if I create a file, the class that is defined in it must
have the same name of file. So, with the file name, I can relate
to class directly. Is there any way to achieve this in D?
One way I achieved it, though I cannot put namespace on it.
file: project.d
==
module pr
On Monday, 12 January 2015 at 16:32:31 UTC, Oleg wrote:
Because dynamic arrays are passed by value to functions. Will
it make another copy of array, if I'll pass array by value?
It is important to think of the underlying representation with a
pointer and length passed by value. Since it is a p
On Monday, January 12, 2015 13:59:27 Laeeth Isharc via Digitalmars-d-learn
wrote:
> import std.datetime;
> import std.stdio;
> import std.conv;
>
> void main(string[] arg)
> {
> auto a=Clock.currTime();
> auto b=cast(ubyte[])a;
> writefln("%s",b);
> }
>
> how do i get the time as a binary re
On Mon, 12 Jan 2015 16:53:59 +
Oleg via Digitalmars-d-learn wrote:
> On Monday, 12 January 2015 at 16:44:42 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > nope, it means exactly what is written there. except that
> > dynamic array
> > is represented by struct like this:
> >
> > struct {
On Monday, 12 January 2015 at 16:44:42 UTC, ketmar via
Digitalmars-d-learn wrote:
nope, it means exactly what is written there. except that
dynamic array
is represented by struct like this:
struct {
void *dataptr;
size_t itemCount;
}
this is what D calls "dynamic array", and this i
On Mon, 12 Jan 2015 16:32:30 +
Oleg via Digitalmars-d-learn wrote:
> On Monday, 12 January 2015 at 15:59:43 UTC, Adam D. Ruppe wrote:
> > Why are you using ref? Take that off and you can pass any
> > array, including null, with ease.
>
> Because dynamic arrays are passed by value to functio
On Monday, 12 January 2015 at 15:59:43 UTC, Adam D. Ruppe wrote:
Why are you using ref? Take that off and you can pass any
array, including null, with ease.
Because dynamic arrays are passed by value to functions. Will it
make another copy of array, if I'll pass array by value?
Looks like it
On Monday, 12 January 2015 at 15:51:17 UTC, Oleg wrote:
void foo(ref int[] param1) {}
Why are you using ref? Take that off and you can pass any array,
including null, with ease.
The only difference is changes to length won't be seen outside
the foo function.
Hello. How can I call a function with null as parameter, which I
don't want to set. For example:
void foo(ref int[] param1) {}
I can't call this function like:
foo(null);
Is it possible to set default value for an array parameter or
pass null/empty array? I can create empty array and pass it, bu
V Mon, 12 Jan 2015 13:59:27 +
Laeeth Isharc via Digitalmars-d-learn
napsáno:
> import std.datetime;
> import std.stdio;
> import std.conv;
>
> void main(string[] arg)
> {
> auto a=Clock.currTime();
> auto b=cast(ubyte[])a;
> writefln("%s",b);
> }
>
> how do i get the time
On 1/12/15 8:59 AM, Laeeth Isharc wrote:
import std.datetime;
import std.stdio;
import std.conv;
void main(string[] arg)
{
auto a=Clock.currTime();
auto b=cast(ubyte[])a;
writefln("%s",b);
}
how do i get the time as a binary representation I can write to a file?
You can always
import std.datetime;
import std.stdio;
import std.conv;
void main(string[] arg)
{
auto a=Clock.currTime();
auto b=cast(ubyte[])a;
writefln("%s",b);
}
how do i get the time as a binary representation I can write to a
file?
Thanks.
On Monday, 12 January 2015 at 13:37:19 UTC, ref2401 wrote:
Thanks for the links.
I have shared class instance. There are two threads which can
read/write fields of the class. As i understand i can declare
class as synchronized or i can read/write using
atomicLoad/atomicStore.
What's the diff
Thanks for the links.
I have shared class instance. There are two threads which can
read/write fields of the class. As i understand i can declare
class as synchronized or i can read/write using
atomicLoad/atomicStore.
What's the difference between these two approaches?
In what circumstances s
Thanks for the help to everyone. It seems a common thing to want
to check an array as one may not know the variables at compile
time. Not that it's more than a few lines to do in D. But in
terms of language adoption, small frictions can have large
consequences over time. (Modern people don'
Laeeth.
Thanks for the reply. Yes, this concerns my HDF5 wrapper
project; the main concern is not that the memory consumption of
course, but rather explicitly controlling lifetimes of the
objects (especially objects like files -- so you are can be
sure there are no zombie handles floating arou
35 matches
Mail list logo