Re: is there "this"?

2016-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 03, 2016 09:40:11 Steven Schveighoffer via Digitalmars-d-learn wrote: > On 11/2/16 4:43 AM, Jonathan M Davis via Digitalmars-d-learn wrote: > > On Wednesday, November 02, 2016 02:42:01 Konstantin Kutsevalov via > > > > Digitalmars-d-learn wrote:

Re: What is the simplest way of doing @nogc string concatenation?

2016-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 03, 2016 18:54:14 Gary Willoughby via Digitalmars-d- learn wrote: > What is the simplest way of doing @nogc string concatenation? std.range.chain is the closest that you're going to get with actual strings. Dynamic arrays require the GC to do concatenation, because they have

Re: Should I prefer immutable or const?

2016-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 02, 2016 23:23:22 Nordlöw via Digitalmars-d-learn wrote: > On Tuesday, 1 November 2016 at 18:55:26 UTC, Jonathan M Davis > > wrote: > > - Jonathan M Davis > > Thanks. I'll go for immutable, when possible, then. > > I wish I had a shorter way to write immutable, though :) >

Re: Benchmarking Time Unit

2016-11-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 01, 2016 20:21:32 Nordlöw via Digitalmars-d-learn wrote: > On Tuesday, 1 November 2016 at 20:19:31 UTC, Nordlöw wrote: > > MonoTime has about 5-10 % fluctuations on my laptop. Is this as > > good as it gets? > > Is > >

Re: error

2016-11-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 02, 2016 01:36:23 Concealment via Digitalmars-d-learn wrote: > On Wednesday, 2 November 2016 at 01:32:27 UTC, Adam D. Ruppe > > wrote: > > On Wednesday, 2 November 2016 at 01:27:32 UTC, Concealment > > > > wrote: > >> can someone help me please? > > > > did you import

Re: is there "this"?

2016-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 02, 2016 02:42:01 Konstantin Kutsevalov via Digitalmars-d-learn wrote: > I tested already and it really works, thank you. > I asked that because I tried once to use "this" in past but I got > error. So I asked on some forum "how to get property of class?" > and peoples said

Re: is there "this"?

2016-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 02, 2016 07:26:57 Bauss via Digitalmars-d-learn wrote: > Well "this" in D has different meanings as it depends on its > context sometimes. Yes, but it's almost always the same thing that you'd expect from a language like C++ or Java. - Jonathan M Davis

Re: general questions about static this() at module level

2016-10-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 31, 2016 16:02:13 WhatMeWorry via Digitalmars-d-learn wrote: > On Monday, 31 October 2016 at 05:42:16 UTC, sarn wrote: > > On Monday, 31 October 2016 at 04:35:35 UTC, WhatMeWorry wrote: > >> [...] > > > > I've seen hacks to do the same thing in C++. They're not > > pretty,

Re: Trait hasIndexing

2016-10-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 11, 2016 10:08:02 Nordlöw via Digitalmars-d-learn wrote: > I can't find any traits `hasIndexing!R` corresponding to > `std.range.primitives.hasSlicing!R` > > that is `true` iff `R` has `opIndex[size_t]` defined. Is there > one? > > If not what should I use instead? The traits

Re: Working with ranges: mismatched function return type inference

2016-10-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 11, 2016 10:42:42 Ali Çehreli via Digitalmars-d-learn wrote: > Those interfaces already exist in Phobos: :) > >https://dlang.org/phobos/std_range_interfaces.html > > auto foo(int[] ints) { >import std.range; >if (ints.length > 10) { >return >

Re: Working with ranges: mismatched function return type inference

2016-10-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 11, 2016 07:55:36 orip via Digitalmars-d-learn wrote: > I get "Error: mismatched function return type inference" errors > with choosing the return type for functions that work on ranges > using, e.g, std.algorithm or std.range functions, but have > different behavior based on

Re: Continued looking at properties in D - interfaces and constraints

2016-10-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 09, 2016 14:06:42 Antonio Corbi via Digitalmars-d-learn wrote: > I think that the compiler assumes that its empty contract is always true. That's exactly what it does. Having no contract is considered to be equivalent to having an empty contract. So, because an empty contract

Re: Current State of the GC?

