On Sat, 02 Feb 2019 17:34:11 +, Eugene Wissner wrote:
> For creation get() should be always used, since it is the most
> convenient way to ensure that there is really only one instance of the
> singleton. Just make this() private, so only you can create new
> instances:
>
> private this()
> {
On Wed, 30 Jan 2019 12:56:06 -0800, Ali Çehreli wrote:
> I remember names like _add. Is that a Windows thing?
A number of functions are implemented as manually-mangled names with
preprocessor macros that forward to them. It's weird, but it happens.
On Wed, 30 Jan 2019 10:39:21 -0800, Ali Çehreli wrote:
> import core.demangle;
>
> extern(C) int add(int, int);
>
> void main() {
>alias F = typeof(add);
>pragma(msg, mangle!F("add"));
>pragma(msg, add.mangleof);
> }
>
> Output:
>
> _D3addUiiZi
> add <-- Is that
On Mon, 28 Jan 2019 16:59:22 +, Victor Porton wrote:
> Should I prefix all module names with `xmlboiler.` (where XML Boiler is
> the name of my program). These packages are expected to be used
> internally by my program, not as an exported API (however there are some
> little chances that in
On Mon, 28 Jan 2019 17:18:52 +, Victor Porton wrote:
> I want "ordered set" container (like list or vector but with the
> warranty of no duplicate elements).
>
> Which type can I use?
std.container.rbtree
It has options to preserve or squash duplicates.
On Fri, 25 Jan 2019 19:14:51 -0500, Steven Schveighoffer wrote:
> Interestingly, It's not possible to do the second form, so it's a bit
> curious why we don't just drop the requirements for nested
> parentheses...
The error messages there are really hideous, too:
template Just(alias s) { alias
On Fri, 25 Jan 2019 09:34:47 +, AndreasDavour wrote:
>auto point3 = getResponse!Point!int("What's the point? ");
This could be:
getResponse!(Point!int)
or:
(getResponse!Point)!int
D requires this to be disambiguated at the parsing stage, before the
compiler works out what
On Thu, 24 Jan 2019 01:35:57 +, Steven O wrote:
> Is there any documentation or examples of how to do that? The
> RedBlackTree documentation gives trivial examples like
You define a function implementing the "less" operation for a pair of
Tuple!(Address, int) (or whatever you have).
---
On Wed, 23 Jan 2019 15:19:06 +, Jacob Shtokolov wrote:
> I'm wondering, is that possible to declare multiple versions of
> opEquals() and evaluate them in the different places depending on return
> type?
I looked at this a while ago for similar reasons. It didn't pan out.
When you override
On Wed, 23 Jan 2019 15:56:15 +, Steven O wrote:
> Why am I not allowed to put Address types in tuples?
As always, it helps a lot to post the error message the compiler gave you.
The message is:
/usr/include/dmd/phobos/std/functional.d-mixin-215(215): Error: template
On Fri, 18 Jan 2019 22:53:23 +, Ali wrote:
> Hello. I am having an issue with the code below. the out put after
> compiling is this :
>
> Deprecation: foreach: loop index implicitly converted from size_t to
> uint
>
> the code is :
>
> auto available = new int[cast(uint) max - min];
>
On Fri, 18 Jan 2019 09:39:31 +, John Burton wrote:
> On Thursday, 17 January 2019 at 01:43:42 UTC, SrMordred wrote:
>
>> struct Config {
>> string title;
>> int width;
>> }
>>
>> struct Window {
>> this(Config config)
>
> It likely is a bad idea for a small struct like this
On Fri, 18 Jan 2019 10:07:41 -0500, Steven Schveighoffer wrote:
> But what is the common interface between those 2 types? Even in
> Dcollections, where RedBlackTree came from, there was no interfaces that
> didn't specify the type they were dealing with. In other words, there is
> no common
On Thu, 17 Jan 2019 02:21:21 +, Steven O wrote:
> I want to create a heterogeneous collection of red-black trees, and I
> can't seem to figure out if it's possible.
RedBlackTree!int and RedBlackTree!string are entirely different types
(they just happen to be generated from the same
On Wed, 16 Jan 2019 21:07:24 +, Victor Porton wrote:
> What is the rule for unittest which uses a file (containing example data
> for testing) available only in the source distribution, not in binary
> distribution?
>
> I am writing a library.
The easy way of doing things is to define a
On Wed, 16 Jan 2019 12:01:06 -0500, Steven Schveighoffer wrote:
> It was 2.068 that removed the HiddenFuncError, and made this a compile
> error instead. If your compiler is that or newer, definitely file a bug
> report.
Oh god, that must have been awful. I'm glad we're no longer in those
On Mon, 14 Jan 2019 22:52:48 +, Chris Bare wrote:
> auto start = new TextIter();
> auto end = new TextIter();
You shouldn't need to new these. `out` means that the function is going to
overwrite the variables.
Other than that, I'm not sure.
On Mon, 14 Jan 2019 09:10:39 +, Vijay Nayar wrote:
> a.foo(1); // issues runtime error (instead of calling
> A.foo(int))
Calling the function doesn't issue any sort of error. Overriding one
overload without overloading or explicitly aliasing in the rest issues a
compile-time error.
On Sat, 12 Jan 2019 12:10:25 +, Droggl wrote:
> 2. Is there a way to get a certain git-version (eg. commit or maybe even
> just "latest") for a package in dub?
git submodule and path-based dependencies, if you need a particular
version.
> 3. How is everyone in general using curses with D?
On Fri, 11 Jan 2019 17:25:29 +, Enjoys Math wrote:
> Package peggged not found for registry at https://code.dlang.org/
The package name is pegged, not peggged. Two g's, not three.
On Sun, 06 Jan 2019 20:19:59 +, Rubn wrote:
> You can declare functions inside of functions in D. You weren't forward
> declare grow() in the module namespace, so much as you were forward
> declaring a new function grow.
Unfortunately, you can't do forward declarations for nested functions.
On Sat, 05 Jan 2019 17:44:27 +, Neia Neutuladh wrote:
> 2. Different build configurations. The same source code has two
> different build targets; the executable doesn't depend on the library.
> Or, with enough bludgeoning, you can make the executable depend on the
> library.
Hit 'send' too
On Sat, 05 Jan 2019 13:01:24 +, Russel Winder wrote:
> Dub seems to have the inbuilt assumption that libraries are dependencies
> that do not change except via a formal release when you developing an
> application.
> Clearly there is the workflow where you want to amend the library but
> not
On Fri, 04 Jan 2019 08:46:24 +, Alex wrote:
> Let's assume this is right. How to force a B object to behave like an A
> object? I thought casting is a possible approach...
It requires a bit of surgery:
import std.stdio;
class A
{
void foo() { writeln("hello from A!"); }
On Fri, 04 Jan 2019 00:19:05 +, Alex wrote:
> B.foo overrides A.foo. By casting a B object to be an A object, A's
> behavior should be granted, shouldn't it?
I can't think of a single class system that works like that. C++, Java,
C#, Dart, and TypeScript all work like D here. GObject in C
On Thu, 03 Jan 2019 23:44:15 +, Alex wrote:
> I assume that is another bug and has nothing to do with interfaces...
B.foo is both overriding A.foo and implementing D.foo, so that's not a bug.
On Thu, 03 Jan 2019 22:30:48 +, kdevel wrote:
> class A : D {
> int foo() { return 1; }
> }
>
> class B : A, D {
> [...]
>
> What is the meaning of the ", D"? It does not seem to make a difference
> if it is omitted.
B must provide its own implementation of D. It can't simply use A's
On Thu, 03 Jan 2019 20:34:17 +, Machine Code wrote:
> Thank you very much, Ali. So the issue was basically I can't return from
> a static foreach() loop right?
The static foreach is done at compile time and the return is done at
runtime.
After the template is expanded, your code ends up
On Tue, 01 Jan 2019 14:05:43 +, Victor Porton wrote:
> In Ada2012 there are "subtypes". Subtypes can have tighter constraints
> (such as type invariants) than their base types.
>
> I have a struct X in D. Is it possible to define a type equivalent to X
> except that having tighter invariants?
On Tue, 01 Jan 2019 14:46:15 +, Ron Tarrant wrote:
> I've found a ton of syntax highlighter plugins for WordPress, but none
> that admit to supporting D. Anyone know of one?
I believe I use Enlighter for that:
https://wordpress.org/plugins/enlighter/
On Sun, 30 Dec 2018 05:36:41 +, Enjoys Math wrote:
> Is it:
>
> typeof(T).getHash()?
This gets the hashcode for the object by calling toHash() on it.
> Or does that do something other than just get the address?
It XORs the address with a bitwise rotation of the address. This reduces
On Tue, 25 Dec 2018 18:34:04 +, bauss wrote:
> I think there is a bigger problem at stake here in terms of software
> architecture.
>
> What's the point needed for them to have the same identifier?
A probably abstract base class with only one child class. Normally you
have "Foo" and
1. Find the Thread object:
Tid threadId = spawn();
auto thread = Thread.getAll.filter!(x => x.id == threadId).front;
2. Check the `isRunning` property.
The indirection with spawn() is awkward.
On Tue, 25 Dec 2018 16:55:36 +, Neia Neutuladh wrote:
And I forgot part of it.
Let's say we did the work to make this function:
class X {}
template X(int N)
{
// `: X` somehow refers to the X in the outer scope
class X : X {}
}
How do you distinguish between the
On Tue, 25 Dec 2018 13:03:13 +, Michelle Long wrote:
> But I am not talking about inside the template being used. The whole
> point of doing this is so that one can refer to the base class using the
> same name as the derived with a template parameter to make a composite
> structure.
The
On Mon, 24 Dec 2018 08:16:01 -0800, H. S. Teoh wrote:
> Rather, it's *conventionally* taken to mean "unused". The language
> actually does not treat it in any special way apart from "normal"
> identifiers. It's perfectly valid (though probably not recommended!) to
> declare functions or
On Sat, 22 Dec 2018 21:33:14 +, Dru wrote:
> The first example shows that it is possible to deprecate a function
> separately from it's definition.
No, it doesn't. You declared two *different* functions. One was
deprecated; the other wasn't.
> I want to know if it is possible to "fix" the
On Sat, 22 Dec 2018 18:55:47 +, Dru wrote:
> I would like to use "deprecated" on a member function, but do it from a
> separate file
>
> this works:
> ///
> void func() {}
>
> deprecated {
>void func();
> }
You're defining two functions, presumably in two different modules and
with two
On Fri, 21 Dec 2018 10:56:39 +, Atila Neves wrote:
> I don't see how you can do this with dub, and I wouldn't attempt it
> either. Just use make, and have make call dub for the main project (and
> potentially any plugins that need it). Remember to make the dub targets
> `.PHONY` since you
On Wed, 19 Dec 2018 15:12:14 +, bauss wrote:
> That's assuming that it's compile-time data though.
>
> If not then you can't do what you want to do.
>
> What you can do is wrap it in a function in the mixin template which you
> just call after instantiating it.
Or while instantiating it:
On Wed, 19 Dec 2018 12:57:14 +, Codifies wrote:
> I could do this with a few simple rules in a Makefile, but I have no
> clue how to achieve this using dub.
If you need dub, you can create a wrapper script that generates the dub
file for the plugins directory.
Make is a lot better for this
On Mon, 17 Dec 2018 22:20:54 +, harfel wrote:
> I am looking for a way to serialize/deserialize the state of the
> std.random.Random number generator, ideally using orange
> (https://github.com/jacob-carlborg/orange) or another serialization
> library. From looking at the module source code, I
On Sat, 15 Dec 2018 17:19:05 +, Timoses wrote:
> Running `dub test` will output:
> Running ./unit-test-library writeln: unittest All unit tests have been
> run successfully.
>
> Why is the `shared static this()` not executed?
Run `dub clean; dub test -v` and you'll see that main.d isn't
On Sat, 15 Dec 2018 13:49:03 +, Heromyth wrote:
> Yes, it's very dangerous to create a new thread in shared static this().
> For a big project, it sometimes hard to identify this problem. Maybe,
> the compiler should do something for this, should it?
The runtime, more likely. There are plenty
On Sat, 15 Dec 2018 02:54:55 +, Heromyth wrote:
> shared static this() {
> writeln("running A in shared static this(),
> sharedField=", sharedField);
>
> Thread th = new Thread(() { });
> th.start();
When you start a D thread, thread-local static constructors
On Fri, 14 Dec 2018 00:16:51 +, Michelle Long wrote:
> byte x = 0xF;
> ulong y = x >> 60;
"Error: shift by 60 is outside the range 0..31"
This is the result of integer promotion rules. Change the 30 to a 60 and
it works, and the result is, as you would expect, 0.
> I thought D required
On Mon, 10 Dec 2018 17:58:32 +, aliak wrote:
> string parseConfig(string str) {
>string ret;
>foreach (line; str.split("\n")) {
> auto parts = line.split("=");
> ret ~= `string ` ~ parts[0] ~ ` = "` parts[2] `";`;
>}
>return ret;
> }
That works as long as none of the
On Mon, 10 Dec 2018 11:08:23 +, Narxa wrote:
> Hello, people!
>
> I would like to have a constant with the value of some environment
> variable that is defined at compile time.
In your build script, echo the environment variable into a file. Then
import() that file and use the value.
> I
On Sat, 08 Dec 2018 20:16:09 +, Andrew Pennebaker wrote:
> I think it's lame to have to use magical code like `version(unittest) {}
> else` to guard our main functions, when we run unit tests. Could D go
> ahead and do the right thing, automatically shadowing our main functions
> when the unit
On Thu, 06 Dec 2018 22:50:49 +, albertas-jn wrote:
> If templates are a compile-time feature and instances of templates are
> generated by compiler at compile time, why is it possible to compile a
> template definition with dmd -lib or -c?
You compile files, not individual declarations like a
On Fri, 07 Dec 2018 02:37:34 +, Arun Chandrasekaran wrote:
> I'm trying to get the current function name and apparently the commented
> line errors out.
>
> What am I doing wrong?
Referring to nested functions is weird.
Dotted identifiers let you traverse aggregates. Modules, C++ namespaces
On Mon, 03 Dec 2018 21:27:52 +, faissaloo wrote:
> Then shouldn't the following output false, false, true?
An object reference is a pointer value. The pointer values are copied. The
pointed-at objects are not copied.
Furthermore, the syntax
Object[6] array = new Object();
only
On Fri, 30 Nov 2018 22:10:11 +, ikod wrote:
> Thanks for explanation, got it.
>
> My case is actually
>
> interface I(K,V)
> {
> int get()(K);
> }
Interface functions must be abstract. Templated functions are implicitly
final. Final things can't be abstract.
If there's something
On Fri, 30 Nov 2018 20:41:03 +, ikod wrote:
> I can't find the reason why nogc/nothrow can't be inferred in this case:
>
> class S(K,V)
> {
> auto get/*()*/(K a) {
> return 0;
> }
> }
> void main() @nogc nothrow {
> S!(int, string) sia;
> auto v = sia.get(1);
> }
On Thu, 29 Nov 2018 21:11:06 +, John Chapman wrote:
> Is there any way to get a string representing a function's exact
> signature as declared in the source? I can generate it myself using
> reflection but it might not be 100% verbatim so wanted to know if
> there's anything built in?
>
>
On Tue, 27 Nov 2018 18:22:17 +, PacMan wrote:
> I've been looking for a function or library to parse a date in a custom
> format (for validation) similar to C#'s [1]
> TryParseExactbut I couldn't find any. so far I only found
> fromISOExtString(), and fromSimpleString() which doesn't allow me
On Tue, 27 Nov 2018 02:00:44 +, PacMan wrote:
> f is defined as:
>
>> void f(T)(T t, string p)
>> if(is(T == A) || is(T == B))
>>{
>> // ...
>>}
>
> my goal is get "p" as string.
`f` is a template that generates functions. Before you instantiate that
template, the function doesn't
On Sun, 25 Nov 2018 20:46:28 +, Tony wrote:
> From std.compiler.D_major and std.compiler.D_minor I see that my D
> language version is at 2.0 . But the version of gdc front-end I am using
> (via Debian default gdc package as of a few months ago) from
> std.compiler.version_major and
Easiest way is to put this in your build script:
find path/to/package -name '*.d' | \
xargs grep '^module ' | \
sed 's,^module,import,' \
> data/modules.d
Add `-J data` to your DMD command line, or add `"stringImportPaths":
["data"]` to dub.json.
Then in your file:
On Fri, 23 Nov 2018 21:43:01 -0700, Jonathan M Davis wrote:
> A solution like that might work reasonably well, but you still
> have the problem of what to do when a symbol is documented in multiple
> version blocks, and having almost all the documentation in one version
> block and a few pieces of
On Fri, 23 Nov 2018 17:21:25 -0800, H. S. Teoh wrote:
> Ddoc may have its stink points, but in this case, the stuff inside
> version(Windows) blocks simply isn't compiled, so you can't expect ddoc
> to do much about it. You can't just arbitrarily ddoc everything inside
> version blocks, because
On Thu, 22 Nov 2018 15:50:01 +, Stefan Koch wrote:
> I'd say the problem here is not just false positives, but false
> negatives!
False negatives are a small problem. The compiler fails to catch some
errors some of the time, and that's not surprising. False positives are
highly vexing
On Wed, 21 Nov 2018 20:15:42 +, welkam wrote:
> In D classes are reference type and unless you mark them as final they
> will have vtable.
Even if you mark your class as final, it has a vtable because it inherits
from Object, which has virtual functions. The ProtoObject proposal is for a
On Wed, 21 Nov 2018 17:00:29 +, Alex wrote:
> C# wouldn't reject the case above, would it?
C# *would* reject that (you can't call any methods on a null object), but
in D, it compiles and runs and doesn't segfault.
On Tue, 20 Nov 2018 23:14:27 +, Johan Engelen wrote:
> When you don't call `a.foo()` a dereference, you basically say that
> `this` is allowed to be `null` inside a class member function. (and then
> it'd have to be normal to do `if (this) ...` inside class member
> functions...)
That's what
On Tue, 20 Nov 2018 15:29:50 +, Kagamin wrote:
> On Tuesday, 20 November 2018 at 11:11:43 UTC, aliak wrote:
>> This only applies to little scripts and unittests maybe.
>>
>> Not when you're writing any kind of relatively larger application that
>> involves being run for longer or if there's
On Tue, 20 Nov 2018 00:30:44 +, Jordi Gutiérrez Hermoso wrote:
> On Monday, 19 November 2018 at 21:57:11 UTC, Neia Neutuladh wrote:
>
>> Programmers coming from nearly any language other than C++ would find
>> it expected and intuitive that declaring a class instance variable
>> leaves it
On Mon, 19 Nov 2018 14:32:55 -0800, H. S. Teoh wrote:
>> Standard caveats about byte order and alignment.
>
> Alignment shouldn't be a problem, since local variables should already
> be properly aligned.
Right, and the IO layer probably doesn't need to read to aligned memory
anyway.
Struct
On Mon, 19 Nov 2018 21:30:36 +, welkam wrote:
> So my question is in subject/title. I want to parse binary file into D
> structs and cant really find any good way of doing it. What I try to do
> now is something like this
>
> byte[4] fake_integer;
> auto fd = File("binary.data", "r");
>
On Mon, 19 Nov 2018 21:23:31 +, Jordi Gutiérrez Hermoso wrote:
> When I was first playing with D, I managed to create a segfault by doing
> `SomeClass c;` and then trying do something with the object I thought I
> had default-created, by analogy with C++ syntax. Seasoned D programmers
> will
On Sun, 18 Nov 2018 17:47:07 +, Vladimirs Nordholm wrote:
> Is there anyway to make it "neater"? Maybe something in one line:
>
> enum foo = version (Posix) { "posix" } : { "other" } ;
If you're doing it often:
T ifPosix(T)(T a, T b)
{
version (Posix) return a; else return b;
}
enum
On Sat, 17 Nov 2018 21:16:13 +, aliak wrote:
> Could do. But it's not scalable. I'd have to comment out all the
> unittests that call the template function with a T that allocates inside
> the @nogc template (if I understood you correctly that it)
I meant something like:
void
On Sat, 17 Nov 2018 17:58:54 +, John Chapman wrote:
> The idea is that users could type (for example) makeWith!`Calendar`(…)
> instead of the longer makeWith!ICalendarFactory(…).
Your project might define a hundred types named ICalendarFactory; the
compiler can't figure out which one you're
On Sat, 17 Nov 2018 13:55:24 +, aliak wrote:
> You can use "debug blah" to hide inside functions that are attributed,
> but when you have an attributed function that calls a template,
> attribtues of which are supposed to be inferred, it seems to fail.
You can explicitly mark a templated
On Wed, 14 Nov 2018 19:28:44 +, WebFreak001 wrote:
> It's a real pain that you can't select specific commits in dub, but I
> try to keep up with the updates and make them work somehow.
Yeah, I've used submodules and path-based dependencies once or twice
because of that. It's not the best.
On Sat, 10 Nov 2018 16:25:40 +, Stanislav Blinov wrote:
> Yep, you just over-simplified the first case.
It is too simple to clearly illustrate why the code is invalid, but not so
simple that the compiler accepts that code.
> Consider:
>
> int* p;
> {
> int i;
> p =
> }
> *p =
On Sat, 10 Nov 2018 11:47:24 +, Nicholas Wilson wrote:
> On Saturday, 10 November 2018 at 06:56:29 UTC, Neia Neutuladh wrote:
>> Is this right?
>
> Are you sure you added @safe to the second example?
> https://run.dlang.io/is/2RbOwK fails to compile.
Maybe take another look at the post
The following code doesn't work with @safe -dip1000:
int* p;
int i;
p =
i has a shorter lifetime than p, the compiler complains.
But this code does:
int i;
int* p;
p =
In both cases, p can't point to i before i exists, and p ceases to exist
when i ceases to exist.
On Fri, 09 Nov 2018 02:03:36 +, Chris Katko wrote:
> Simple curious question.
>
> Why isn't :
>
> import std.stdio;
>
> instead:
>
> import std.io;
IO includes things like memory mapping, sockets, listing files, named
pipes, that sort of thing.
Standard IO includes only reading and
On Thu, 08 Nov 2018 17:27:40 -0700, Jonathan M Davis wrote:
> You ran into one of the rare cases where it makes sense catch an Error
> or a Throwable, and you're one of the few people who understands the
> situation well enough to deal with it properly. The vast majority of D
> programmers don't.
On Thu, 08 Nov 2018 11:04:19 +, Sjoerd Nijboer wrote:
> I'm trying to invert the dependency from the classes `Bar -> Foo` to
> `Foo -> IFoo <- Bar` at compile time.
>
> I do want `Foo's` to be embedded into `Bar`
These goals are a *little* at odds with each other; having a scoped!Foo
puts
On Thu, 08 Nov 2018 12:45:57 +, Alex wrote:
> Hmm... not sure, if I got your idea... Do you think about something like
> this?
The point is dependency inversion. The class shouldn't need to know how to
build its dependencies; it should leave that to other code. The fact that
you can use the
On Tue, 06 Nov 2018 00:33:56 +, MatheusBN wrote:
> Just to be clear, when you say "x exists at the label Q", you mean at
> the same scope, right?
The same or an outer scope. It's also invalid to write:
goto Y;
{
int x;
{
Y:
}
}
> That's interesting but a bit confusing isn't?
>
>
On Fri, 02 Nov 2018 04:01:00 +, Nicholas Wilson wrote:
> By noting that all (interesting for the purpose of UDA's i.e. not void)
> types have a .init
>
> or you could do
>
> static if (is(typeof(uda) == Foo) || is(uda == Foo))
Which, again, only tests for presence, when I want to check for
On Fri, 02 Nov 2018 00:36:18 +, Nicholas Wilson wrote:
>> What do you do to handle this?
>
> @Foo() int bar;
>
> instead of
>
> @Foo int bar;
Right. And if you're offering a library with UDAs for other people to use?
On Thu, 01 Nov 2018 23:59:26 +, kerdemdemir wrote:
> I am doing trading and super scared of suprices like mathematical errors
> during the multiplications(or division 1/tickSize) since market will
> reject my orders even if there is a small mistake.
>
> Is this safe? Or is there a better way
On Thu, 01 Nov 2018 20:01:51 +, Stanislav Blinov wrote:
> Check if an UDA is a type?.. As in, not just `is(uda == Foo)`,
> but simply `is(uda)`:
Which works, but generally makes things more complex in code that's
already pretty deeply nested. It's also something I have to worry about
every
On Thu, 01 Nov 2018 11:35:27 -0700, Ali Çehreli wrote:
> On 11/01/2018 09:14 AM, Neia Neutuladh wrote:
>> The spec says that a user-defined attribute must be an expression, but
>> DMD accepts a wide range of things as UDAs:
>>
>>struct Foo { string name = "unknown"; }
>>@Foo int bar;
>>
The spec says that a user-defined attribute must be an expression, but DMD
accepts a wide range of things as UDAs:
struct Foo { string name = "unknown"; }
@Foo int bar;
`bar` has the *type* Foo as an attribute. It's not an *instance* of Foo.
So if I try to look at the UDAs:
static
On Sun, 28 Oct 2018 18:00:06 +, Stanislav Blinov wrote:
> On Sunday, 28 October 2018 at 12:38:12 UTC, ikod wrote:
>
>> and object.opEquals(a,b) do not inherits safety from class C
>> properties, and also I can't override it.
>
> Yep. Since Object is the base class and it defines opEquals
targetType "executable" does it for me (dub 1.11.0).
Can you post your full dub.sdl?
On 10/10/2018 04:03 PM, James Japherson wrote:> Says that it cannot
interpret X(the class that contains the static> opApply).
It's a bit hard to diagnose the problem you're getting using that
function when we don't have the code that uses it. Or the context that's
referenced with the foreach
On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko wrote:
All I want to do is loop from 0 to [constant] with a for or
foreach, and have it split up across however many cores I have.
You're looking at std.parallelism.TaskPool, especially the amap
and reduce functions. Should do pretty
On Sunday, 16 September 2018 at 16:28:20 UTC, Per Nordlöw wrote:
If I have
alias N = Nullable!(T, T nullValue)
fed as template parameter to another template how can I
at compile-time get the `nullValue` ?
import std.traits;
enum nullValue = TemplateArgsOf!(N)[1];
On Wednesday, 12 September 2018 at 23:41:16 UTC, James Blachly
wrote:
When I add the "shared" attribute to an array, I am no longer
able to call reserve because the template won't instantiate:
Error: template object.reserve cannot deduce function from
argument types !()(shared(int[]), int),
On Monday, 3 September 2018 at 03:04:57 UTC, Chris Katko wrote:
This should be simple? All I want to do is load an entire file,
and access individual bytes. The entire thing. I don't want to
have know the file size before hand, or "guess" and have a
"maximum size" buffer.
So far, all google
On Friday, 31 August 2018 at 07:38:54 UTC, Marcin wrote:
https://github.com/dlang/dmd/blob/master/samples/listener.d
Can some one add more comment to that example?
I need to make code that connects to local application, very
similar to this.
Assumptions:
1. Create an application that
On Friday, 31 August 2018 at 06:20:09 UTC, James Blachly wrote:
Hi all,
I am linking to a C library which defines a symbol,
const char seq_nt16_str[] = "=ACMGRSVTWYHKDBN";
In the C sources, this is an array of 16 bytes (17 I guess,
because it is written as a string).
In the C headers, it
On Sunday, 19 August 2018 at 18:32:17 UTC, QueenSvetlana wrote:
In the D Style Guide, it says:
Properties
https://dlang.org/dstyle.html#properties
Functions should be property functions whenever appropriate. In
particular, getters and setters should generally be avoided in
favor of property
On Friday, 3 August 2018 at 19:41:32 UTC, Bastiaan Veelo wrote:
But if you commit it, and a compiler deprecation causes a
dependency in that pinned version to fail to compile, then your
app won't compile either, even though your code itself does not
suffer from the deprecation and even though
1 - 100 of 129 matches
Mail list logo