Vlad Levenfeld:
> but beware I've noticed that sometimes this is not
> equivalent to the previous version and I'm not sure how or why that happens.
> In particular I notice that
>
> mixin("const bool value = "~expr~";)");
> and
> const bool value = mixin(expr);
>
> are not the same, for some re
Kìtchèń Desìgners Hertfordsìre. Thirty €x Display K ìtcheńs To
Clear. W W W . è x d ì S p l a y K ì t C H è ń S 1 . c o . u k £
595 EAch wIth appliańcès.
aaand on further experimentation it turns out I don't need a
template at all, I can just overload it... strange, I seem to
remember not being able to do that before.
PS After reading your post I experimented with overloading
shared/unshared methods in my code and came up with this solution:
shared Id!Service id ()() const if (is (typeof(this) == shared)) {
return (cast(Service)this).id;
}
Id!Service id () const {
return service_id;
}
I like this better
I've recently found out that you can deal with the abundance of
backticks and escapes in a couple of ways:
q{ your code here... }
will resolve to a string but your editor can still highlight it
as D code, making it more readable.
also, turning things like:
mixin ("if ("~expr~")")
into:
if
On 05/09/2014 02:51 PM, Joshua Niehus via Digitalmars-d-learn wrote:
Hi Charles,
would the following work (just a shot in the dark) ?
//---
module test;
import std.stdio;
import std.concurrency;
void spawnedFuncFoo(Tid tid, Tid tidBar) {
receive(
(int i) {
writeln("
Phobos' std.getopt is a bit spare for my taste, as there is
no builtin general help facility with word-wrapping.
Does anyone have a recommendation on which of the existing
command line option parsing libraries floating around in the
wild to use? If it doesn't compile against the current
version
Let me see if I understand this right... let's say I have some
(unshared) class that launches threads to do its real work in.
class Foo {
this () {thread = spawn (&work);}
shared void work () {...};
void send_message (T) (T msg) {thread.send (msg);}
Tid thread;
}
It has an unshared meth
Try this;
import std.mmfile;
scope mmFile = new MmFile("T201212A.IDX");
TaqIdx* arr = cast(TaqIdx*)mmFile[0..mmFile.length].ptr;
for (ulong i = 0; i < mmFile.length/TaqIdx.sizeof; ++i)
{
// do something...
writeln(arr[i].symbol);
}
On Friday, 14 March 2014 at 18:00:58 UTC, TJB wrote:
On Friday, 9 May 2014 at 21:43:04 UTC, Trent Forkert wrote:
The way I've tackled that in my (still work-in-progress) CMake
fork[1] is to add an `include_directories(TEXT ...)` signature.
I like that, it seems clean.
Unfortunately, you'll need to build my CMake from source,
though that isn't
On Fri, 09 May 2014 17:45:37 -0400, Vlad Levenfeld
wrote:
Is there any way to declare a method as "safe regardless of
shared/mutability/etc" (or some other way to avoid
cast(Type)object.property every time I want to check a property which
won't affect any state)?
Not really for shared.
I mean I thought that's what "pure" was for but the compiler
complains all the same.
Hi Charles,
would the following work (just a shot in the dark) ?
//---
module test;
import std.stdio;
import std.concurrency;
void spawnedFuncFoo(Tid tid, Tid tidBar) {
receive(
(int i) {
writeln("Foo Received the number ", i);
send(tidBar, i, thisTid);
Is there any way to declare a method as "safe regardless of
shared/mutability/etc" (or some other way to avoid
cast(Type)object.property every time I want to check a property
which won't affect any state)?
Is this still the case if the method is const or pure?
On Fri, 09 May 2014 17:37:35 -0400, Vlad Levenfeld
wrote:
Error: non-shared const method is not callable using a shared mutable
object
Why not? If the method is const, it can't modify the object anyway.
Non-shared methods cannot be called on shared objects. Otherwise, you
could have un
On Friday, 9 May 2014 at 21:11:54 UTC, Chris Piker wrote:
On Monday, 24 March 2014 at 23:55:14 UTC, Dragos Carp wrote:
I moved cmaked2 to github [1], updated and simplified the
usage a little (system cmake patch not necessary anymore). You
can give
it a try. Dub registry support is also on the
Error: non-shared const method is not callable using a shared
mutable object
Why not? If the method is const, it can't modify the object
anyway.
On Monday, 24 March 2014 at 23:55:14 UTC, Dragos Carp wrote:
I moved cmaked2 to github [1], updated and simplified the usage
a little (system cmake patch not necessary anymore). You can
give
it a try. Dub registry support is also on the way.
Dragos
What is the best way to specify a mixin inc
The example code from core.sync.rwmutex seems bugged. After copying it
I added an import for core.sync.rwmutex, and moved the executions of
runTest into...well:
void main()
{runTest(ReadWriteMutex.Policy.PREFER_READERS);
runTest(ReadWriteMutex.Policy.PREFER_WRITERS);
}
Then I tried to
On Friday, 9 May 2014 at 16:26:22 UTC, Rene Zwanenburg wrote:
On Friday, 9 May 2014 at 15:52:51 UTC, John Colvin wrote:
On Friday, 9 May 2014 at 14:23:41 UTC, Luís Marques wrote:
If you have an array of structs, such as...
struct Foo
{
int x;
int y;
}
Foo[] foos;
..
On Friday, 9 May 2014 at 15:52:51 UTC, John Colvin wrote:
On Friday, 9 May 2014 at 14:23:41 UTC, Luís Marques wrote:
If you have an array of structs, such as...
struct Foo
{
int x;
int y;
}
Foo[] foos;
...and you wanted to sort the foos then you'd do something
flamencofantasy, thanx for that! Where do we vote here? =)
On Friday, 9 May 2014 at 14:56:21 UTC, flamencofantasy wrote:
One thing I hate about C# (which is what I use professionally)
is
the sync block index in every single class instance. Why not
have
the developer decide when he needs a Monitor and manually use
it?! I am disappointed D took the same
On Friday, 9 May 2014 at 14:23:41 UTC, Luís Marques wrote:
If you have an array of structs, such as...
struct Foo
{
int x;
int y;
}
Foo[] foos;
...and you wanted to sort the foos then you'd do something
like...
foos.sort!(a.x < b.x),
..and, of cou
On Friday, 9 May 2014 at 14:48:50 UTC, anonymous wrote:
std.range.zip(fooX, fooY).sort!((a, b) => a[0] < b[0]);
I wasn't sure if that's supposed to work. Turns out the
documentation on zip [1] has this exact use case as an example.
[1] http://dlang.org/phobos/std_range.html#zip
Ha! Awesome! S
One thing I hate about C# (which is what I use professionally) is
the sync block index in every single class instance. Why not have
the developer decide when he needs a Monitor and manually use
it?! I am disappointed D took the same route.
On Friday, 9 May 2014 at 14:23:41 UTC, Luís Marques wrote:
If you have an array of structs, such as...
struct Foo
{
int x;
int y;
}
Foo[] foos;
...and you wanted to sort the foos then you'd do something
like...
foos.sort!(a.x < b.x),
..and, of cou
If you have an array of structs, such as...
struct Foo
{
int x;
int y;
}
Foo[] foos;
...and you wanted to sort the foos then you'd do something like...
foos.sort!(a.x < b.x),
..and, of course, both of the fields x and y get sorted together.
If you ha
Trend Micro and Comodo have (from my limited experience) been pretty
good about dealing with false positives, so does anyone want to inform
them and the others as well?
On 5/8/14, sigod via Digitalmars-d-learn
wrote:
> On Friday, 9 May 2014 at 01:02:39 UTC, FrankLike wrote:
>> Hi,everyone,
>> dow
On Friday, 9 May 2014 at 12:19:12 UTC, John Colvin wrote:
On Friday, 9 May 2014 at 11:53:59 UTC, Stefan Frijters wrote:
I've been playing with UDAs a bit and I wanted to find all
variables with a particular attribute in various modules. I
thought I had it cracked, until I added a module that co
On Friday, 9 May 2014 at 11:53:59 UTC, Stefan Frijters wrote:
I've been playing with UDAs a bit and I wanted to find all
variables with a particular attribute in various modules. I
thought I had it cracked, until I added a module that contains
an alias declaration, which makes it choke when try
I've been playing with UDAs a bit and I wanted to find all
variables with a particular attribute in various modules. I
thought I had it cracked, until I added a module that contains an
alias declaration, which makes it choke when trying to execute
__traits(getAttributes, ...). A small example i
Imho, offtop, also i'm a C++/Obj-C guy and that might partially
explain my preferences, but here are some more reasons:
1. I like the concept of CT-reflection and CTFE a lot. This makes
metaprogramming extremely powerful without any RT overheads. It
brings a lot more control to what goes to RT.
Yuriy:
but I like D, and i strongly believe it's the next big language.
Oh, good. Do you want to briefly explain why? :)
Bye,
bearophile
35 matches
Mail list logo