2016-10-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 10, 2016 21:12:42 Martin Lundgren via Digitalmars-d-learn wrote: > I've been reading up a bit on the D garbage collector. Seen > mostly negative things about it. I've also seen a lot of > proposals and what not, but not much about the current state of > things. > > The latest

Re: opIndexDispatch?

2016-10-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 12, 2016 22:45:28 Yuxuan Shui via Digitalmars-d-learn wrote: > On Monday, 10 October 2016 at 19:16:06 UTC, Jonathan M Davis > > wrote: > > On Monday, October 10, 2016 19:01:19 Yuxuan Shui via > > > > Digitalmars-d-learn wrote: > >> Hi, > >> > >> Why is there no

Re: Continued looking at properties in D - interfaces and constraints

2016-10-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 12, 2016 20:40:57 mikey via Digitalmars-d-learn wrote: > OK I'm somewhat struggling with this concept. It is a bit weird. But consider class A { ... auto foo(int i) in { assert(i < 10); } out(r) { assert(r > 20); } body {...} ... } class B : A {

Re: Escaping ref to stack mem sometimes allowed in @safe?

2016-10-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 14, 2016 16:49:44 Nick Sabalausky via Digitalmars-d-learn wrote: > This compiles. Is it supposed to? > > @safe ubyte[] foo() > { > ubyte[512] buf; > auto slice = buf[0..$]; > // Escaping reference to stack memory, right? > return slice; > } > > Or is the escaping

Re: how to understand different attribute styles?

2016-10-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 17, 2016 14:12:33 timepp via Digitalmars-d-learn wrote: > there is "@disable", using @ as prefix; > there is "__gshared", using __ as prefix; > there is also "align", not using prefix. > > I failed to summarize a rule here. Can anyone tell the underlined > philosiphy? There

Re: Impressed with Appender - Is there design/implementation description?

2016-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, December 06, 2016 13:19:22 Anonymouse via Digitalmars-d-learn wrote: > On Tuesday, 6 December 2016 at 10:52:44 UTC, thedeemon wrote: > > It's rather simple, just take a look at its source code in > > std.array. > > It's an ordinary linear array partially filled with your data. > >

Re: [Semi-OT] I don't want to leave this language!

2016-12-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 07, 2016 15:17:21 Picaud Vincent via Digitalmars-d- learn wrote: > However I think that to popularize/attract people to use D, it is > very important, to have a mechanism/feature that allows you to be > close to the "zero overhead" situation. You can do that without

Re: Range of uncopyable elements

2016-12-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, December 08, 2016 22:32:47 Jerry via Digitalmars-d-learn wrote: > On Thursday, 8 December 2016 at 21:46:26 UTC, Jonathan M Davis > > wrote: > > However, at least as of C++98, non-copyable elements in a > > container were not allowed IIRC, so it would have been pretty > > rare to have

Re: @property

2016-12-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, December 08, 2016 16:54:57 Adam D. Ruppe via Digitalmars-d- learn wrote: > On Thursday, 8 December 2016 at 16:53:13 UTC, Satoshi wrote: > > is there any advantage of marking function as @property?? > > Not really. I think it just changes the meaning of > typeof(thatfunc) but otherwise

Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, December 06, 2016 13:36:20 Ilya Yaroshenko via Digitalmars-d- learn wrote: > On Tuesday, 6 December 2016 at 13:02:16 UTC, Andrei Alexandrescu > > wrote: > > On 12/6/16 3:28 AM, Ilya Yaroshenko wrote: > >> On Tuesday, 6 December 2016 at 08:14:17 UTC, Andrea Fontana > >> > >> wrote: >

Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 07, 2016 02:38:50 bpr via Digitalmars-d-learn wrote: > On Tuesday, 6 December 2016 at 22:47:34 UTC, Jonathan M Davis > > We get plenty of folks who aren't big C/C++ programmers who are > > interested in D. Yes, the majority seem to have a C++ > > background, but we also get

Re: Range of uncopyable elements

2016-12-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, December 08, 2016 20:21:41 Jerry via Digitalmars-d-learn wrote: > Assuming that is wrong though, as you aren't copying an iterator > or range you are copying the actual value. What you are confusing > "auto h = r.front;" for is this: "auto rcopy = r;". The D code > "auto h = r.front"

Re: @property

2016-12-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, December 08, 2016 22:11:22 ArturG via Digitalmars-d-learn wrote: > On Thursday, 8 December 2016 at 16:54:57 UTC, Adam D. Ruppe wrote: > > On Thursday, 8 December 2016 at 16:53:13 UTC, Satoshi wrote: > >> is there any advantage of marking function as @property?? > > > > Not really. I

Re: Delegate parameter name shadows type name

2017-01-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, January 09, 2017 11:18:02 Ali Çehreli via Digitalmars-d-learn wrote: > This is something that surprised me in a friend's code. > > (A "friend", hmmm? No, really, it wasn't me! :) ) > > // Some type of the API > struct MyType { > int i; > } > > // Some function of the API that

