On Wed, Jun 07, 2017 at 06:24:22PM +, ade90036 via Digitalmars-d-learn
wrote:
> On Monday, 5 June 2017 at 16:30:53 UTC, Era Scarecrow wrote:
> > On Monday, 5 June 2017 at 16:04:28 UTC, ade90036 wrote:
> >
> > > Unfortunately the struct doesn't know at compile time what the
> > > size of the
On Wed, Jun 07, 2017 at 01:17:39PM +, Nicholas Wilson via
Digitalmars-d-learn wrote:
> On Wednesday, 7 June 2017 at 12:39:07 UTC, Russel Winder wrote:
> > Are there any idiom rules as to where to put import statements in D?
> >
> > In Python they can go anywhere but PEP-8 suggests they
On Mon, Jun 05, 2017 at 05:34:14AM +, Basile B. via Digitalmars-d-learn
wrote:
> On Monday, 5 June 2017 at 01:07:51 UTC, H. S. Teoh wrote:
> >
> > It can't be any more trivial than just running ddemangle, which is
> > found in the dlang/tools repo on github.
[...]
> > (Arguably this should
On Mon, Jun 05, 2017 at 01:23:22AM +, Mike B Johnson via
Digitalmars-d-learn wrote:
> On Monday, 3 October 2016 at 09:21:37 UTC, Jonathan M Davis wrote:
> > [...]
>
> Is this bug ever going to be fixed?
>
> I can't do
>
> enum X : Y
> {
>a = 1
> }
>
> because 1 is not implicitly
On Sun, Jun 04, 2017 at 06:12:42PM -0700, H. S. Teoh wrote:
> On Mon, Jun 05, 2017 at 01:14:31AM +, Mike B Johnson via
> Digitalmars-d-learn wrote:
> [...]
> > Guid is a struct and I am trying to get the "bytes" of the struct" to
> > get the guid bytes. It is quicker than accessing all the
On Mon, Jun 05, 2017 at 01:14:31AM +, Mike B Johnson via
Digitalmars-d-learn wrote:
[...]
> Guid is a struct and I am trying to get the "bytes" of the struct" to
> get the guid bytes. It is quicker than accessing all the elements one
> at a time.
union U {
On Sun, Jun 04, 2017 at 07:24:17PM +, Basile B. via Digitalmars-d-learn
wrote:
[...]
> you have to pipe the output to ddemangle.
Here's the output:
> > #0 0x7fffc770 in ?? ()
> > #1 0x77bb3d80 in dvb_scan_transponder () from
> > /usr/lib/x86_64-linux-gnu/libdvbv5.so.0
> >
On Sun, Jun 04, 2017 at 12:45:23AM +, Stanislav Blinov via
Digitalmars-d-learn wrote:
[...]
> No, it shouldn't. char* et al. are not string types in D.
> to!(char*)(string) just doesn't make sense.
If you need to convert between D strings and char*, wchar*, etc., e.g.,
for interfacing with
On Sat, Jun 03, 2017 at 10:38:31PM +, Mark via Digitalmars-d-learn wrote:
[...]
> Ok. So by using '==' it should compare the addresses of the objects?
[...]
No, `==` is for comparing the *contents* of the objects. You need to
implement opEquals() for the objects being compared in order to
On Fri, Jun 02, 2017 at 11:05:43PM +, Mark via Digitalmars-d-learn wrote:
[...]
> Stefan, what do you mean that it must be a template?
>
> Am I supposed to write template Struct(T) { class Stack { ... } }?
No, he means to turn class Stack into a template by adding a template
parameter to it,
On Fri, Jun 02, 2017 at 10:21:07PM +, Mark via Digitalmars-d-learn wrote:
> Hello,
>
> I am trying to make a class that can accept any type as an argument.
>
> Here is the class:
>
>
> import std.container: SList;
>
>
> class Stack {
>
> private SList!T list;
> private int _size;
>
On Fri, Jun 02, 2017 at 05:22:20PM +, Stefan Koch via Digitalmars-d-learn
wrote:
> On Friday, 2 June 2017 at 16:13:03 UTC, Laeeth Isharc wrote:
> > On Friday, 2 June 2017 at 02:06:27 UTC, Mike B Johnson wrote:
> > > [...]
> >
> > Stefan Koch has written a good part of an interpreter for D
On Thu, Jun 01, 2017 at 08:39:07AM +0100, Russel Winder via Digitalmars-d-learn
wrote:
> On Wed, 2017-05-31 at 16:37 -0700, H. S. Teoh via Digitalmars-d-learn
> wrote:
> >
> […]
> > With D, we can have the cake and eat it too. The understandable /
> > naïve impl
On Fri, Jun 02, 2017 at 12:19:48PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Friday, 2 June 2017 at 11:09:05 UTC, aberba wrote:
> > 1. Get shared libs to work in D (the best approach for all D code)
>
> I have done very little with this myself but other people have so it is
>
On Wed, May 31, 2017 at 12:13:04PM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
> On Tue, May 30, 2017 at 05:13:46PM -0700, Ali Çehreli via Digitalmars-d-learn
> wrote:
> [...]
> > I could not make the D program come close to wc's performance when the
> > data
On Wed, May 31, 2017 at 10:05:50PM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Thursday, June 01, 2017 04:52:40 Patrick Schluter via Digitalmars-d-learn
[...]
> > See my link above to realdworldtech. Using SIMD can give good
> > results in micro-benchmarks but completely screw up
On Thu, Jun 01, 2017 at 12:20:53AM +0100, Russel Winder via Digitalmars-d-learn
wrote:
[...]
> However, I note here that the Chapel folk are taking a quite
> interesting view of algorithm implementation in the Benchmarks Game.
> They are totally eschewing "heroic implementations" such as all the
On Wed, May 31, 2017 at 03:46:17PM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Wednesday, May 31, 2017 12:13:04 H. S. Teoh via Digitalmars-d-learn
> wrote:
> > I did some digging around, and it seems that wc is using glibc's
> > memchr, which is highly-
On Tue, May 30, 2017 at 05:13:46PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
[...]
> I could not make the D program come close to wc's performance when the
> data was piped from stdin.
[...]
Hmm. This is a particularly interesting case, because I adapted some of
my algorithms to handle
P.S. After I posted the code, I took a closer look at the disassembly
and found that gdc wasn't generating the best code for the parallel
foreach loop body. I haven't fully traced the cause yet, but I did find
a simple optimization (arguably a micro-optimization): updating the
subtotal inside the
On Tue, May 30, 2017 at 08:02:38PM +, Nitram via Digitalmars-d-learn wrote:
> After reading
> https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i
> was wondering how fast one can do a simple "wc -l" in D.
>
> So i made a couple short implementations and found myself
On Tue, May 30, 2017 at 11:10:19AM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
[...]
> Yeah, basically, D's pure was originally what is now sometimes called
> "strongly pure," which is quite close to functionally pure in that the
> same input results in the same output (it still allows
On Tue, May 30, 2017 at 05:57:04PM +, Lyle via Digitalmars-d-learn wrote:
> Hi,
>
> I have an associative array of type int[ulong] and I'm trying to get
> the index of the maximum value, like this:
>
> int[ulong] aa = [1UL: 2000,
> 2UL: 5000,
> 5UL: 1000];
>
On Fri, May 26, 2017 at 06:06:42PM +, Mike B Johnson via
Digitalmars-d-learn wrote:
> On Friday, 26 May 2017 at 14:05:34 UTC, ag0aep6g wrote:
> > On 05/26/2017 10:15 AM, realhet wrote:
> > > But hey, the GC knows that is should not search for any pointers
> > > in those large blocks. And the
On Wed, May 17, 2017 at 07:56:52PM +, Per Nordlöw via Digitalmars-d-learn
wrote:
> On Tuesday, 16 May 2017 at 10:57:08 UTC, FreeSlave wrote:
> >
> > Not sure about renaming but copying is not atomic on Posix because
> > it does not handle interruption by signal. I opened issue about that
> >
On Tue, May 16, 2017 at 08:06:13AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
> On Tue, May 16, 2017 at 06:56:57AM -0700, Jonathan M Davis via
> Digitalmars-d-learn wrote:
> > On Tuesday, May 16, 2017 11:19:14 bachmeier via Digitalmars-d-learn wrote:
> > > On Monday,
On Tue, May 16, 2017 at 06:56:57AM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Tuesday, May 16, 2017 11:19:14 bachmeier via Digitalmars-d-learn wrote:
> > On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote:
> > > I suppose that we could add a tempFile that did what
> >
On Sat, May 13, 2017 at 12:39:43PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 5/12/17 5:46 PM, H. S. Teoh via Digitalmars-d-learn wrote:
[...]
> > This advice, unfortunately, needs to be tempered with caution about
> > namespace pollution and accidental depen
On Fri, May 12, 2017 at 05:23:23PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
[...]
> Note, you can achieve what you want with version(unittest):
>
> version(unittest)
> {
>class A { B b; }
>class B { }
> }
>
> unittest
> {
>// use A and B here
> }
[...]
This
On Fri, May 12, 2017 at 12:47:04PM +0200, ag0aep6g via Digitalmars-d-learn
wrote:
> On 05/12/2017 10:32 AM, k-five wrote:
> > Interesting! I was worried about performance and for that I did not
> > want to use try-catch.
> > So (isNumberic) is a good solution.
> >
On Wed, May 10, 2017 at 11:40:08PM +, Jesse Phillips via
Digitalmars-d-learn wrote:
[...]
> H.S. Teoh mentioned fastcsv but requires all the data to be in memory.
Or you could use std.mmfile. But if it's decompressed data, then it
would still need to be small enough to fit in memory. Well,
On Thu, May 11, 2017 at 05:55:03PM +, k-five via Digitalmars-d-learn wrote:
> On Thursday, 11 May 2017 at 17:18:37 UTC, crimaniak wrote:
> > On Wednesday, 10 May 2017 at 12:40:41 UTC, k-five wrote:
> -
> > try this:
> >
On Wed, May 10, 2017 at 11:17:44PM +, Nicholas Wilson via
Digitalmars-d-learn wrote:
> On Wednesday, 10 May 2017 at 22:20:52 UTC, Nordlöw wrote:
> > What's fastest way to on-the-fly-decompress and process a gzipped
> > csv-fil line by line?
> >
> > Is it possible to combine
> >
> >
On Wed, May 03, 2017 at 08:24:31PM +0200, ag0aep6g via Digitalmars-d-learn
wrote:
> On 05/03/2017 08:04 PM, H. S. Teoh via Digitalmars-d-learn wrote:
> > You only need a common interface if you wish to do something more
> > with Box!X instantiations that's common across all Boxes
On Wed, May 03, 2017 at 08:04:20PM +0200, ag0aep6g via Digitalmars-d-learn
wrote:
> On 05/03/2017 07:26 PM, Nothing wrote:
[...]
> > So is there an idiomatic approach to know if the Object is an
> > instance of Box (regardless of content type T) and than if necessary
> > to know exactly if two
On Wed, May 03, 2017 at 05:26:27PM +, Nothing via Digitalmars-d-learn wrote:
> Hi, Honestly I am new to D and templates system so excuse me if my
> question will seem trivial.
>
> I want to develop a generic Box(T) class that can be either empty or
> hold a value of arbitrary type T.
Have a
On Tue, May 02, 2017 at 02:37:20PM +, ANtlord via Digitalmars-d-learn wrote:
> On Tuesday, 2 May 2017 at 12:41:01 UTC, Jacob Carlborg wrote:
> >
> > Note that when declared as "enum", all places it's referenced, a new
> > associative array will be allocated.
>
> If it is allocated at all
On Fri, Apr 28, 2017 at 04:42:28PM +, via Digitalmars-d-learn wrote:
[...]
> writefln(text("%.", i, "f"), x);
[...]
There's no need to use text() here:
writefln("%.*f", i, x);
does what you want.
T
--
"You know, maybe we don't *need* enemies." "Yeah, best friends are
On Tue, Apr 25, 2017 at 05:43:34PM +, David Sanders via Digitalmars-d-learn
wrote:
[...]
> Order is not important. (float, int) is a subset of (int, int, float).
> (int, int, float) is not the same thing as (int, float). Duplicates in
> the list are considered to be distinct set members.
>
>
On Tue, Apr 25, 2017 at 05:08:36PM +, David Sanders via Digitalmars-d-learn
wrote:
> I have two compile-time lists of types. How do I find their set
> intersection (to determine if one is a subset of the other) and their
> set difference? See the block comments below:
What's your definition
On Fri, Apr 21, 2017 at 07:17:32PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Friday, 21 April 2017 at 19:09:25 UTC, Johan Fjeldtvedt wrote:
> > void foo(string s) {
> > enum es = tuple("a", "b", "c");
> > switch (s) {
> > foreach (e; es) {
> > case e:
> >
On Fri, Apr 21, 2017 at 06:54:38PM +, David Sanders via Digitalmars-d-learn
wrote:
[...]
> Now, I need help on concatenating Template Sequence Parameters. See
> the block comments below.
[...]
> } else static if (is(T _ == VariantN!V, V...)) {
> static if(is(U _ ==
On Fri, Apr 21, 2017 at 04:16:30PM +, David Sanders via Digitalmars-d-learn
wrote:
> I'm trying to do algebra with types ala
> http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/
>
> Below you will find my attempts at "adding" types in D. I've outlined the
>
On Thu, Apr 20, 2017 at 10:39:01PM +, Stanislav Blinov via
Digitalmars-d-learn wrote:
> On Thursday, 20 April 2017 at 19:20:28 UTC, H. S. Teoh wrote:
>
>
> > Another pernicious thing I encountered recently, related to implicit
> > conversions, is this:
> >
> >
On Thu, Apr 20, 2017 at 11:05:00AM +, Nick Treleaven via
Digitalmars-d-learn wrote:
[...]
> This is also a problem for overloading:
>
> alias foo = (char c) => 1;
> alias foo = (int i) => 4;
>
> static assert(foo(7) == 4); // fails
>
> I would like to see some small changes to mitigate
On Wed, Apr 19, 2017 at 05:56:18PM +, Stanislav Blinov via
Digitalmars-d-learn wrote:
> On Wednesday, 19 April 2017 at 17:34:01 UTC, Jonathan M Davis wrote:
> > Personally, I think that we should have taken the stricter approach
> > and not had integral types implicit convert to character
On Mon, Apr 17, 2017 at 12:05:19PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
[...]
> auto byNode(const(Tree) tree) {
> alias RangeType = typeof(byNode(tree.root));
Could this possibly be simplified to:
alias RangeType = typeof(return);
?
Or does that cause a circular
On Fri, Apr 14, 2017 at 12:29:34AM +, Jethro via Digitalmars-d-learn wrote:
> Is there a way to retain the ordering of an associative array? When
> the elements are added then looped over using a foreach, the order is
> different.
An AA is implemented as an unordered hash. So the insertion
On Mon, Apr 10, 2017 at 06:54:54PM +, Geroge Little via Digitalmars-d-learn
wrote:
> Is there support for BigFloat in phobos or any other package? I was
> playing around with D and wrote some code that calculates a Fibonacci
> sequence (iterative) with overflow detection that upgrades ulong
On Wed, Apr 05, 2017 at 09:58:16PM +, Inquie via Digitalmars-d-learn wrote:
> I have a lot of string concatenation to do and I'm wondering if char[]
> is faster? Does it simply extend the buffer or are new buffers created
> every time?
>
> What I am looking for is something like StringBuilder
On Fri, Mar 31, 2017 at 04:41:10AM +, Joel via Digitalmars-d-learn wrote:
> Linking...
> ld: warning: pointer not aligned at address 0x10017A4C9
> (_D30TypeInfo_AxS3std4file8DirEntry6__initZ + 16 from
>
On Thu, Mar 30, 2017 at 06:21:43PM +, Enigma via Digitalmars-d-learn wrote:
> Is it possible to compute at compile time computations on a manifest
> constant that contains values(in a somewhat complex way, but that
> shouldn't matter)?
Yes, see below.
> I am using foreach and it seems to be
On Wed, Mar 29, 2017 at 11:01:12PM +, Enigma via Digitalmars-d-learn wrote:
> On Wednesday, 29 March 2017 at 21:36:14 UTC, Petar Kirov [ZombineDev] wrote:
> > On Wednesday, 29 March 2017 at 19:19:48 UTC, Enigma wrote:
> > > [...]
> >
> > It looks like you are looking for this:
> >
On Wed, Mar 29, 2017 at 11:24:04AM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Wednesday, March 29, 2017 10:08:02 abad via Digitalmars-d-learn wrote:
> > Related question, it seems that final methods are allowed in
> > interfaces. Obviously you can't implement them anywhere, so is
On Sat, Mar 25, 2017 at 03:25:27AM +, Yuxuan Shui via Digitalmars-d-learn
wrote:
> In this example:
>
> import std.range;
> template expandRange(alias R) if (isInputRange!(typeof(R))) {
> static if (R.empty)
> alias expandRange = AliasSeq!();
> else
>
On Thu, Mar 23, 2017 at 05:11:49PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Thursday, 23 March 2017 at 00:39:56 UTC, H. S. Teoh wrote:
> > I'm still working on that. :-)
>
> Hey, can you at least put scare quotes around "static foreach" each
> time it is used? There's no such
On Thu, Mar 23, 2017 at 05:29:22PM +, data pulverizer via
Digitalmars-d-learn wrote:
> On Thursday, 23 March 2017 at 16:38:02 UTC, Adam D. Ruppe wrote:
> > On Thursday, 23 March 2017 at 16:28:18 UTC, data pulverizer wrote:
> > > alias mult!double dmult;
> > > alias mult!float fmult;
> >
> >
On Wed, Mar 22, 2017 at 11:12:06PM +, Jesse Phillips via
Digitalmars-d-learn wrote:
> On Friday, 17 March 2017 at 19:05:20 UTC, H. S. Teoh wrote:
> > There are actually (at least) TWO distinct phases of compilation
> > that are conventionally labelled "compile time":
> >
> > 1) Template
On Wed, Mar 22, 2017 at 08:35:27PM +, StarGrazer via Digitalmars-d-learn
wrote:
> I've tried compiles but I guess that only checks if the code has valid
> syntax, not if it actually will compile in context.
I'm not sure what you mean by "member of instance", but if you mean
whether some
On Fri, Mar 17, 2017 at 02:52:39PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 03/17/2017 12:05 PM, H. S. Teoh via Digitalmars-d-learn wrote:
>
> > 1) Template expansion / AST manipulation, and:
> >
> > 2) CTFE (compile-time function evaluation).
> >
On Fri, Mar 17, 2017 at 07:21:50PM +, John Colvin via Digitalmars-d-learn
wrote:
[...]
> reduce is a free function in std.algorithm. Just import it and you're
> away.
[...]
Also, there is now a variant of reduce called `fold`, that has a nicer
order of parameters, i.e., you can use it in
On Fri, Mar 17, 2017 at 03:14:08PM +, Hussien via Digitalmars-d-learn wrote:
[...]
> What I am talking about is
>
> how the statement
>
> static if (x) continue;
> pragma(msg, "called");
>
> vs
>
> static if (x) { } else
> pragma(msg, "not called");
>
>
> They are both semantically
On Thu, Mar 16, 2017 at 06:51:45PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Thursday, 16 March 2017 at 18:07:09 UTC, Petar Kirov [ZombineDev] wrote:
> > Why don't you use -dip1000???
>
> Because it isn't the default. But even if it was, people would ask
> "why is this giving me
On Thu, Mar 16, 2017 at 09:36:31PM +, David Zhang via Digitalmars-d-learn
wrote:
> Hi,
>
> I have two structs and want to cast between them. The cast is
> generalizable, so I want to keep it outside of the structs themselves
> (I'll be adding more later). How can I do this?
AFAIK, the
On Thu, Mar 16, 2017 at 02:36:15PM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
[...]
> Honestly, I think that it was a big mistake to have implicit slicing
> of static arrays in the language at all.
That makes at least 3 of us -- Adam, you, me. I'm sure there are more.
>
On Thu, Mar 16, 2017 at 07:17:41PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Thursday, 16 March 2017 at 19:00:08 UTC, H. S. Teoh wrote:
> > Actually, https://issues.dlang.org/show_bug.cgi?id=12625 shows that
> > implicit slicing is still a problem:
>
> Oh yikes, I figured it would
On Thu, Mar 16, 2017 at 06:41:40PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Thursday, 16 March 2017 at 18:10:43 UTC, H. S. Teoh wrote:
> > But in that case, wouldn't that mean implicit slicing isn't to blame
> > here? (Not that I'm arguing for implicit slicing -- I think it needs
On Thu, Mar 16, 2017 at 06:09:52PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Thursday, 16 March 2017 at 17:47:34 UTC, H. S. Teoh wrote:
> > Actually, the bug still exists even if you explicitly slice it:
> >
> > string x = func()[]; // still compiles, but shouldn't
>
> I
On Thu, Mar 16, 2017 at 10:40:51AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> Is implicit slicing the culprit in the issue I just filed? (Bug 17261)
>
> In retrospect, perhaps implicit casting to immutable is OK if we don't
> allow implicit slicing:
>
>
On Thu, Mar 16, 2017 at 05:06:39PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
[...]
> In isolation, implicit slicing can make sense but not with
> templates. In isolation, implicit immutable can make sense... but not
> with implicit slicing.
[...]
Is implicit slicing the culprit in
On Thu, Mar 16, 2017 at 04:59:40PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Thursday, 16 March 2017 at 16:47:14 UTC, Carl Sturtivant wrote:
> > Silently cast to immutable without copying!??!!
> > This is so wrong.
>
> It is the implicit slicing that I really want removed from
On Thu, Mar 16, 2017 at 04:21:08PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Thursday, 16 March 2017 at 16:13:33 UTC, Carl Sturtivant wrote:
> > string ans = md5Of(arg).toHexString();
>
> That is a major D design flaw biting you the same way it has bitten so
> many others.
>
On Wed, Mar 15, 2017 at 08:55:34PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
[...]
> > However, if there are two mixin templates both declaring
> > this(), the compiler dies with an ICE. :-D
>
> eek.
Filed a bug for it:
https://issues.dlang.org/show_bug.cgi?id=17259
T
--
On Wed, Mar 15, 2017 at 12:34:32PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 03/15/2017 03:23 AM, Basile B. wrote:
>
> > you can use a mixin template because they can introduce destructors
> > that are called automatically with the aggregate destrcutor
> >
> > mixin template Foo(T)
On Tue, Mar 14, 2017 at 06:59:58PM +, Inquie via Digitalmars-d-learn wrote:
> On Tuesday, 14 March 2017 at 17:42:34 UTC, H. S. Teoh wrote:
[...]
> > struct X {
> > int method(float x) { return 0; }
> > }
> >
> > typeof() membptr;
> > pragma(msg, typeof(membptr));
On Tue, Mar 14, 2017 at 05:05:10PM +, Inquie via Digitalmars-d-learn wrote:
> I am generating member function pointers using the declaration
> specified from a standard member function. The standard member
> function is a valid D function that could use any types.
>
> Is there any pitfalls
On Tue, Mar 14, 2017 at 12:30:13PM +, Era Scarecrow via Digitalmars-d-learn
wrote:
> On Tuesday, 14 March 2017 at 10:00:24 UTC, Tetiana wrote:
> > Build fails with the following error:
>
> Just looking at the Documentation, Generator is an InputRange and
> chunks requires a ForwardRange
On Mon, Mar 13, 2017 at 10:47:09AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> P.S. I just realized that std.stdio.chunks() doesn't return a range.
> Bah. File an enhancement request. I might even submit a PR for it. ;-)
[...]
> P.P.S. It's not overly hard to write an al
P.P.S. It's not overly hard to write an alternative version of
std.stdio.chunks that returns a real range. Something like this should
do:
// Warning: untested code
auto realChunks(File f, size_t blockSize)
{
static struct Result
{
On Mon, Mar 13, 2017 at 04:50:49PM +, XavierAP via Digitalmars-d-learn
wrote:
> It's not easy to do by hand of course, but I was wondering if there
> was one simple function taking two file names and just returning a
> bool or something like that. I haven't found it in std.file.
Why it is
On Sat, Mar 11, 2017 at 08:07:39PM +, XavierAP via Digitalmars-d-learn
wrote:
[...]
> I realized that the code that sparked the question made no sense and
> should be done in a different way... As is always the case when these
> questions come up.
> But I still like the version with pointers
On Sat, Mar 11, 2017 at 12:45:10PM +, XavierAP via Digitalmars-d-learn
wrote:
> On Saturday, 11 March 2017 at 12:35:42 UTC, XavierAP wrote:
> > I do not really think it's a bad solution, to check several scalar
> > arguments that must obey the same condition; just wondering if you
> > have
On Thu, Feb 23, 2017 at 01:39:11PM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> Nah, that's overkill. This works:
>
> Note$(COLON) blah blah blah
>
> Apparently COLON is defined to be ':' in the default ddoc macros, so
> you needn't define it yourself.
[...]
On Thu, Feb 23, 2017 at 09:35:41PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> On Thursday, 23 February 2017 at 21:17:33 UTC, H. S. Teoh wrote:
> > _Note: Blah blabbety blah
>
> Nope.
>
> Ddoc considers [A-Za-z_]+: to be a section header. You can trick it by
> doing something like
On Thu, Feb 23, 2017 at 04:04:39PM -0500, Nick Sabalausky (Abscissa) via
Digitalmars-d-learn wrote:
> Suppose I want ddoc output to include this line:
>
> --
> Note: Blah blabbety blah
> --
>
> But the colon causes "Note" to be considered a section header. Is
> there a
On Wed, Feb 22, 2017 at 09:16:24PM +, kinke via Digitalmars-d-learn wrote:
[...]
> One more again as I couldn't believe noone went for 'any' yet:
>
> ---
> import std.algorithm;
> return !s.any!"a > 127"; // code-point level
> ---
You win 1 intarwebs for the shortest solution posted so far.
On Wed, Feb 22, 2017 at 11:43:00AM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> import std.range.primitives;
>
> bool isAsciiOnly(R)(R input)
> if (isInputRange!R && is(ElementType!R : dchar))
> {
> import std.
On Wed, Feb 22, 2017 at 07:26:15PM +, berni via Digitalmars-d-learn wrote:
> In my program, I read a postscript file. Normal postscript files
> should only be composed of ascii characters, but one never knows what
> users give us. Therefore I'd like to make sure that the string the
> program
On Wed, Feb 22, 2017 at 06:17:14PM +, Stefan Koch via Digitalmars-d-learn
wrote:
> On Wednesday, 22 February 2017 at 17:05:17 UTC, H. S. Teoh wrote:
> > On Wed, Feb 22, 2017 at 04:08:45PM +, Stefan Koch via
> > Digitalmars-d-learn wrote:
> > > [...]
> >
> > I'm not sure it's that simple.
On Wed, Feb 22, 2017 at 04:08:45PM +, Stefan Koch via Digitalmars-d-learn
wrote:
> On Wednesday, 22 February 2017 at 15:27:22 UTC, H. S. Teoh wrote:
> > (In fact, now I'm wondering if we could just hack dmd to emit the
> > equivalent of this code as a lowering, whenever the user tries to
> >
On Wed, Feb 22, 2017 at 09:00:36AM +0100, Jacob Carlborg via
Digitalmars-d-learn wrote:
[...]
> You can use an enum to declare the AA and then assign it to an
> immutable variable using "static this". The you would only use to the
> immutable variable and never the enum.
>
> enum aa = [1 : 2];
>
On Wed, Feb 22, 2017 at 12:38:47AM +, Chad Joan via Digitalmars-d-learn
wrote:
[...]
Hmm. It's actually not necessary to manually write a foreach loop to
convert an array to an AA. We could, instead, change parseTwoColumnCsv()
to return an array of std.typecons.Tuple instead (which,
On Tue, Feb 21, 2017 at 11:50:02PM +0100, Daniel Kozak via Digitalmars-d-learn
wrote:
> I have similar issue and I beleive I was able to workaround that
> somehow, but it is so many years now :(. Have you tried enum
> dataLookup instead of immutable string[string] dataLookup
That may appear to
On Tue, Feb 21, 2017 at 10:34:57PM +, Chad Joan via Digitalmars-d-learn
wrote:
> On Tuesday, 21 February 2017 at 22:26:01 UTC, Chad Joan wrote:
> > On Tuesday, 21 February 2017 at 21:58:07 UTC, Stefan Koch wrote:
> > > On Tuesday, 21 February 2017 at 21:53:23 UTC, Chad Joan wrote:
> > > >
On Tue, Feb 21, 2017 at 02:46:10PM +, Dukc via Digitalmars-d-learn wrote:
> I (finally) managed to build the development build of dmd, with
> libraries. When testing if it compiles a Hello World program (it
> does, no problem) I got these messages:
>
>
On Mon, Feb 20, 2017 at 05:39:30PM +, ketmar via Digitalmars-d-learn wrote:
> Ali Çehreli wrote:
>
> > Correction: It's actually the 'auto attribute' in D with the
> > venerable responsibility of "The auto attribute is used when there
> > are no other attributes and type inference is
On Mon, Feb 20, 2017 at 03:00:05PM +, timmyjose via Digitalmars-d-learn
wrote:
[...]
> Just one question about the compilers though - I read on the Wiki that
> there are three main compiler distros - dmd, ldc, and gdc. I code
> primarily on a mac, and I have installed both dmd and ldc. A lot
On Mon, Feb 20, 2017 at 05:16:15AM -0800, Jonathan M Davis via
Digitalmars-d-learn wrote:
[...]
> Regardless, if performance is your #1 concern, then I would suggest
> that you compile with ldc and not dmd.
[...]
+1. If you are concerned about performance enough to worry whether the
compiler
On Thu, Feb 16, 2017 at 12:43:30AM +, David Zhang via Digitalmars-d-learn
wrote:
> Hi,
>
> Say I have a struct S that holds a reference to an object O. Is there
> a way to express that I want to be able to change the reference, but
> not what the reference points to? Thanks.
>
> struct S {
On Wed, Feb 15, 2017 at 10:58:42PM +, ag0aep6g via Digitalmars-d-learn
wrote:
> On Wednesday, 15 February 2017 at 22:34:22 UTC, H. S. Teoh wrote:
> > auto debugPrint(alias fun, A...)(A args) {
> > writefln("%s(%(%s, %))", __traits(identifier, fun), [args]);
> >
1101 - 1200 of 1571 matches
Mail list logo