Hello all,
If I mark a struct or class method as const, this is assumed to apply to the
entire method, i.e. that nothing in it will modify any internal data of the
struct/class.
struct Foo
{
const auto bar()
{
// I can't modify any of the
//
On Monday, 25 November 2013 at 09:05:39 UTC, Joseph Rushton
Wakeling wrote:
Hello all,
If I mark a struct or class method as const, this is assumed to
apply to the entire method, i.e. that nothing in it will modify
any internal data of the struct/class.
struct Foo
{
const
Does a binding for google api (for example analytics api) exist?
I search on github, nothing found. Anyone?
On 25/11/13 10:13, Andrea Fontana wrote:
auto bar() { return cast(const int) 10; }
writeln(typeid(bar()));
Yup, I should have added that I would prefer to avoid a cast in the return
statement :-) Thanks anyway!
On Monday, 25 November 2013 at 03:13:48 UTC, Shammah Chancellor
wrote:
On 2013-11-25 00:08:50 +, Namespace said:
I love this feature, but I'm unsure how it works. Can someone
explain me, how the compiler deduce that he should read 4
bytes for each index (the 'at' function)? The type is
The following code used to compile with DMD 2.063.2:
import std.typecons;
struct Foo
{
alias Tuple!(int) NEW_ARGS;
NEW_ARGS args;
void foo ()
{
static if (NEW_ARGS.length == 1) {}
}
}
But compiling the above code with DMD 2.064.2 results in this error:
Joseph Rushton Wakeling:
struct Foo
{
const(auto) bar()
{
// modifies internal data of Foo
// but returns a const type
}
}
Is this acceptable?
struct Foo {
auto bar() {
const result = ...;
return
On 25/11/13 12:00, bearophile wrote:
Is this acceptable?
struct Foo {
auto bar() {
const result = ...;
return result;
}
}
Could work, nice thought :-) I was hoping for something in the function
signature rather than internally, though.
This D1 entry needs an update:
http://rosettacode.org/wiki/Metered_concurrency#D
Is someone willing to update it?
import std.stdio, core.thread, std.c.time;
class Semaphore {
private int lockCnt, maxCnt;
this(in int count) {
maxCnt = lockCnt = count;
}
void acquire()
On 2013-11-25 06:03:27 +, Antoche said:
The following code compiles but doesn't work as expected:
import std.stdio;
import std.concurrency;
class A
{
this() immutable {}
}
void main()
{
auto tid = spawn( fooBar, thisTid );
On 2013-11-25 10:34:39 +, Namespace said:
On Monday, 25 November 2013 at 03:13:48 UTC, Shammah Chancellor wrote:
On 2013-11-25 00:08:50 +, Namespace said:
I love this feature, but I'm unsure how it works. Can someone explain
me, how the compiler deduce that he should read 4 bytes for
On 25/11/13 12:00, bearophile wrote:
Is this acceptable?
Actually, your suggestion made me realize I could do even better -- here's the
patch I came up with in the end:
https://github.com/WebDrake/Dgraph/commit/34d6cfacee928b74d084cff7c2f6c438f5144436
The arrays in question are only ever
I had an old dmd2 setup that worked perfectly. I recently
installed VS2013, SDK 8, DMD 2.064.2, and VS 3.37 on a fresh
system.
I copied the project to the HD, updated the sc.ini files and
tried to compile. Basic projects would compile but my old
projects would give errors either:
Sending immutable classes currently does not work because of
https://d.puremagic.com/issues/show_bug.cgi?id=7069 (and has
never worked despite being intended).
On Thursday, 21 November 2013 at 06:48:40 UTC, qznc wrote:
On Wednesday, 20 November 2013 at 22:49:42 UTC, Spott wrote:
I've been screwing around with templates lately, and I'm
attempting to figure out why the following won't compile:
struct value
{
int a;
const auto
On Thursday, 21 November 2013 at 07:23:09 UTC, Jonathan M Davis
wrote:
On Wednesday, November 20, 2013 23:49:42 Spott wrote:
I've been screwing around with templates lately, and I'm
attempting to figure out why the following won't compile:
struct value
{
int a;
const auto
On Thursday, 21 November 2013 at 19:21:10 UTC, Ali Çehreli wrote:
On 11/21/2013 07:22 AM, Lemonfiend wrote:
I'm wondering if it's possible to have a struct in D which
uses the same
pointer and memory as returned by the extern C function.
This would allow me to manipulate and use the C struct
On Monday, 25 November 2013 at 13:49:58 UTC, Frustrated wrote:
I had an old dmd2 setup that worked perfectly. I recently
installed VS2013, SDK 8, DMD 2.064.2, and VS 3.37 on a fresh
system.
I copied the project to the HD, updated the sc.ini files and
tried to compile. Basic projects would
On Monday, 25 November 2013 at 17:38:00 UTC, Lemonfiend wrote:
_this
vs
_this.ptr
I had thought those would give the same result, but apparently
not?
Think about slice as a struct with two fields - data pointer and
data length. `slice` gives pointer to struct itself, `slice.ptr`
yields
Hey all,
New to Linux, so I wanted to double check something. I have a C
shared library and a D static library. The D static library uses
functions from the C library. On Windows, it didn't matter what
order I linked the .libs in and it always compiled fine. On
Linux, however, I have to link
On Monday, 25 November 2013 at 17:57:21 UTC, Dicebot wrote:
On Monday, 25 November 2013 at 17:38:00 UTC, Lemonfiend wrote:
_this
vs
_this.ptr
I had thought those would give the same result, but apparently
not?
Think about slice as a struct with two fields - data pointer
and data length.
In my programme I want to make set of immutable struct objects,
that will be initialazed at startup in shared static this()
constructor. But using the folowing code I have compilation
error. I think there is a problem with associative array.
For usual array we have .idup property that returns
25-Nov-2013 22:19, Jeremy DeHaan пишет:
Hey all,
New to Linux, so I wanted to double check something. I have a C shared
library and a D static library. The D static library uses functions from
the C library. On Windows, it didn't matter what order I linked the
.libs in and it always compiled
On 25.11.2013 14:49, Frustrated wrote:
I had an old dmd2 setup that worked perfectly. I recently installed
VS2013, SDK 8, DMD 2.064.2, and VS 3.37 on a fresh system.
I copied the project to the HD, updated the sc.ini files and tried to
compile. Basic projects would compile but my old projects
This isn't compiles. Bug?
import std.range;
class Foo {}
void main() {
immutable(Foo)[] a;
immutable(Foo)[] b;
auto c = chain(a, b).length;
}
http://dpaste.dzfl.pl/71272a10
*doesn't compile
On 11/25/2013 10:52 AM, Uranuz wrote:
In my programme I want to make set of immutable struct objects, that
will be initialazed at startup in shared static this() constructor. But
using the folowing code I have compilation error. I think there is a
problem with associative array.
For usual
On Monday, 25 November 2013 at 17:44:43 UTC, Jeremy DeHaan wrote:
On Monday, 25 November 2013 at 13:49:58 UTC, Frustrated wrote:
I had an old dmd2 setup that worked perfectly. I recently
installed VS2013, SDK 8, DMD 2.064.2, and VS 3.37 on a fresh
system.
I copied the project to the HD,
On Monday, 25 November 2013 at 18:19:57 UTC, Jeremy DeHaan wrote:
Hey all,
New to Linux, so I wanted to double check something. I have a C
shared library and a D static library. The D static library
uses functions from the C library. On Windows, it didn't matter
what order I linked the .libs
In gdb, for C/C++ programs, 'catch throw' and 'catch catch' allow
the user to break on exception throwing and exception catching,
respectively. See
https://sourceware.org/gdb/onlinedocs/gdb/Set-Catchpoints.html
This doesn't seem to work in D. The only way I've been able to
catch an exception in
I think I remember when setting up Visual D I went in and had to
add some path to the library folders or something. Maybe that has
to do with it?
The issue only happens when I import the library I've created
into the project so it probably is a configuration issue within
Visual D.
e.g.,
On Monday, 25 November 2013 at 19:38:44 UTC, Jack Applegame wrote:
This isn't compiles. Bug?
Yes, and a trivially trivial bug at that. File it and I'll fix it.
On Monday, 25 November 2013 at 11:48:06 UTC, Shammah Chancellor
wrote:
On 2013-11-25 06:03:27 +, Antoche said:
The following code compiles but doesn't work as expected:
import std.stdio;
import std.concurrency;
class A
{
this() immutable {}
}
void
On Monday, 25 November 2013 at 19:38:44 UTC, Jack Applegame wrote:
This isn't compiles. Bug?
import std.range;
class Foo {}
void main() {
immutable(Foo)[] a;
immutable(Foo)[] b;
auto c = chain(a, b).length;
}
http://dpaste.dzfl.pl/71272a10
Seems like a bug to me. If
I think I remember when setting up Visual D I went in and had to
add some path to the library folders or something. Maybe that has
to do with it?
The issue only happens when I import the library I've created
into the project so it probably is a configuration issue within
Visual D.
e.g.,
On Monday, 25 November 2013 at 21:04:43 UTC, Jesse Phillips wrote:
On Monday, 25 November 2013 at 19:38:44 UTC, Jack Applegame
wrote:
This isn't compiles. Bug?
import std.range;
class Foo {}
void main() {
immutable(Foo)[] a;
immutable(Foo)[] b;
auto c = chain(a,
On 2013-11-25 14:08:53 +, Dicebot said:
Sending immutable classes currently does not work because of
https://d.puremagic.com/issues/show_bug.cgi?id=7069 (and has never
worked despite being intended).
Can you send immutable struct references?
On Monday, 25 November 2013 at 20:29:19 UTC, Antoche wrote:
On Monday, 25 November 2013 at 18:19:57 UTC, Jeremy DeHaan
wrote:
Hey all,
New to Linux, so I wanted to double check something. I have a
C shared library and a D static library. The D static library
uses functions from the C
Is there any way to do something like this?
import std.stdio;
enum Foo : void function() {
WOMBAT = () {writeln(Wombat);}
}
void doStuff(Foo f) {
f();
}
int main() {
doStuff( Foo.WOMBAT );
return 0;
}
Currently, I get the errors:
hello.d(4): Error:
On Monday, November 25, 2013 22:08:37 monarch_dodra wrote:
On Monday, 25 November 2013 at 21:04:43 UTC, Jesse Phillips wrote:
On Monday, 25 November 2013 at 19:38:44 UTC, Jack Applegame
wrote:
This isn't compiles. Bug?
import std.range;
class Foo {}
void main() {
On Monday, 25 November 2013 at 20:09:20 UTC, Frustrated wrote:
On Monday, 25 November 2013 at 17:44:43 UTC, Jeremy DeHaan
wrote:
On Monday, 25 November 2013 at 13:49:58 UTC, Frustrated wrote:
I had an old dmd2 setup that worked perfectly. I recently
installed VS2013, SDK 8, DMD 2.064.2, and VS
On Monday, 25 November 2013 at 23:32:27 UTC, Chris Williams wrote:
Is there any way to do something like this?
import std.stdio;
enum Foo : void function() {
WOMBAT = () {writeln(Wombat);}
}
void doStuff(Foo f) {
f();
}
int main() {
doStuff( Foo.WOMBAT );
I have some type of automatically generated interface using a
mixin an would like to extend them after they are generated:
mixin(GenerateMyInterface!(...));
... Here I would like to add some members/methods to
MyInterface which was generated above ...
Is this at all possible?
Bartosz Milewski has written the second article about immutable
data structures in C++11, this time about Red-Black trees:
http://bartoszmilewski.com/2013/11/25/functional-data-structures-in-c-trees/
The C++11 code with few small changes (like using enum class
instead of enum):
Hi guys I'm trying out Mono-D with Monodevelop 4.2 and the
compiler seems to build ok but the debugger says Error 1.
Here is the sample Hello world code
--
import std.stdio;
void main()
{
writeln(Hello World!);
}
On Tuesday, 26 November 2013 at 00:28:34 UTC, bearophile wrote:
Bartosz Milewski has written the second article about immutable
data structures in C++11, this time about Red-Black trees:
http://bartoszmilewski.com/2013/11/25/functional-data-structures-in-c-trees/
The C++11 code with few small
On Tuesday, 26 November 2013 at 01:21:49 UTC, Craig Dillabaugh
wrote:
On Tuesday, 26 November 2013 at 00:28:34 UTC, bearophile wrote:
clip
Bye,
bearophile
What do you mean by an 'immutable' data structure. The linked
article talks about Persistent data structures. Are these the
same
Craig Dillabaugh:
What do you mean by an 'immutable' data structure. The linked
article talks about Persistent data structures. Are these the
same thing?
When I saw Immutable I figured it didn't support
insertion/deletion - which would sort eliminate the need for a
Red-Black tree
Craig Dillabaugh:
While I am at it, I might as well ask another question. How is
it that your 'insert' function is const? I thought I
understood const, but apparently not!
The D code I have linked is not yet working, so don't read too
much in it.
But you can add items to an immutable
On Tuesday, 26 November 2013 at 01:31:11 UTC, bearophile wrote:
Craig Dillabaugh:
What do you mean by an 'immutable' data structure. The linked
article talks about Persistent data structures. Are these the
same thing?
When I saw Immutable I figured it didn't support
insertion/deletion -
On Tuesday, 26 November 2013 at 00:27:25 UTC, IgorStepanov wrote:
You can write
enum Foo : void function()
{
WOMBAT = function void () {writeln(Wombat);}
}
or
enum Foo
{
WOMBAT = function void () {writeln(Wombat);}
}
`() {writeln(Wombat);}` literal recognized by compiler as
On 11/25/2013 04:27 PM, Frustrated wrote:
I have some type of automatically generated interface using a mixin an
would like to extend them after they are generated:
mixin(GenerateMyInterface!(...));
... Here I would like to add some members/methods to MyInterface
which was generated
On Tuesday, 26 November 2013 at 05:03:45 UTC, Ali Çehreli wrote:
On 11/25/2013 04:27 PM, Frustrated wrote:
I have some type of automatically generated interface using a
mixin an
would like to extend them after they are generated:
mixin(GenerateMyInterface!(...));
... Here I would
On 2013-11-25 23:32:25 +, Chris Williams said:
Is there any way to do something like this?
import std.stdio;
enum Foo : void function() {
WOMBAT = () {writeln(Wombat);}
}
void doStuff(Foo f) {
f();
}
int main() {
doStuff( Foo.WOMBAT );
return 0;
On Tuesday, 26 November 2013 at 05:12:00 UTC, Frustrated wrote:
On Tuesday, 26 November 2013 at 05:03:45 UTC, Ali Çehreli wrote:
On 11/25/2013 04:27 PM, Frustrated wrote:
I have some type of automatically generated interface using a
mixin an
would like to extend them after they are generated:
On Monday, 25 November 2013 at 23:25:05 UTC, Jeremy DeHaan wrote:
Order matters, no matter the language. See
http://stackoverflow.com/a/409470/1924406
Thanks!
That's a great link. It cleared up quite a lot.
Note that this also applies to Windows with MinGW (and, I assume,
Cygwin). It's a
On Tuesday, 26 November 2013 at 05:13:00 UTC, Shammah Chancellor
wrote:
What is the practical purpose of such a thing?
-Shammah
The two cases I can think of are:
1. To define a set of supported handlers which can be passed in
as a parameter to a call. Rather than writing a switch in your
On Monday, November 25, 2013 18:34:30 Spott wrote:
Why is rhs a purely runtime argument? I would think it would be
known at compile time.
Function arguments are runtime entities, not compile-time entities and
therefore cannot be used in places where a compile-time entity is required.
e.g.
On Tuesday, November 26, 2013 01:27:49 Frustrated wrote:
I have some type of automatically generated interface using a
mixin an would like to extend them after they are generated:
mixin(GenerateMyInterface!(...));
... Here I would like to add some members/methods to
MyInterface which was
On 11/25/2013 09:11 PM, Frustrated wrote:
On Tuesday, 26 November 2013 at 05:03:45 UTC, Ali Çehreli wrote:
On 11/25/2013 04:27 PM, Frustrated wrote:
I have some type of automatically generated interface using a mixin an
would like to extend them after they are generated:
On Monday, 25 November 2013 at 23:44:26 UTC, Jonathan M Davis
wrote:
On Monday, November 25, 2013 22:08:37 monarch_dodra wrote:
On Monday, 25 November 2013 at 21:04:43 UTC, Jesse Phillips
wrote:
On Monday, 25 November 2013 at 19:38:44 UTC, Jack Applegame
wrote:
This isn't compiles. Bug?
On 11/07/2013 10:05 PM, Philippe Sigaud wrote:
On Fri, Nov 8, 2013 at 5:55 AM, Ross Hays throwa...@email.net wrote:
And let me say that I really do like that this works in D. I can't imagine
doing anything like this in C++ (which is what I used primarily in the
past).
The only reason I joke
On 2013-11-26 01:27, Frustrated wrote:
I have some type of automatically generated interface using a mixin an
would like to extend them after they are generated:
mixin(GenerateMyInterface!(...));
... Here I would like to add some members/methods to MyInterface
which was generated
On Tuesday, 26 November 2013 at 06:40:24 UTC, Ali Çehreli wrote:
On 11/25/2013 09:11 PM, Frustrated wrote:
On Tuesday, 26 November 2013 at 05:03:45 UTC, Ali Çehreli
wrote:
On 11/25/2013 04:27 PM, Frustrated wrote:
I have some type of automatically generated interface using
a mixin an
would
On 25.11.2013 22:01, Frustrated wrote:
set PATH=D:\Dlang\dmd2\windows\\bin;C:\Program Files (x86)\Microsoft
SDKs\Windows\v7.0A\\\bin;%PATH%
set LIB=C:\Program Files (x86)\Windows Kits\8.1\Lib\win8\um\x86
echo. D:\DLang\Projects\Tests\RTest1\RTest1\Debug DMD
Win32\RTest1.build.lnkarg
echo
65 matches
Mail list logo