Re: Where should I dump workarounds?

2016-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 30, 2016 17:14:37 Dukc via Digitalmars-d-learn wrote: > Well, I was working on std.range.chain (I'm new to contributing), > and when trying to test locally: > > ...\phobos\std\range>rdmd -unittest -main package > C:\D\dmd2\windows\bin\..\..\src\phobos\std\path.d(1319):

Re: Where should I dump workarounds?

2016-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 30, 2016 18:50:42 Dukc via Digitalmars-d-learn wrote: > On Wednesday, 30 November 2016 at 18:26:32 UTC, Jonathan M Davis > > wrote: > > [snip] > > > > - Jonathan M Davis > > Luckily, I have made a branch for my stuff instead of using > master. But thanks for the help, now I

Re: Where should I dump workarounds?

2016-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 30, 2016 21:48:20 Johan Engelen via Digitalmars-d- learn wrote: > Tip: use both a GUI and the commandline. Without SourceTree [1], > I would be nowhere near as effective with git. > > With rebasing, you'll end up having to force push. Force pushing > is scary (because the

Re: @property get/set or public varaible?

2016-12-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, December 04, 2016 15:30:22 vladdeSV via Digitalmars-d-learn wrote: > Hello! > > I have a question not directly related to D as it is with coding > standards. > > My issue at hand is if I have one variable for a class, which I > want to be directly accessible for anything else, should

Re: Variadic function parameters passed by move

2017-01-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 21, 2016 23:18:29 Nordlöw via Digitalmars-d-learn wrote: > Do you have any clue on how to most easily find detect whether a > SymbolExpression is the last reference to that symbol in the > scope of the symbol definition, Jonathan? Sorry, but my knowledge of dmd's internals

Re: Variadic function parameters passed by move

2016-12-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 21, 2016 20:27:47 Nordlöw via Digitalmars-d-learn wrote: > If I have a variadic function > > f(Rs...)(Rs ranges) > { > g(ranges); > } > > that calls > > g(Rs...)(Rs ranges) > { > // use ranges > } > > and all or some of the elements in `ranges` are non-copyable

Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, December 06, 2016 22:13:54 bpr via Digitalmars-d-learn wrote: > On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis > > wrote: > > So, while there are certainly folks who would prefer using D as > > a better C without druntime or Phobos, I think that you're > > seriously

Re: really why module declarations?

2017-03-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 26, 2017 20:51:01 XavierAP via Digitalmars-d-learn wrote: > I've perused both the spec[1] and Andrei's book, and I the idea I > get is that module declarations are optional, recommended only in > case of file names not being valid D names. But in the community > (and Phobos) I see

Re: Comparing two AliasSeq

2017-03-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, March 25, 2017 04:57:26 Yuxuan Shui via Digitalmars-d-learn wrote: > I see. I always thought tuple() is a type... > > So a tuple of types is a type, but a tuple of mixed types and > values is not a type. Doesn't seem very consistent. An AliasSeq isn't really ever a type.

Re: Comparing two AliasSeq

2017-03-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, March 25, 2017 03:25:27 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 > alias

Re: Using filter with std.container.Array.

2017-03-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, March 23, 2017 02:53:40 Soulsbane via Digitalmars-d-learn wrote: > Thanks for the reply Jonathan! Yes, I was trying to find all the > ids that match but couldn't get find to work. So I think I have > missed something somewhere. > > As a quick example: > import std.stdio; > import

Re: Why is this legal?

2017-03-29 Thread Jonathan M Davis via Digitalmars-d-learn
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 > this also on purpose and on what rationale? :) If the function is final, it can have an

Re: What is the state of scope function parameter?

2017-03-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, March 28, 2017 22:15:33 Ali Çehreli via Digitalmars-d-learn wrote: > (More correctly, "scope storage class".) > >https://dlang.org/spec/function.html#Parameter > > still says > >scope: references in the parameter cannot be escaped > (e.g. assigned to a global

Re: Why is this legal?

2017-03-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 29, 2017 10:56:34 rikki cattermole via Digitalmars-d- learn wrote: > On 29/03/2017 10:50 AM, abad wrote: > > This works: > > > > class Foo { > > > > protected void bar() { > > > > writeln("hello from foo"); > > > > } > > > > } > > > > void main() { > > > >

Re: Why is this legal?

2017-03-29 Thread Jonathan M Davis via Digitalmars-d-learn
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 > this also on purpose and on what rationale? :) If the function is final, it can have an

Re: bug in foreach continue

2017-03-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, March 18, 2017 17:18:15 H. S. Teoh via Digitalmars-d-learn wrote: > 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: > > > >

Re: GitHub detects .d source as Makefile?

2017-03-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, March 18, 2017 00:34:57 XavierAP via Digitalmars-d-learn wrote: > So I have put my first code even on GitHub (comments welcome :)) > and GitHub seems to detect the wrong language, even if I'm not > familiar with this GH feature. > > https://github.com/XavierAP/etc/tree/master/heatsim

