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 = map

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 eve

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 Jam

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 nul

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 end

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 n

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 wou

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 > > pro

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 i

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 > consider(ed)

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 = (DEAD

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 dla

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: 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 > >> build:

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 bein

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 doesn

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, Ju

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

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-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 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 method

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: 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: std.range.put vs R.put: Best practices?

2017-08-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 21, 2017 02:34:23 Mike Parker via Digitalmars-d-learn wrote: > On Sunday, 20 August 2017 at 18:08:27 UTC, Jon Degenhardt wrote: > > Documentation for std.range.put > > (https://dlang.org/phobos/std_range_primitives.html#.put) has > > > > the intriguing line: > >> put should not b

Re: Type Inference in @safe unittests

2017-08-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 22, 2017 16:11:11 jmh530 via Digitalmars-d-learn wrote: > I'm not sure if this is a bug or not. > > I was playing around with printing out some member types with > unittests and I was noticing some strange results when they were > in @safe unittests rather than normal unittests.

Re: Appending data to array results in duplicate's.

2017-08-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 25, 2017 16:45:16 Vino.B via Digitalmars-d-learn wrote: > Hi, > > Request your help on the below issue, > > Issue : While appending data to a array the data is getting > duplicated. > > Program: > import std.file: dirEntries, isFile, SpanMode; > import std.stdio: writeln, writef

Re: No CTFE of function

2017-08-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, August 26, 2017 23:53:36 Cecil Ward via Digitalmars-d-learn wrote: > On Saturday, 26 August 2017 at 23:49:30 UTC, Cecil Ward wrote: > > On Saturday, 26 August 2017 at 18:16:07 UTC, ag0aep6g wrote: > >> On Saturday, 26 August 2017 at 16:52:36 UTC, Cecil Ward wrote: > >>> Any ideas as t

Re: How to store data when using parallel processing

2017-08-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 27, 2017 00:26:33 Andrew Chapman via Digitalmars-d-learn wrote: > Hi all, just wanting some advice on parallel processing and > specifically how to deal with access violations. > > I am reading a list of words from a file like this: > > auto fileHandle = File("wordlist.txt", "r")

Re: Comparison of Enumerations with base type of String?

2017-08-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 27, 2017 01:43:14 Michael Reiland via Digitalmars-d-learn wrote: > Hey guys, > > I was running through a tutorial and I noticed that enums can > have a base type of string. Which is interesting, but I'm > wondering about comparisons. > > I'm guessing the comparison boils down to

Re: Comparison of Enumerations with base type of String?

2017-08-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 27, 2017 03:47:58 Michael Reiland via Digitalmars-d-learn wrote: > You can randomly assign a string to an enum? Or am I > misunderstanding that last bit of code? No, you can't directly assign a string to an enum of type string. That's part of why they don't pass isInputRange. T

Re: Comparison of Enumerations with base type of String?

2017-08-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 27, 2017 22:01:52 Michael Reiland via Digitalmars-d-learn wrote: > whoa, you can use a struct as a basetype for an enum? I'm > guessing it allows you to associate more information with the > enum without using lookup tables and the like? And equality is > probably just a member

Re: Unable to set static data member of a class (results in default value 0)

2017-08-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 27, 2017 22:29:46 Adam D. Ruppe via Digitalmars-d-learn wrote: > On Sunday, 27 August 2017 at 22:21:11 UTC, Enjoys Math wrote: > >static int dataReadDelay; > > That's thread-local. Use shared to make it shared across all > threads, and/or initialize it in the same thread as t

Re: testing for deprecation

2017-08-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 28, 2017 13:08:04 jmh530 via Digitalmars-d-learn wrote: > On Saturday, 26 August 2017 at 07:17:49 UTC, user1234 wrote: > > getAttributes is made for UDAs only. > > Okay, well if you change it to > > deprecated { > void foo(); > } > > void main() { > pragma(msg, __traits(

Re: General performance tip about possibly using the GC or not

2017-08-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 29, 2017 00:52:11 Cecil Ward via Digitalmars-d-learn wrote: > I am vacillating - considering breaking a lifetime's C habits and > letting the D garbage collector make life wonderful by just > cleaning up after me and ruining my future C disciple by not > deleting stuff myself. >

Re: D Multidimensional arrays wierdness

2017-08-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 29, 2017 03:16:13 Johnson Jones via Digitalmars-d-learn wrote: > I need to get this straight: > > A normal single dimensional array in D is defined as > > T[] arr > > and is a linear sequential memory array of T's with an unbound > length and is effectively the same as T*(althou

Re: Casting non-aliased mutable arrays to immutable in return values

2017-08-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 29, 2017 16:09:17 Per Nordlöw via Digitalmars-d-learn wrote: > Is it recommended to cast an unaliased array to `immutable` after > it has been initialized? > > The reason for asking is that I would like the following function > > void[] rawReadNullTerminated(string path) >

Re: "Range invalidation" ?

2017-08-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, August 30, 2017 13:28:48 Mark via Digitalmars-d-learn wrote: > C++ has the issue of iterator invalidation, where certain > operations on a container while iterating on it may invalidate > the iterator, in which case it is no longer safe to use the > iterator. > > D has ranges, but pre

Re: Bug in D!!!

2017-08-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, August 30, 2017 20:47:12 EntangledQuanta via Digitalmars-d- learn wrote: > This is quite surprising! > > public struct S(T) > { > T s; > } > > > interface I > { > void Go(T)(S!T s); > > static final I New() > { > return new C(); > } > } > > abstract class A : I > { > >

Re: Bug in D!!!

2017-08-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, August 30, 2017 21:51:57 EntangledQuanta via Digitalmars-d- learn wrote: > The point you are trying to making, and not doing a great job, is > that the compiler cannot create an unknown set of virtual > functions from a single templated virtual function. BUT, when you > realize that i

Re: std.algorithm.joiner unexpected behavior

2017-08-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, August 31, 2017 18:43:40 Jesse Phillips via Digitalmars-d-learn wrote: > On Thursday, 31 August 2017 at 18:26:33 UTC, Sergei Degtiarev > > wrote: > > Hi, > > I tried to create a simple range concatenating several files, > > > > something like this: > > File[] files; > > >

Re: std.algorithm.joiner unexpected behavior

2017-08-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, August 31, 2017 14:09:55 H. S. Teoh via Digitalmars-d-learn wrote: > On Thu, Aug 31, 2017 at 01:34:39PM -0600, Jonathan M Davis via > Digitalmars-d-learn wrote: [...] > > > In general, byLine does not work with other range-based algorithms > > precisely because

Re: Valid File Path

2017-08-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, August 31, 2017 23:23:17 Vino via Digitalmars-d-learn wrote: > On Thursday, 31 August 2017 at 21:59:22 UTC, vino wrote: > > Hi All, > > > > Can you help me what is wrong in the below program, as the > > > > output is empty. > > > > import std.stdio, std.path; > > > > void main () > >

Re: traits for function having actual source declaration?

2017-09-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 01, 2017 14:38:38 bitwise via Digitalmars-d-learn wrote: > When I'm using __traits(allMembers), I get a all the invisible > functions added by the compiler as well "__ctor", "__xdtor", > "__cpctor", etc.. > > Is there a way to filter them out? You can use std.meta.Filter if y

Re: get parameter names

2017-09-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 01, 2017 20:58:20 EntangledQuanta via Digitalmars-d- learn wrote: > template(A, B...) > { > auto foo(C...)(C c) > { > ... get c's parameter names, should be alpha, beta > } > } > > > foo!(., .)(alpha, beta) > > I need the actual identifiers passed to foo. I

Re: Crazy compile time errors with DMD 2.075.1 & 2.076.0

2017-09-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, September 03, 2017 21:22:14 Ali Çehreli via Digitalmars-d-learn wrote: > On 09/03/2017 09:03 PM, Joel wrote: > > One of my small programs doesn't compile any more since, said, DMD > > versions. > > > > I've got other programs that do work, but I can't see what's different > > about

Re: fromStringz for wide characters

2017-09-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 05, 2017 08:15:04 John Burton via Digitalmars-d-learn wrote: > std.string.fromStringz will create me a string from a null > terminated array of characters. But I have a zero terminated > array of "short"s (from a win32 api call) which I'd like to turn > into a wstring. But th

Re: Making a repo of downloaded dub package

2017-09-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 05, 2017 07:52:03 Rene Zwanenburg via Digitalmars-d- learn wrote: > On Tuesday, 5 September 2017 at 06:23:26 UTC, Dukc wrote: > > On Monday, 4 September 2017 at 20:31:35 UTC, Igor wrote: > >> Search for word "local" here: > >> https://code.dlang.org/docs/commandline. Maybe som

Re: Finding chars in strings

2017-09-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 05, 2017 17:55:20 ag0aep6g via Digitalmars-d-learn wrote: > On 09/05/2017 05:43 PM, Per Nordlöw wrote: > > If a character literal has type char, always below 128, can we always > > search for it's first byte offset in a string without decoding the > > string to a range of dch

Re: Finding chars in strings

2017-09-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 05, 2017 18:04:16 ag0aep6g via Digitalmars-d-learn wrote: > On 09/05/2017 05:54 PM, Per Nordlöw wrote: > > Follow up question: If a character literal has type char, can we always > > assume it's an ASCII character? > > Strictly speaking, this is a character literal of type ch

Re: run unittest inside program

2017-09-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 06, 2017 02:06:59 Psychological Cleanup via Digitalmars-d-learn wrote: > Is it possible to run a unit test without adding -unittest to the > command line? > > unittest X > { > pragma(msg, "Boo!"); > } > > X; > > void main() { } No. Without -unittest, the unittest block

Re: How to use encode and decode of std.utf

2017-09-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, September 10, 2017 00:05:42 ag0aep6g via Digitalmars-d-learn wrote: > On 09/09/2017 11:54 PM, solidstate1991 wrote: > > There's not much deep documentation about the functions, and I'm > > interested if it can decode into UTF16 from UTF8. > > toUTF16 can transcode from UTF-8. As linked

Re: Ranges seem awkward to work with

2017-09-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 12, 2017 13:47:47 Azi Hassan via Digitalmars-d-learn wrote: > On Tuesday, 12 September 2017 at 01:13:29 UTC, Hasen Judy wrote: > > Now, a lot of library functions seem to expect ranges as inputs > > and return ranges as output. > > Unless I'm mistaken, it was done on purpose

Re: Is there any threadsafe queue?

2017-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 13, 2017 07:51:19 John Burton via Digitalmars-d- learn wrote: > Is there any threadsafe queue in the standard library? > I've not been able to find anything but thought I'd check before > making my own. > > I want to be able to assemble messages (Which are just streams of >

Re: extern(C) enum

2017-09-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 15, 2017 04:15:57 bitwise via Digitalmars-d-learn wrote: > I translated the headers for FreeType2 to D, and in many cases, > enums are used as struct members. > > If I declare an extern(C) enum in D, is it guaranteed to have the > same underlying type and size as it would for

Re: extern(C) enum

2017-09-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 15, 2017 15:35:48 bitwise via Digitalmars-d-learn wrote: > On Friday, 15 September 2017 at 07:24:34 UTC, Jonathan M Davis > > wrote: > > On Friday, September 15, 2017 04:15:57 bitwise via > > > > Digitalmars-d-learn wrote: > >> I translated the headers for FreeType2 to D, and

Re: extern(C) enum

2017-09-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 15, 2017 19:04:56 jmh530 via Digitalmars-d-learn wrote: > On Friday, 15 September 2017 at 18:20:06 UTC, Jonathan M Davis > > wrote: > > It is my understanding that for both C and C++, an enum is > > always an int (unless you're talking about enum classes in > > C++). The size o

Re: floating point value rounded to 6digits

2017-09-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 19, 2017 19:35:15 Steven Schveighoffer via Digitalmars-d-learn wrote: > On 9/19/17 7:28 PM, Ivan Kazmenko wrote: > > On Tuesday, 19 September 2017 at 22:44:06 UTC, greatsam4sure wrote: > >> On Tuesday, 19 September 2017 at 21:52:57 UTC, Ivan Kazmenko wrote: > >>> On Tuesday,

Re: What the hell is wrong with D?

2017-09-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 20, 2017 02:16:16 EntangledQuanta via Digitalmars-d- learn wrote: > On Tuesday, 19 September 2017 at 21:17:53 UTC, nkm1 wrote: > > On Tuesday, 19 September 2017 at 17:40:20 UTC, EntangledQuanta > > > > wrote: > >> Yeah, that is really logical! No wonder D sucks and has so >

Re: [OT] Converting booleans to numbers

2017-09-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 20, 2017 21:13:58 nkm1 via Digitalmars-d-learn wrote: > OTOH, booleans being numbers is a source of some bugs (just like > other cases of weak typing). Not a ton of bugs, but the utility > of implicit conversion to numbers is so unnoticeable that I'm > sure it's just not wo

Re: Real beginner traits question

2017-09-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, September 25, 2017 05:28:13 WhatMeForget via Digitalmars-d-learn wrote: > This is taken exactly from the traits documentation. > > > > 25 Traits > > 25.21 identifier > > Takes one argument, a symbol. Returns the identifier for that > symb

Re: Is this defined behaviour in D?

2017-09-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, September 25, 2017 13:06:56 John Burton via Digitalmars-d-learn wrote: > If I have a int* pointer for example, that points to the start of > an int array and step through the array until I get the value > 123, is it defined in D what happens if you step off the end of > the array? > > W

Re: htod (8.52.5n) not recognizing wchar_t?

2017-09-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 26, 2017 07:33:57 DanielG via Digitalmars-d-learn wrote: > According to this page (https://dlang.org/htod.html), wchar_t > should be recognized as wchar. But I'm just getting an error: > "Error: ')' expected" ... anywhere a wchar_t appears in my .h > file. > > Anything I need

Re: Is it possible to specify the address returned by the address of operator?

2017-09-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 27, 2017 22:01:26 DreadKyller via Digitalmars-d- learn wrote: > Also off-topic slightly, but am I the only one with massive > latency on this site? It took like almost 2 minutes from me > hitting reply before this page showed up, and my last few posts > took like a minute to

Re: Day of week from date

2017-09-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 29, 2017 04:32:44 rikki cattermole via Digitalmars-d- learn wrote: > On 29/09/2017 4:25 AM, Joel wrote: > > With a given date, I want to know what day it is (like Sunday, Monday, > > etc). > > > > I had a look up on std.datetime, and core.time, but they don't seem to > > have a

Re: Day of week from date

2017-09-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 29, 2017 14:34:04 aberba via Digitalmars-d-learn wrote: > On Friday, 29 September 2017 at 03:42:18 UTC, Jonathan M Davis > > wrote: > > On Friday, September 29, 2017 04:32:44 rikki cattermole via > > > > Digitalmars-d- learn wrote: > >> On 29/09/2017 4:25 AM, Joel wrote: > >> >

Re: splitter string/char different behavior

2017-09-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, September 30, 2017 20:18:25 Jon Degenhardt via Digitalmars-d- learn wrote: > On Saturday, 30 September 2017 at 17:17:17 UTC, SrMordred wrote: > > writeln( "a.b.c".splitter('.').dropBack(1) ); //compiles ok > > writeln( "a.b.c".splitter(".").dropBack(1) ); > > > > //error: > > Error: te

Re: splitter string/char different behavior

2017-09-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 01, 2017 00:56:23 SrMordred via Digitalmars-d-learn wrote: > > In order to know where to split, it really has to do it from > > the front. If it starts from the back, you won't necessarily > > split in the same places as when iterating from the front, and > > that would violate

Re: [Template] Mixins and foreach

2017-09-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 01, 2017 02:07:26 Nicholas Wilson via Digitalmars-d-learn wrote: > On Sunday, 1 October 2017 at 01:05:56 UTC, Nicholas Wilson wrote: > > struct MyType > > { > > > > void* raw; > > static struct Info > > { > > > > @(42) int foo; > > > > } > > mixin gen

Re: [Template] Mixins and foreach

2017-09-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 01, 2017 03:11:15 Nicholas Wilson via Digitalmars-d-learn wrote: > On Sunday, 1 October 2017 at 02:29:57 UTC, Jonathan M Davis wrote: > > I would have thought that it would be pretty straightforward to > > just write a recursive, eponymous template to solve the problem > > and h

Re: @property with 2 arguments

2017-09-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 01, 2017 05:57:53 Tony via Digitalmars-d-learn wrote: > "@property functions can only have zero, one or two parameters" > > I am looking for an example of an @property function defined with > two parameters and the syntax for how it is accessed without (). If it has two paramete

Re: [Template] Mixins and foreach

2017-10-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 01, 2017 06:32:53 Nicholas Wilson via Digitalmars-d-learn wrote: > On Sunday, 1 October 2017 at 06:27:21 UTC, Nicholas Wilson wrote: > > And am getting > > util.d(72,12): Error: template instance helper!(foo) cannot use > > local 'foo' as parameter to non-global template > > hel

Re: When to opCall instead of opIndex and opSlice?

2017-10-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 02, 2017 18:31:23 Per Nordlöw via Digitalmars-d-learn wrote: > On Monday, 2 October 2017 at 18:14:24 UTC, Jacob Carlborg wrote: > > On 2017-10-02 17:57, Nordlöw wrote: > >> Is implementing opCall(size_t) for structures such as array > >> containers that already define opIndex an

Re: Should this Compile?

2017-10-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 03, 2017 22:42:35 SamwiseFilmore via Digitalmars-d-learn wrote: > On Tuesday, 3 October 2017 at 22:37:17 UTC, SamwiseFilmore wrote: > > Am I using the ternary operator correctly here, or is this an > > issue with dmd? I'm using dmd v2.076.0. > > I wrapped the ternary in parenth

Re: conversion error related to array index

2017-10-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 04, 2017 09:04:10 thorstein via Digitalmars-d-learn wrote: > Hi, > > I get the following compile error with this function below: > source\mod_data\matrices.d(66,12): Error: cannot implicitly > convert expression (j) of type ulong to uint > > (66,12) is [j] in row[j] > > Using

Re: Does writing from NNTP work?

2017-10-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 04, 2017 17:26:36 ketmar via Digitalmars-d-learn wrote: > Tristan B. Kildaire wrote: > > Does this work? > > btw. there is "D" newsgroup which you can use for testing your NNTP > client. > > web interface: http://forum.dlang.org/group/D > NNTP name: "D" You can also just pos

Re: dmd path handling is a bit dated

2017-10-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 06, 2017 20:11:25 Laeeth Isharc via Digitalmars-d-learn wrote: > And I'm posting here because we can submit a pull request, but I > didn't know whether to call Phobos or copy/paste as I haven't > submitted more than trivial doc changes to compiler. I've > written all of this up

Re: Double ended arrays?

2017-10-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, October 07, 2017 07:38:47 Chirs Forest via Digitalmars-d-learn wrote: > I have some data that I want to store in a dynamic 2d array... > I'd like to be able to add elements to the front of the array and > access those elements with negative integers as well as add > numbers to the bac

Re: Huge increase in UT compile time

2017-10-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 11, 2017 06:25:19 Dhananjay via Digitalmars-d-learn wrote: > Hello, > > I am upgrading to DMD 2.076.1 from DMD 2.069.2 (similar results > on 2.075.1), and seeing a huge increase in unittest compilation > time when the -deps parameter is also passed to dmd. This is on > both O

Re: Assert and undefined behavior

2017-10-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 11, 2017 09:27:49 John Burton via Digitalmars-d-learn wrote: > The spec says this :- > > "As a contract, an assert represents a guarantee that the code > must uphold. Any failure of this expression represents a logic > error in the code that must be fixed in the source code.

Re: Fast removal of character

2017-10-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 11, 2017 22:22:43 Johan Engelen via Digitalmars-d- learn wrote: > std.string.removechars is now deprecated. > https://dlang.org/changelog/2.075.0.html#pattern-deprecate > > What is now the most efficient way to remove characters from a > string, if only one type of character n

Re: Fast removal of character

2017-10-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 11, 2017 23:06:13 Johan Engelen via Digitalmars-d- learn wrote: > I am disappointed to see functions being deprecated, without an > extensive documentation of how to rewrite them for different > usage of the deprecated function. It makes me feel that no deep > thought went int

Re: Assert and undefined behavior

2017-10-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 12, 2017 20:15:41 kdevel via Digitalmars-d-learn wrote: > On Thursday, 12 October 2017 at 15:37:23 UTC, John Burton wrote: > > C++ compilers can and do perform such optimizations so I was > > wondering if assert in D could cause such behavior according to > > the spec. > > In t

Re: Assert and undefined behavior

2017-10-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 12, 2017 21:22:29 kdevel via Digitalmars-d-learn wrote: > On Thursday, 12 October 2017 at 20:27:03 UTC, Jonathan M Davis > > wrote: > > On Thursday, October 12, 2017 20:15:41 kdevel via > > > >> --- > >> void main () > >> { > >> > >> assert (false); > >> > >> } > >> --- > >

Re: Get and add to function body

2017-10-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 12, 2017 23:33:39 Psychological Cleanup via Digitalmars-d-learn wrote: > Is there any way to get the function body of a function, > delegate, and lambda? I'd also like to extend functions by > "wrapping" them at compile time generically. For example, I'd > like to get all the

Re: Does D have an equivalent to C#'s String.IsNullOrWhiteSpace?

2017-10-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 13, 2017 07:36:28 bauss via Digitalmars-d-learn wrote: > On Thursday, 12 October 2017 at 18:17:54 UTC, Adam D. Ruppe wrote: > > On Thursday, 12 October 2017 at 18:11:55 UTC, Nieto wrote: > >> Does D have an equivalent to C#'s String.IsNullOrWhiteSpace() > >> in the standard libra

Re: Does D have an equivalent to C#'s String.IsNullOrWhiteSpace?

2017-10-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 13, 2017 02:12:21 Jonathan M Davis via Digitalmars-d- learn wrote: > On Friday, October 13, 2017 07:36:28 bauss via Digitalmars-d-learn wrote: > > On Thursday, 12 October 2017 at 18:17:54 UTC, Adam D. Ruppe wrote: > > > On Thursday, 12 October 2017 at 18:11:5

Re: Assert and undefined behavior

2017-10-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 13, 2017 11:26:54 kdevel via Digitalmars-d-learn wrote: > On Friday, 13 October 2017 at 02:22:24 UTC, Jonathan M Davis > > wrote: > > You've told it that i should never be 3 at that point and that > > it's a bug if it is, and as such, it is free to assume that i > > is never 3 af

Re: Is there an opposite of .toString()?

2017-10-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, October 14, 2017 00:18:35 myst via Digitalmars-d-learn wrote: > I'm sorry if this has been answered already, it seems like a very > basic question. > > There is .toString() method convention for printing, but I can > not find anything alike for reading. Is there something like > operat

Re: Assert and undefined behavior

2017-10-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, October 14, 2017 05:20:47 Jesse Phillips via Digitalmars-d- learn wrote: > The point is assert tells the compiler something it can use to > reason about its job, not that it can insert additional runtime > checks to see if you code is invalid an then add new jumps to > execute whatever

Re: How to overload with enum type?

2017-10-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 15, 2017 08:47:42 Domain via Digitalmars-d-learn wrote: > void f(int i) > { > writeln("i"); > } > > void f(E)(E e) if (is(E == enum)) > { > writeln("e"); > } > > enum E { A } > E e = E.A; > f(e);// output i > > How can I overload with enum type? I'd strongly advise

Re: testing if data is allocated on the stack or heap

2017-10-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 17, 2017 18:33:02 drug via Digitalmars-d-learn wrote: > My code fails and I guess the reason is I have a slice to data in the > stack and it becomes garbage in some moment. So I need a way to check > where data is placed. Is it right that it can be done in linux using > `sbrk` s

Re: Making template instantiations more lazy

2017-10-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 18, 2017 09:13:47 Per Nordlöw via Digitalmars-d-learn wrote: > Are there any nearby plans to make more template instantiations > (especially aggregate members) lazy in DMD? > > Are there any specific obstacles against doing that or has it > just not been prioritized? Templat

Re: Making template instantiations more lazy

2017-10-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 18, 2017 10:36:41 Per Nordlöw via Digitalmars-d-learn wrote: > On Wednesday, 18 October 2017 at 10:17:38 UTC, Biotronic wrote: > > Make them templates, that should solve the problem: > > > > struct S(T) { > > > > void foo()() { > > > > compileerror; > > > > }

Re: is(this : myClass)

2017-10-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 20, 2017 21:32:48 Patrick via Digitalmars-d-learn wrote: > The compiler seems to reject the following code in a class method: > > bool test = is(this : myClass); > > Could some please explain this? "this" is not a type. is(T : U) is true if T is implicitly convertible to U. T an

Re: Getting a safe path for a temporary file

2017-10-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 22, 2017 15:21:37 Shriramana Sharma via Digitalmars-d- learn wrote: > On Saturday, 17 January 2015 at 17:16:41 UTC, Tobias Pankrath > > wrote: > > You're looking for core.sys.posix.stdlib : mkstemp. > > > > I think that should be used by std.stdio.File as well, care to > > create

Re: writeln double precision

2017-10-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 24, 2017 16:59:31 Arun Chandrasekaran via Digitalmars-d- learn wrote: > On Tuesday, 24 October 2017 at 16:18:03 UTC, H. S. Teoh wrote: > > On Tue, Oct 24, 2017 at 10:02:11AM +, Arun Chandrasekaran > > > > via Digitalmars-d-learn wrote: > >> On Monday, 23 October 2017 at 18:0

Re: DateTime trying to do it at compile time.

2017-10-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 26, 2017 17:55:05 Mr. Jonse via Digitalmars-d-learn wrote: > C:\D\dmd2\windows\bin\..\..\src\phobos\std\concurrency.d(2395): > Error: variable lock cannot be modified at compile time > C:\D\dmd2\windows\bin\..\..\src\phobos\std\concurrency.d(2422): > called from here: in

Re: Empty UDA for classes not allowed?

2017-10-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 26, 2017 15:09:48 bauss via Digitalmars-d-learn wrote: > Why is it not allowed to have empty UDAs for classes? > > Let's say we have an UDA like this: > struct Exclude { } > > Then we want to put it on a class like: > > @Exclude class Foo > { > ... > } > > This will fail w

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