Re: std.digest toHexString

2017-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 20, 2017 22:47:24 Adam D. Ruppe via Digitalmars-d-learn wrote: > The rules make sense alone, but together, they are just bizarre. That's frequently where the language design pitfalls lie. Well-meaning features that seem perfectly reasonable on their own (possibly even

Re: Does "dub test" run tests?

2017-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 20, 2017 07:51:09 Russel Winder via Digitalmars-d-learn wrote: > I have a Meson build for a D program project with a single main.d file > that has some unit tests. Both executable and test executable are > created and work as expected. > > I created a minimal Dub file for this

Re: Is it std.regex, or is it me.

2017-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 20, 2017 14:36:32 Russel Winder via Digitalmars-d-learn wrote: > Given the following, where X and Y mark the spot: > > X epochRegex = regex("([0-9])+:"); > Y aEpochCapture = matchFirst(aVersionString, epochRegex); > Y bEpochCapture = matchFirst(bVersionString, epochRegex);

Re: bug in foreach continue

2017-03-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, March 17, 2017 11:53:41 Michael via Digitalmars-d-learn wrote: > On Friday, 17 March 2017 at 11:30:48 UTC, Jonathan M Davis wrote: > > On Friday, March 17, 2017 01:55:19 Hussien via > > Digitalmars-d-learn wrote: > > > > I tend to agree with this. If the foreach is static, and > >

Re: std.digest toHexString

2017-03-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, March 16, 2017 20:42:21 Carl Sturtivant via Digitalmars-d-learn wrote: > Implicitly slicing rvalue arrays is too much like implicitly > taking the address of an rvalue. Well, that's just it. That's _exactly_ what's happening. It's just that it ends up in a struct with a length

Re: bug in foreach continue

2017-03-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, March 17, 2017 01:55:19 Hussien via Digitalmars-d-learn wrote: > On Friday, 17 March 2017 at 01:41:47 UTC, Adam D. Ruppe wrote: > > On Friday, 17 March 2017 at 01:34:52 UTC, Hussien wrote: > >> Seems like continue needs to be static aware. > > > > That's not a bug, pragma is triggered

Re: Using filter with std.container.Array.

2017-03-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 22, 2017 07:06:47 Soulsbane via Digitalmars-d-learn wrote: > Example code: > struct Foo > { >string name; >size_t id; > } > > Array!Foo foo_; > > I get errors when I try to use filter like this: > > auto found = filter!((Foo data, size_t id) => data.id == > id)(foo_[],

Re: debug mixins

2017-03-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 15, 2017 03:43:20 Inquie via Digitalmars-d-learn wrote: > So, is it possible to debug string mixins? > > I ran visual D and tried to step in to a function that was > generated by a mixin and it brought an open file dialog box > asking me to load the source code where the

Re: debug mixins

2017-03-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 15, 2017 13:01:36 Inquie via Digitalmars-d-learn wrote: > On Wednesday, 15 March 2017 at 03:50:21 UTC, Jonathan M Davis > > wrote: > > On Wednesday, March 15, 2017 03:43:20 Inquie via > > > > Digitalmars-d-learn wrote: > >> [...] > > > > Related:

Re: Tell compiler not to try and CTFE template?

2017-04-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, April 11, 2017 01:53:07 Jethro via Digitalmars-d-learn wrote: > I have a template that that takes no arguments. It takes a while > to compile, but if I simply create a dummy argument, D compiles > much quicker. > > e.g., > > void foo(string s)(); // slow, > > void foo(string s)(int x);

Re: length = 0 clears reserve

2017-04-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, April 11, 2017 01:42:32 Jethro via Digitalmars-d-learn wrote: > arrays have the ability to reserve but when setting the length to > 0, it removes the reserve!! ;/ > > char[] buf; > buf.reserve = 1000; > buf.length = 0; > assert(buf.capacity == 0); > > But I simply want to clear the

Re: What is this error message telling me?

2017-04-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, April 11, 2017 14:51:44 Anonymous via Digitalmars-d-learn wrote: > I was watching a dconf presentation from last year and wanted to > try this out: https://github.com/luismarques/parnas72. It doesn't > compile / run as it is and the problem seems to be in the > function below. > >

Re: Dub, Git, Mercurial, Bazaar

2017-04-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, April 11, 2017 05:59:27 Russel Winder via Digitalmars-d-learn wrote: > Go only uses Git, Mercurial, or Bazaar for dependency handling. Rust > (via Cargo) allows for a central repository, and Git (, and Mercurial > ?) repositories. Dub appears only to allow for central repository, or >

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 17, 2017 13:45:18 Dmitry via Digitalmars-d-learn wrote: > On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote: > > They works, but it results in a new template being instantiated > > for every call, so you really shouldn't use __FILE__ or > > __LINE__ as template

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 17, 2017 10:30:35 Basile B. via Digitalmars-d-learn wrote: > On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote: > > Hi there. > > > > Currently for messages about errors I use code like this: > > void add(string name, ref Scene scene) > > { > > > > if (name in

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 17, 2017 10:58:36 Basile B. via Digitalmars-d-learn wrote: > On Monday, 17 April 2017 at 10:55:30 UTC, Jonathan M Davis wrote: > > On Monday, April 17, 2017 10:30:35 Basile B. via > > > > Digitalmars-d-learn wrote: > >> On Monday, 17 April 2017 at 10:22:47 UTC, Dmitry wrote: > >

Re: Can we disallow appending integer to string?

2017-04-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, April 19, 2017 14:50:38 Stanislav Blinov via Digitalmars-d- learn wrote: > On Wednesday, 19 April 2017 at 14:36:13 UTC, Nick Treleaven wrote: > > This bug is fixed as the code no longer segfaults but throws > > instead: > > https://issues.dlang.org/show_bug.cgi?id=5995 > > > > void

Re: refRange with non copyable struct

2017-04-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 17, 2017 17:23:32 Jerry via Digitalmars-d-learn wrote: > Hello guys, so I wanted to have a noncopyable range on the stack. > So my thoughts was to make it non copyable and use refRange > whenever I want to use it with map and others. > > But I got a compiler warning when doing so

Re: refRange with non copyable struct

2017-04-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 17, 2017 18:45:46 Jerry via Digitalmars-d-learn wrote: > On Monday, 17 April 2017 at 18:07:36 UTC, Jonathan M Davis wrote: > > In this particular case, it looks like the main problem is > > RefRange's opAssign. For it to work, the type needs to be > > copyable. It might be

Re: Get list of public methods of struct

2017-03-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, March 09, 2017 18:48:22 Adam D. Ruppe via Digitalmars-d-learn wrote: > On Thursday, 9 March 2017 at 18:32:41 UTC, tcak wrote: > > Is there any way to get list of public methods of a struct? > > You can loop through __traits(allMembers, YourStruct) and check > protection, type, etc. >

Re: C interface provides a pointer and a length... wrap without copying?

2017-03-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 12, 2017 02:47:19 cy via Digitalmars-d-learn wrote: > On Saturday, 11 March 2017 at 23:43:54 UTC, Nicholas Wilson wrote: > > A string *is* a pointer length pair, an immutable(char)[]. > > Yes, but surely there's some silly requirement, like that the > pointer must only ever point

Re: code folding

2017-03-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 13, 2017 19:51:59 Inquie via Digitalmars-d-learn wrote: > On Monday, 13 March 2017 at 18:26:22 UTC, Jonathan M Davis wrote: > > On Monday, March 13, 2017 17:29:41 Inquie via > > > > Digitalmars-d-learn wrote: > >> Does D have any nice way to specify a block for cold folding? > >>

Re: code folding

2017-03-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 13, 2017 17:29:41 Inquie via Digitalmars-d-learn wrote: > Does D have any nice way to specify a block for cold folding? I > have a very large set of structs and I'd like to be able to code > fold them all at once and together. > > I have been using > > static if(true) > { >

Re: Null-Safe Dereference Operator

2017-03-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, March 14, 2017 00:51:02 Jolly James via Digitalmars-d-learn wrote: > Does anybody know, if D has a null-safe dereference operator like > C# does (?.) or something similar? It does not, though if you really wanted to, you could probably create template that did the same thing fairly

Re: Date formatting in D

2017-03-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, March 07, 2017 22:15:39 Daniel Kozak via Digitalmars-d-learn wrote: > I do not know? Is this some ISO/ANSI format for dates? If yes than we > should add it. If no there is no reason. The ISO formats are already there. There's to/fromISOString and to/fromISOExtString on SysTime,

Re: refRange with non copyable struct

2017-04-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 17, 2017 19:39:25 Stanislav Blinov via Digitalmars-d-learn wrote: > On Monday, 17 April 2017 at 19:00:44 UTC, Jonathan M Davis wrote: > > Because otherwise, it's not acting like a reference to the > > original range, which is the whole point of RefRange. The > > correct solution

Re: Out of data wiki

2017-04-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, April 18, 2017 19:54:26 Mike B Johnson via Digitalmars-d-learn wrote: > can this be updated to work? > > https://wiki.dlang.org/Timing_Code Wow, that's using some old stuff - stuff older than the wiki. Weird. It was probably ported from somewhere. The best thing to use now is

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 17, 2017 07:23:50 Jonathan M Davis via Digitalmars-d-learn wrote: > So, if you're okay with explicitly instantiating your variadic function > template instead of having the types inferred, then it can work, but > otherwise, no. Making it work would require a language en

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 14, 2017 15:22:23 Steven Schveighoffer via Digitalmars-d- learn wrote: > On 8/13/17 11:40 PM, Jonathan M Davis via Digitalmars-d-learn wrote: > > On Saturday, August 12, 2017 18:57:44 Arek via Digitalmars-d-learn wrote: > >> I have the folowing problem: >

Re: How to specify a template that uses unqualified type, like any normal function

2017-08-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 14, 2017 17:43:44 Dominikus Dittes Scherkl via Digitalmars-d-learn wrote: > On Monday, 14 August 2017 at 15:20:28 UTC, Steven Schveighoffer > > wrote: > > On 8/14/17 9:48 AM, Dominikus Dittes Scherkl wrote: > > > uint foo(T)(Unqual!T n) // first try > > > { > > > > > > ++n;

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, August 12, 2017 18:57:44 Arek via Digitalmars-d-learn wrote: > I have the folowing problem: > I like to envelope the class object in struct to control the > destruction moment and then send this object to another > thread/fiber (or task, cause I use vibe-d). > > I can't find any

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 13, 2017 16:40:03 crimaniak via Digitalmars-d-learn wrote: > More of this, I think, you can't avoid __gshared for any complex > work. Even mutexes from Phobos doesn't support shared, so I had > to 'cowboy with __gshared' when implementing my site engine. The way to handle shared

Re: Faster alternatives to std.xml

2017-07-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 8, 2017 8:45:57 PM MDT Nordlöw via Digitalmars-d-learn wrote: > What's the fastest XML-parser on code.dlang.org? > > Are there any benchmarks that show performance improvements > compared to std.xml? I'm not aware of any benchmarks for std.xml, but from what I know of it, it

Re: The Nullity Of strings and Its Meaning

2017-07-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, July 9, 2017 1:51:44 PM MDT kdevel via Digitalmars-d-learn wrote: > > You also shouldn't rely on it returning null for a null input, > > even when it currently does that. > > I assumed that a non-null string is returned for a non-null input. There are going to be functions that return

Re: The Nullity Of strings and Its Meaning

2017-07-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 8, 2017 5:16:51 PM MDT kdevel via Digitalmars-d-learn wrote: > Yesterday I noticed that std.uri.decodeComponent does not > 'preserve' the > nullity of its argument: > > 1 void main () > 2 { > 3import std.uri; > 4string s = null; > 5assert (s is

Re: CTFE output is kind of weired

2017-07-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 8, 2017 10:12:29 PM MDT Era Scarecrow via Digitalmars-d- learn wrote: > On Saturday, 8 July 2017 at 21:29:10 UTC, Andre Pany wrote: > > app.d(17):called from here: test("1234\x0a5678\x0a") > > > > I wrote the source code on windows with a source file with \r\n > > file

Re: sorting a string

2017-07-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, July 14, 2017 7:50:17 PM MDT Anton Fediushin via Digitalmars-d- learn wrote: > On Friday, 14 July 2017 at 17:23:41 UTC, Steven Schveighoffer > > wrote: > > Don't do this, because it's not what you think. It's not > > actually calling std.algorithm.sort, but the builtin array sort > >

Re: Exception handling

2017-07-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, July 14, 2017 9:06:52 PM MDT Moritz Maxeiner via Digitalmars-d- learn wrote: > On Friday, 14 July 2017 at 20:22:21 UTC, Ali Çehreli wrote: > > Although it's obvious to us that there are only those two > > exceptions, the compiler cannot in general know that. > > Not in general, no, but

Re: Can't get expected strings

2017-07-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 18, 2017 13:49:11 helxi via Digitalmars-d-learn wrote: > import std.stdio, std.datetime, std.conv, std.algorithm; > > void main() > { > immutable DEADLINE = DateTime(2017, 7, 16, 23, 59, > 59).to!SysTime; > immutable NOW = Clock.currTime; > immutable INTERVAL =

Re: replacement for squeeze and removechars.

2017-07-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 18, 2017 15:55:00 Seb via Digitalmars-d-learn wrote: > On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote: > > As Seb somewhat undiplomatically put, there are replacements > > listed in the changelog. > > Sorry - it wasn't intended to be an offense or aggressive. I >

Re: Cannot find std.datetime when linking after upgrade to 2.075.0

2017-07-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, July 21, 2017 15:33:45 Domain via Digitalmars-d-learn wrote: > After upgrade dmd to latest 2.075.0, my project no longer build: > > zero.lib(core_cde_4a4f.obj) : error LNK2001: unresolved external > symbol _D3std8d > atetime9LocalTime6opCallFNaNbNeZyC3std8datetime9LocalTime > > and many

Re: unittest blocks not being run inside of class and struct templates

2017-07-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 25, 2017 09:31:28 Steven Schveighoffer via Digitalmars-d- learn wrote: > The unfortunate thing is that if you want to have non-templated unit > tests, you have to put them outside the struct itself. This sucks for > documented unit tests, and for tests being close to the thing

Re: It makes me sick!

2017-07-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 26, 2017 22:29:00 Ali Çehreli via Digitalmars-d-learn wrote: > On 07/26/2017 09:20 PM, FoxyBrown wrote: > >> Somebody else had the same problem which they solved by removing > >> > >> "entire dmd": > >> http://forum.dlang.org/thread/ejybuwermnentslcy...@forum.dlang.org >

Re: It makes me sick!

2017-07-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 27, 2017 14:14:52 Steven Schveighoffer via Digitalmars-d- learn wrote: > On 7/27/17 1:58 PM, FoxyBrown wrote: > > I do not use the installer, I use the zip file. I assumed that > > everything would be overwritten and any old stuff would simply go > > unused.. but it seems it

Re: It makes me sick!

2017-07-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 27, 2017 18:35:02 FoxyBrown via Digitalmars-d-learn wrote: > On Thursday, 27 July 2017 at 18:14:52 UTC, Steven Schveighoffer > > wrote: > > On 7/27/17 1:58 PM, FoxyBrown wrote: > >> On Thursday, 27 July 2017 at 12:23:52 UTC, Jonathan M Davis > >> > >> wrote: > >>> On Wednesday,

Re: Whats the most common formatting style for dlang?

2017-07-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 19, 2017 10:19:52 PM MDT Christian Köstlin via Digitalmars-d-learn wrote: > Until now I formatted my toy-programs how I like it. Checking up on > dfmt I saw that these deviate from the default settings of dfmt. > Does dfmt's default settings reflect the most common style for

Re: Cannot find std.datetime when linking after upgrade to 2.075.0

2017-07-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 22, 2017 15:29:26 Domain via Digitalmars-d-learn wrote: > On Friday, 21 July 2017 at 19:05:00 UTC, Jonathan M Davis wrote: > > On Friday, July 21, 2017 15:33:45 Domain via > > > > Digitalmars-d-learn wrote: > >> After upgrade dmd to latest 2.075.0, my project no longer > >>

Re: unittest-cov - results?

2017-07-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 05, 2017 19:13:21 Jolly James via Digitalmars-d-learn wrote: > On Wednesday, 5 July 2017 at 19:01:06 UTC, Jonathan M Davis wrote: > > On Wednesday, July 05, 2017 18:50:32 Jolly James via > > > > Digitalmars-d-learn wrote: > >> On Wednesday, 5 July 2017 at 18:46:38 UTC, Jolly

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 28, 2017 01:11:35 Moritz Maxeiner via Digitalmars-d-learn wrote: > On Wednesday, 28 June 2017 at 00:05:20 UTC, Guillaume Piolat > > wrote: > > On Tuesday, 27 June 2017 at 23:54:50 UTC, Moritz Maxeiner wrote: > >> - Replace calls by the GC to `~this` with calls to `finalize` >

Re: unittest-cov - results?

2017-07-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 05, 2017 18:50:32 Jolly James via Digitalmars-d-learn wrote: > On Wednesday, 5 July 2017 at 18:46:38 UTC, Jolly James wrote: > > On Wednesday, 5 July 2017 at 18:09:46 UTC, Seb wrote: > >> On Wednesday, 5 July 2017 at 17:46:01 UTC, Jolly James wrote: > >>> [...] > >> > >> For

Re: Append to 'map' result

2017-07-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 04, 2017 23:50:57 Nicholas Wilson via Digitalmars-d-learn wrote: > On Tuesday, 4 July 2017 at 23:27:25 UTC, Jean-Louis Leroy wrote: > > I want to create a range that consists of the result of a map() > > > > followed by a value, e.g.: > > int[] x = [ 1, 2, 3]; > > auto y =

Re: How to fix date format?

2017-04-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, April 26, 2017 04:02:12 Suliman via Digitalmars-d-learn wrote: > I tried to do: > > writeln(DateTime.toISOExtString(DateTime.fromSimpleString(point[1].coerce! > string))); > > But got error: > > Error: function std.datetime.DateTime.toISOExtString () const is > not callable using

Re: How to fix date format?

2017-04-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, April 26, 2017 06:55:01 Suliman via Digitalmars-d-learn wrote: > Thanks! That's work! > > But why I can't do it in single line like: > string dt = > DateTime.toISOExtString(DateTime.fromSimpleString(point[1].coerce!string)) > ; "Error: function std.datetime.DateTime.toISOExtString ()

Re: How to fix date format?

2017-04-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, April 25, 2017 17:41:25 Suliman via Digitalmars-d-learn wrote: > I am using mysql native. Date in DB have next format: 2016-11-01 > 06:19:37 > > But every tile when I am trying to get it I am getting such > format: > 2016-Oct-31 15:37:24 > > I use next code: >

Re: It makes me sick!

2017-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 29, 2017 21:17:23 Joakim via Digitalmars-d-learn wrote: > On Saturday, 29 July 2017 at 19:26:03 UTC, FoxyBrown wrote: > > Also, equating dmd to an audio program or a clip art program > > that is designed to load any and all files in it's install dir > > is moronic too. > > It is

Re: Bug or not? Statics inside blocks

2017-07-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 29, 2017 1:54:29 AM MDT Cecil Ward via Digitalmars-d-learn wrote: > The snippet below failed to compile (I think) in the latest DMD - > but I can't see the error message in the web-based editor at > dlang.org. It certainly failed to compile under GDC 5.2.0 when > tried out using

Re: It makes me sick!

2017-07-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 27, 2017 11:55:21 Ali Çehreli via Digitalmars-d-learn wrote: > On 07/27/2017 11:47 AM, Adam D. Ruppe wrote: > > On Thursday, 27 July 2017 at 18:35:02 UTC, FoxyBrown wrote: > >> But the issue was about missing symbols, not anything "extra". If > >> datatime.d is there but nothing

<    3   4   5   6   7   8   9   10   11   12   >