[Issue 18456] crt_constructor/crt_destructor segfaults if -lib

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18456

Илья Ярошенко  changed:

   What|Removed |Added

   Severity|normal  |blocker

--


[Issue 18456] crt_constructor/crt_destructor segfaults if -lib

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18456

Илья Ярошенко  changed:

   What|Removed |Added

   Keywords||betterC

--


[Issue 18456] New: crt_constructor/crt_destructor segfaults if -lib

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18456

  Issue ID: 18456
   Summary: crt_constructor/crt_destructor segfaults if -lib
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ilyayaroshe...@gmail.com

pragma(crt_constructor)
extern(C) void mir_cpuid_crt_init()
{
}

dmd -lib -oflibmir-cpuid.a source.d
Segmentation fault: 11

--


Re: New abstraction: Layout

2018-02-17 Thread psychoRabbit via Digitalmars-d

On Saturday, 17 February 2018 at 09:30:23 UTC, thedeemon wrote:
On Saturday, 17 February 2018 at 00:04:16 UTC, Andrei 
Alexandrescu wrote:
The implementation turned out to be quite compact - 81 lines 
including a compile-time mergesort. Destroy!


Off-topic:
I've just realized Andrei puts "Destroy!" at the end of his 
messages because it's the end of scope and he wants to free any 
allocated resources. ;)


We're talking about Andrei here, so it's far more likely 
'destroy' is an efficient, compact, generic term, that can take 
on many different meanings - depending on the context in which it 
used.


'D'estroy!



Re: How to represent multiple files in a forum post?

2018-02-17 Thread Jonathan Marler via Digitalmars-d

On Saturday, 17 February 2018 at 22:11:28 UTC, Martin Nowak wrote:
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler 
wrote:
@timotheecour and I came up with a solution to a common 
problem:


How to represent multiple files in a forum post?


Oh, I thought it already was a standard, but 
[.har](https://en.wikipedia.org/wiki/.har) is JSON based and 
very different, so the name is already taken.


Have you done some proper research for existing standards?
There is a 50 year old technique to use ASCII file separators 
(https://stackoverflow.com/a/18782271/2371032). Sure we can 
find some existing ones.
We recently wondered how gcc/llvm test codegen, at least in gcc 
or gdb I've seen a custom test case format.


Those seem to be binary control characters, they also don't allow 
you to specify the filename...how does that solve the problem of 
being able to represent multiple files in a forum post?


If there is an existing standard that's great, I wasn't able to 
find one.  If you find one let me know.


Re: Anybody still using the chm docs

2018-02-17 Thread Manu via Digitalmars-d
On 17 February 2018 at 18:32, Danni Coy  wrote:

> On Sun, Feb 18, 2018 at 11:10 AM, Manu  wrote:
>
>> On 17 February 2018 at 16:52, Danni Coy  wrote:
>>
>>> Is the reason for favouring chm as a format that it fits in with the
>>> visual studio ecosystem better?
>>> Having used both pdf and chm help on Linux I don't see a huge amount of
>>> difference between competent reading applications.
>>>
>>
>> CHM has a competent search and index feature.
>>
>
> Isn't that more up to application than the documentation format?
>

The index is part of the CHM format.


Re: Anybody still using the chm docs

2018-02-17 Thread Seb via Digitalmars-d

On Saturday, 17 February 2018 at 21:23:25 UTC, Manu wrote:
On 17 February 2018 at 07:04, Martin Nowak via Digitalmars-d < 
digitalmars-d@puremagic.com> wrote:



[...]




Wait, what? You asked if people used them, found that they did, 
then pulled

the plug anyway? O_o
Try running WINE on the build machine... it's trivial to setup.


It's marked as "[temporarily]".
Also from GH where Vladimir tried to add chmgen to dlang.org's CI.


[...]
No hurries, I'll disable the d.chm build for now so I can build 
the beta and we can decide on readding or removing later.


https://github.com/dlang/dlang.org/pull/2213


Re: Anybody still using the chm docs

2018-02-17 Thread Danni Coy via Digitalmars-d
On Sun, Feb 18, 2018 at 11:10 AM, Manu  wrote:

> On 17 February 2018 at 16:52, Danni Coy  wrote:
>
>> Is the reason for favouring chm as a format that it fits in with the
>> visual studio ecosystem better?
>> Having used both pdf and chm help on Linux I don't see a huge amount of
>> difference between competent reading applications.
>>
>
> CHM has a competent search and index feature.
>

Isn't that more up to application than the documentation format?


Re: Anybody still using the chm docs

2018-02-17 Thread Manu via Digitalmars-d
On 17 February 2018 at 16:52, Danni Coy  wrote:

> Is the reason for favouring chm as a format that it fits in with the
> visual studio ecosystem better?
> Having used both pdf and chm help on Linux I don't see a huge amount of
> difference between competent reading applications.
>

CHM has a competent search and index feature.


Re: Annoyance with new integer promotion deprecations

2018-02-17 Thread Manu via Digitalmars-d
On 5 February 2018 at 11:22, H. S. Teoh via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> Code:
>
> struct S {
> byte[2] x;
> }
> void main() {
> S s, t;
> s.x = [ 1, -1 ];// OK
> t.x = [ -s.x[0], -s.x[1] ]; // NG (line 7)
> }
>
>
> Compiler says:
> /tmp/test.d(7): Deprecation: integral promotion not done for
> `-s.x[0]`, use '-transition=intpromote' switch or `-cast(int)(s.x[0])`
> /tmp/test.d(7): Deprecation: integral promotion not done for
> `-s.x[1]`, use '-transition=intpromote' switch or `-cast(int)(s.x[1])`
>
>
> Why should I need to explicitly cast to int only to reassign it back to
> byte?!  This is ridiculous.


Seriously, WTF is going on here?


Re: Project Highlight: The D Community Hub

2018-02-17 Thread Mike Parker via Digitalmars-d-announce

On Saturday, 17 February 2018 at 14:40:30 UTC, Basile B. wrote:



BTW i wanted to ask, you live in Korea right ? What are you 
doing over there ?
You don't have at all the Asian physical style. Maybe because 
of work or GF ?


Came here in '91 in the U.S. Army, got out in '94 and stayed to 
make some money for a few years, married in '99, and now I'm a 
permanent resident. I've been a freelance teacher/tutor of one 
form or another for most of that time. These days I do very 
little actual teaching and mostly get paid to edit research 
papers, help high school students with their homework (I started 
teaching one kid when he was 6 and he starts high school this 
year), and otherwise talk to people in English two or three hours 
a week.


Re: Anybody still using the chm docs

2018-02-17 Thread Walter Bright via Digitalmars-d

On 2/17/2018 7:04 AM, Martin Nowak wrote:
Let's pull the plug, I think everybody agrees that we have more important issues 
than maintaining d.chm and dman (which hasn't been shipped since 2.076 anyhow).

Consider both tools as offered for adoption (as an external service or 
download).

https://github.com/dlang/installer/pull/298



I find dman very useful, as I'm a command line sorta guy. In fact, I wrote it 
because it's a major convenience for me.


Re: Anybody still using the chm docs

2018-02-17 Thread Danni Coy via Digitalmars-d
Is the reason for favouring chm as a format that it fits in with the visual
studio ecosystem better?
Having used both pdf and chm help on Linux I don't see a huge amount of
difference between competent reading applications.

On Sun, Feb 18, 2018 at 7:23 AM, Manu via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> On 17 February 2018 at 07:04, Martin Nowak via Digitalmars-d <
> digitalmars-d@puremagic.com> wrote:
>
>> On Wednesday, 15 June 2016 at 10:58:04 UTC, Martin Nowak wrote:
>>
>>> It's a huge maintenance effort for us to produce the chm files.
>>> We no longer generate documentation on Windows, but just for the chm
>>> generation we have dedicated tools [¹] to create an index (from a json
>>> generated via ddoc) and copy the html files.
>>> So I'm wondering if in 2016 someone really needs an offline copy of a
>>> website shipped with a binary release?
>>>
>>
>> Let's pull the plug, I think everybody agrees that we have more important
>> issues than maintaining d.chm and dman (which hasn't been shipped since
>> 2.076 anyhow).
>> Consider both tools as offered for adoption (as an external service or
>> download).
>>
>> https://github.com/dlang/installer/pull/298
>
>
>
> Wait, what? You asked if people used them, found that they did, then
> pulled the plug anyway? O_o
> Try running WINE on the build machine... it's trivial to setup.
>


Re: Status of @nogc with the runtime

2018-02-17 Thread Peter Campbell via Digitalmars-d
On Saturday, 17 February 2018 at 23:43:07 UTC, Adam D. Ruppe 
wrote:
On Saturday, 17 February 2018 at 18:03:44 UTC, Peter Campbell 
wrote:
Andrei mentioned at his DConf presentations is that the 
runtime itself will be modified to not rely on the GC, 
allowing for you to continue using features such as 
associative arrays and array concatenation, but without 
requiring the garbage collector. Is my understanding correct?


I haven't heard anything about that, and I doubt it would 
happen. How would you actually manage the memory? The 
front-facing api there doesn't offer any access to it.


But, of course, it is quite easy to write your own types that 
do the same stuff (including operator overloading, of course) 
that do expose memory management, and you can use those with or 
without the runtime.


The first time I heard about this was the DConf 2016 keynote: 
https://www.youtube.com/watch?v=4oDK91E3VKs=youtu.be=2023


Andrei discusses a reference counting based approach however 
there are requirements which make it difficult to implement in 
the runtime. It's also mentioned in both the 2017 vision 
documents on the wiki.


Re: Status of @nogc with the runtime

2018-02-17 Thread Adam D. Ruppe via Digitalmars-d
On Saturday, 17 February 2018 at 18:03:44 UTC, Peter Campbell 
wrote:
Andrei mentioned at his DConf presentations is that the runtime 
itself will be modified to not rely on the GC, allowing for you 
to continue using features such as associative arrays and array 
concatenation, but without requiring the garbage collector. Is 
my understanding correct?


I haven't heard anything about that, and I doubt it would happen. 
How would you actually manage the memory? The front-facing api 
there doesn't offer any access to it.


But, of course, it is quite easy to write your own types that do 
the same stuff (including operator overloading, of course) that 
do expose memory management, and you can use those with or 
without the runtime.


Re: Status of @nogc with the runtime

2018-02-17 Thread Peter Campbell via Digitalmars-d

On Saturday, 17 February 2018 at 19:32:50 UTC, bachmeier wrote:
On Saturday, 17 February 2018 at 18:03:44 UTC, Peter Campbell 
wrote:


My understanding from the vision documents and what Andrei 
mentioned at his DConf presentations is that the runtime 
itself will be modified to not rely on the GC, allowing for 
you to continue using features such as associative arrays and 
array concatenation, but without requiring the garbage 
collector. Is my understanding correct? If so is work still 
being done to make this happen


Andrei recently said something about an announcement coming, 
but I don't have any details. 
https://www.reddit.com/r/programming/comments/7vw0gj/vanquish_forever_these_bugs_that_blasted_your/dtwb6fv/


What a tease, but that sounds promising :)


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn

On Saturday, 17 February 2018 at 14:54:37 UTC, ag0aep6g wrote:
Nordlöw's methods are only weakly pure. They have mutable 
indirections either in the return type or in a parameter type. 
So calls to them should not be optimized away.


I found a solution at

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d

currently successfully used at

https://github.com/nordlow/phobos-next/blob/master/src/open_hashmap_or_hashset.d

Works for me.

Thanks!


Re: How to represent multiple files in a forum post?

2018-02-17 Thread Martin Nowak via Digitalmars-d
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler 
wrote:

@timotheecour and I came up with a solution to a common problem:

How to represent multiple files in a forum post?


Oh, I thought it already was a standard, but 
[.har](https://en.wikipedia.org/wiki/.har) is JSON based and very 
different, so the name is already taken.


Have you done some proper research for existing standards?
There is a 50 year old technique to use ASCII file separators 
(https://stackoverflow.com/a/18782271/2371032). Sure we can find 
some existing ones.
We recently wondered how gcc/llvm test codegen, at least in gcc 
or gdb I've seen a custom test case format.


[Issue 17643] std.traits.getSymbolsByUDA doesn't work with private attributes

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17643

Mitu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||the.mail.of@gmail.com
 Resolution|--- |DUPLICATE

--- Comment #5 from Mitu  ---
It duplicates the #15335, which - despite the merged PR - still persists or
have been revived.

*** This issue has been marked as a duplicate of issue 15335 ***

--


[Issue 15335] getSymbolsByUDA fails if type has private members

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15335

Mitu  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #9 from Mitu  ---
*** Issue 17643 has been marked as a duplicate of this issue. ***

--


[Issue 15335] getSymbolsByUDA fails if type has private members

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15335

Mitu  changed:

   What|Removed |Added

 CC||the.mail.of@gmail.com

--- Comment #8 from Mitu  ---
The bug still persists.

--


Re: Anybody still using the chm docs

2018-02-17 Thread Manu via Digitalmars-d
On 17 February 2018 at 07:04, Martin Nowak via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> On Wednesday, 15 June 2016 at 10:58:04 UTC, Martin Nowak wrote:
>
>> It's a huge maintenance effort for us to produce the chm files.
>> We no longer generate documentation on Windows, but just for the chm
>> generation we have dedicated tools [¹] to create an index (from a json
>> generated via ddoc) and copy the html files.
>> So I'm wondering if in 2016 someone really needs an offline copy of a
>> website shipped with a binary release?
>>
>
> Let's pull the plug, I think everybody agrees that we have more important
> issues than maintaining d.chm and dman (which hasn't been shipped since
> 2.076 anyhow).
> Consider both tools as offered for adoption (as an external service or
> download).
>
> https://github.com/dlang/installer/pull/298



Wait, what? You asked if people used them, found that they did, then pulled
the plug anyway? O_o
Try running WINE on the build machine... it's trivial to setup.


Re: Anybody still using the chm docs

2018-02-17 Thread Manu via Digitalmars-d
On 16 June 2016 at 06:22, Dejan Lekic via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> I still use CHM document as it is absolutely the best solution compared to
>> anything else. I think it is a mistake to compare CHM with PDF... They are
>> made for different things...
>>
>
> I forgot to mention - I use CHM on Linux. It is not my fault that
> opensource community could not come up with a better or/and standardised
> solution... The only standard solution for this that Linux has are man
> pages - clearly not suitable this purpose! Other, better solutions are
> there, but are not adopted by all - Gnome has one format, KDE another,
> etc... CHAOS. Therefore, I decided to use CHM.
>

I approve of this message!
At my old work, we released CHM docs specifically for linux users too. They
preferred the CHM index and searchability compared to PDF or something like
that.


Re: Anybody still using the chm docs

2018-02-17 Thread Manu via Digitalmars-d
On 15 June 2016 at 03:58, Martin Nowak via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> It's a huge maintenance effort for us to produce the chm files.
> We no longer generate documentation on Windows, but just for the chm
> generation we have dedicated tools [¹] to create an index (from a json
> generated via ddoc) and copy the html files.
> So I'm wondering if in 2016 someone really needs an offline copy of a
> website shipped with a binary release?
>
> https://github.com/dlang/dlang.org/pull/1374
>
> [¹]:
> https://github.com/dlang/dlang.org/blob/7cc6e938154f90aa49fa
> 6451a85b13e35ab2de99/chmgen.d
>

I like the CHM docs.
I have encountered the same maintenance problem before, where build infra
is linux based, and the CHM docs need a windows machine to build... I
solved this problem by building the CHM via WINE ;)
Maybe this is a possible solution?


Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-17 Thread Jordi Sayol via Digitalmars-d-learn
El 17/02/18 a les 18:49, Martin Tschierschke via Digitalmars-d-learn ha escrit:
> But the installation via apt-get is not working without the steps already 
> mentioned in the post before! (s/http/https/  and manually import of the 
> public key)

"d-apt.list" file fixed! (s/http/https/)

d-apt public key is in the "d-apt-keyring" deb package, so you don't have to 
manually install it.

> 
> This (from https://dlang.org/download.html) is outdated for 17.10.
> 
> sudo wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O 
> /etc/apt/sources.list.d/d-apt.list
> sudo apt-get update && sudo apt-get -y --allow-unauthenticated install 
> --reinstall d-apt-keyring
> sudo apt-get update && sudo apt-get install dmd-compiler dub

It appears that everything should work on 17.10 now. I'll do more tests on a 
virtual machine.




Re: Visual D >> TRACKER : error TRK0004: Failed to locate: "FileTracker32.dll". The system cannot find the file specified.

2018-02-17 Thread Saravana Kumar Arumugam via Digitalmars-d-learn
On Saturday, 17 February 2018 at 20:30:16 UTC, Saravana Kumar 
Arumugam wrote:
...Make sure you also renamed the file "FileTrackerUI.dll" to 
"FileTracker32UI.dll" in the latest LCID folder...


Don't forget to make copy!! That'll bring you even more problems 
while compiling other projects! It worked for me!





Re: Visual D >> TRACKER : error TRK0004: Failed to locate: "FileTracker32.dll". The system cannot find the file specified.

2018-02-17 Thread Saravana Kumar Arumugam via Digitalmars-d-learn

On Friday, 2 February 2018 at 08:56:45 UTC, Markus wrote:
On Tuesday, 21 November 2017 at 04:39:52 UTC, A Guy With a 
Question wrote:
I'm trying to learn D using Visual D in Visual Studio 
Community 2015. Both dmd and ldc give me this error when 
building from Visual Studio. Any ideas? I'm able to build C++ 
projects...


I had to update "Visual Studio 2015 Update 2" to "Visual Studio 
2015 Update 3" to resolve that issue.


Another way is just copy and rename "FileTracker.dll" to 
"FileTracker32.dll" in "%ProgramFiles%\MSBuild\\Bin" 
folder. Make sure you also renamed the file "FileTrackerUI.dll" 
to "FileTracker32UI.dll" in the latest LCID folder (latest 
numbered folder in same location).


But that's the hard fix. Probably MSBuid issue.


Re: New abstraction: Layout

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d

On 2/17/18 9:59 AM, Andrei Alexandrescu wrote:

On 02/17/2018 09:03 AM, Steven Schveighoffer wrote:

I found this also works:

static foreach(alias x; S.tupleof)
{
    writeln(x.offsetof);
}


Yes, the implementation uses offsetof.



I guess I'm just confused based on the statement "the builtin .tupleof 
... [omits] the essential information of field offsets."


What is this construct giving us that .tupleof doesn't?

-Steve


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d-learn

On 2/17/18 9:54 AM, ag0aep6g wrote:

On 02/17/2018 03:04 PM, Steven Schveighoffer wrote:
You have to be a bit careful here. pure functions can assume nothing 
is happening and simply not call the function.


That's only a problem when the called function is strongly pure, right?

Nordlöw's methods are only weakly pure. They have mutable indirections 
either in the return type or in a parameter type. So calls to them 
should not be optimized away.


That's fine as long as you aren't going to use the allocator to make any 
immutable or const data ;)


-Steve


Re: Status of @nogc with the runtime

2018-02-17 Thread bachmeier via Digitalmars-d
On Saturday, 17 February 2018 at 18:03:44 UTC, Peter Campbell 
wrote:


My understanding from the vision documents and what Andrei 
mentioned at his DConf presentations is that the runtime itself 
will be modified to not rely on the GC, allowing for you to 
continue using features such as associative arrays and array 
concatenation, but without requiring the garbage collector. Is 
my understanding correct? If so is work still being done to 
make this happen


Andrei recently said something about an announcement coming, but 
I don't have any details. 
https://www.reddit.com/r/programming/comments/7vw0gj/vanquish_forever_these_bugs_that_blasted_your/dtwb6fv/




Re: Status of @nogc with the runtime

2018-02-17 Thread Peter Campbell via Digitalmars-d
On Saturday, 17 February 2018 at 12:32:04 UTC, Mike Franklin 
wrote:
There are a number of ways to use D without the garbage 
collector.  However, one of the easiest is with the -betterC 
flag.  You'll want to read the two blog articles here 
(https://dlang.org/blog/category/betterc/) for more information 
about that.


2.079, the upcoming release will also have a way to use D 
without the runtime and without -betterC.  What this allows you 
to do is partially implement just the runtime features you wish 
to support.  You can read more about it in the nightly 
changelog here 
(https://dlang.org/changelog/pending.html#minimal_runtime)


You might also be interested in this article: 
https://wiki.dlang.org/Memory_Management


Mike


I've read about BetterC and I'm interested in the minimal runtime 
feature, that seems like it'll be really cool. But these methods 
requiring not using certain D features which rely on the GC. My 
understanding from the vision documents and what Andrei mentioned 
at his DConf presentations is that the runtime itself will be 
modified to not rely on the GC, allowing for you to continue 
using features such as associative arrays and array 
concatenation, but without requiring the garbage collector. Is my 
understanding correct? If so is work still being done to make 
this happen and is there an easy way to follow the progress?


On Saturday, 17 February 2018 at 12:44:35 UTC, Eugene Wissner 
wrote:
Let me do a bit advertising :) I'm writing a library for @nogc 
D programming, tanya. It has different aims than -betterC: I 
use the full set of D features, just except features that 
require GC. It isn't complete, I'm using it only in personal 
projects and it is also a big learn project for me, so don't 
wonder that it reimplements a lot of features "from scratch" 
and almost doesn't depend on phobos. But if you like to play 
with it, you're welcome:

https://github.com/caraus-ecms/tanya


That's an interesting project, I'll be sure to take a look!

On Saturday, 17 February 2018 at 14:25:41 UTC, Seb wrote:
On Saturday, 17 February 2018 at 12:18:28 UTC, Peter Campbell 
wrote:
The garbage collector in druntime is now lazily initialized on 
the first use:


https://github.com/dlang/druntime/pull/2057

(in master since a few days)


That's really nice to hear 2.079 is looking really cool!


Re: confused with data types

2018-02-17 Thread arturg via Digitalmars-d-learn

double[][] skalar_m_2d(double[][] arr, double skalar)
{
import std.algorithm;
// return arr.map(a=> a[] *= skalar).array;
arr.each!((ref a) => a[] *= skalar));
return arr;
}



Re: Vulkan

2018-02-17 Thread Peter Campbell via Digitalmars-d

On Tuesday, 13 February 2018 at 22:20:15 UTC, Ivan Trombley wrote:
I wanted to do some experimentation with Vulkan using D. None 
of the projects that I found (derelict-vulkan, d-vulkan and 
erupted) work.


Are there D bindings to Vulkan that actually work?


I had success using Vulkan in University by using Derelict-GLFW3 
and Erupted, what issues did you have with them?


Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-17 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 11:23:48 UTC, Andrea Fontana 
wrote:
On Wednesday, 14 February 2018 at 11:16:25 UTC, Martin 
Tschierschke wrote:

Ok, good to know!
I started with 16.04 and made the initial mistake to take the 
32 Bit version,

do you use 32 or 64 Bit?


64bit of course!

Andrea


After this info, I made the step to change to Ubuntu 17.10 64 Bit.
And - it works!

But the installation via apt-get is not working without the steps 
already mentioned in the post before! (s/http/https/  and 
manually import of the public key)


This (from https://dlang.org/download.html) is outdated for 17.10.

sudo wget 
http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list 
-O /etc/apt/sources.list.d/d-apt.list
sudo apt-get update && sudo apt-get -y --allow-unauthenticated 
install --reinstall d-apt-keyring

sudo apt-get update && sudo apt-get install dmd-compiler dub




[Issue 10828] datetime toString functions should accept sink

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10828

--- Comment #14 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/dcdf8b4125669266067e4693e5ddc8ac746ed87b
Fix Issue 10828 - datetime toString functions should accept sink

https://github.com/dlang/phobos/commit/5ccd40cf4ecbe3d073789b4fb3a23e5710a9c520
Merge pull request #6190 from JackStouffer/systime-toISOExtString

Fix Issue 10828 - datetime toString functions should accept sink
merged-on-behalf-of: Jack Stouffer 

--


[Issue 10828] datetime toString functions should accept sink

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10828

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--


Re: confused with data types

2018-02-17 Thread Adam D. Ruppe via Digitalmars-d-learn

On Saturday, 17 February 2018 at 16:12:48 UTC, thorstein wrote:

public double[][] skalar_m_2d(double[][] array, double skalar)
{
  return array.map!(b => b[].map!(c => c * skalar));
}


It'd probably be better to just do that in-place...

foreach(row; array)
  row[] *= skalar;
return array;

Note that'd overwrite the existing data though. But the compiler 
could more aggressively optimize that than the individual maps.



How can I get the result as double[][] ???



But if you do need the double[][] type exactly as well as a new 
copy instead of editing the one you have, you can:


static import std.array;
return std.array.array(array.map!(b => std.array.array(b[].map!(c 
=> c * skalar;



The std.array.array function copies the return value of functions 
like `map` into a new array. It is called twice here because 
double[][] is an array of arrays.


(the word "array" is used way too much there lol)


The reason map doesn't do this automatically btw is because 
copying the arrays can be somewhat expensive, so it doesn't force 
you to do work you don't often need.


Re: confused with data types

2018-02-17 Thread JN via Digitalmars-d-learn

On Saturday, 17 February 2018 at 16:12:48 UTC, thorstein wrote:

Hello,

This was my goal:
-
public double[][] skalar_m_2d(double[][] array, double skalar)
{
  return array.map!(b => b[].map!(c => c * skalar));
}

!!! But: return value is not double!

Type check for return value:

a = array.map!(b => b[].map!(c => c * skalar))
writeln(typeof(a).stringof); //-> MapResult!("__lambda4, 
double[][])


a = array.map!(b => b[].map!(c => c * skalar))[1];
writeln(typeof(a).stringof); //-> MapResult!("__lambda2, 
double[])


How can I get the result as double[][] ???

Thanks, thorstein


I'm no expert, but importing std.array and doing a.array() should 
work.


confused with data types

2018-02-17 Thread thorstein via Digitalmars-d-learn

Hello,

This was my goal:
-
public double[][] skalar_m_2d(double[][] array, double skalar)
{
  return array.map!(b => b[].map!(c => c * skalar));
}

!!! But: return value is not double!

Type check for return value:

a = array.map!(b => b[].map!(c => c * skalar))
writeln(typeof(a).stringof); //-> MapResult!("__lambda4, 
double[][])


a = array.map!(b => b[].map!(c => c * skalar))[1];
writeln(typeof(a).stringof); //-> MapResult!("__lambda2, double[])

How can I get the result as double[][] ???

Thanks, thorstein


[Issue 18455] CI should build Windows debug variant

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18455

Jonathan Marler  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #1 from Jonathan Marler  ---
Turns out debug build worked after cleaning repo and rebuilding, so the
inference that CI is not building windows variant is likely not true after all.

--


[Issue 18454] backend cc.d and type.d unittest failures on windows debug

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18454

Jonathan Marler  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #1 from Jonathan Marler  ---
Is working after cleaning repo and rebuilding.

--


[Issue 18453] make -f win32.mak debdmd broke

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18453

Jonathan Marler  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #1 from Jonathan Marler  ---
I'm not sure what happened, but after I cleaned the repo, it's working now.

--


[Issue 18455] New: CI should build Windows debug variant

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18455

  Issue ID: 18455
   Summary: CI should build Windows debug variant
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: johnnymar...@gmail.com

Since the windows debug build is broken...my guess is that none of our CI
machines are building windows in debug mode.  Probably a good idea to add this.

--


[Issue 18454] New: backend cc.d and type.d unittest failures on windows debug

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18454

  Issue ID: 18454
   Summary: backend cc.d and type.d unittest failures on windows
debug
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: johnnymar...@gmail.com

After building dmd on windows with `make -f win32.mak debdmd`...running dmd.exe
produces the following failed unittests:

core.exception.AssertError@dmd\backend\cc.d(1327): unittest failure

0x005D477D in _d_unittestp
0x0053D54D in void dmd.backend.cc.__modtest()
0x005DA31D in int
core.runtime.runModuleUnitTests().__foreachbody1(object.ModuleInfo*)
0x005D7A67 in int object.ModuleInfo.opApply(scope int
delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*))

core.exception.AssertError@dmd\backend\type.d(111): unittest failure

0x005D477D in _d_unittestp
0x0053EFE8 in void dmd.backend.type.__modtest()
0x005DA31D in int
core.runtime.runModuleUnitTests().__foreachbody1(object.ModuleInfo*)
0x005D7A67 in int object.ModuleInfo.opApply(scope int
delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*))

--


[Issue 18453] New: make -f win32.mak debdmd broke

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18453

  Issue ID: 18453
   Summary: make -f win32.mak debdmd broke
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: johnnymar...@gmail.com

Looks like debug build is broken on widows...linker error with missing symbol:

OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
..\generated\windows\release\32\dmd.obj(dmd)
 Error 42: Symbol Undefined ?out_config_debug@@YAX_N00@Z
Error: linker exited with status 1

Maybe out_config_debug was moved or renamed or something.

--


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Eduard Staniloiu via Digitalmars-d-learn

On Saturday, 17 February 2018 at 12:33:25 UTC, Nordlöw wrote:

I'm struggling with making

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d

callable in pure functions such as here

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84

Shouldn't a shared

static shared PureMallocator instance;

make it possible to call

PureMallocator.instance.allocate(16);

in pure functions?


As the folks before me have pointed out, the language doesn't 
allow you to use globals inside pure code, excepting global 
immutables; this makes sense as once an immutable object was 
constructed it will never change.


As Steven pointed out, we are just trying to fool the compiler 
into thinking that allocators don't have side effects; in the 
case of Mallocator, we are just forwarding calls to libc's 
mallocator.


With this in mind, it looks to me that you just need to decide 
what is the best/easiest way for you to forward the calls. You 
could:
  1) make all you methods static (after all, the allocator is 
stateless)

  2) make `instance` immutable and make all the methods const



[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #3 from ArturG  ---
(In reply to ArturG from comment #2)
> its actually not only remove this fail also:
> 
> void delegate(void*) dg = delegate(void*){ writeln("test"); };
> void delegate(void*) dg2;
> void delegate(void*)[] dgs = [dg,dg,dg,dg];
> //pragma(msg, isInputRange!(typeof(dgs)));
> //assert(isInputRange!(typeof(dgs)));
> dgs.writeln;
> void delegate(void*)[] dgs2 = [null, null, null, null];
> //moveAll(dgs, dgs2);
> //move(dgs.front, dgs2.front);
> move(dg, dg2);
> dg2(null);
> 
> and this actually works:
> void delegate(void*) dg = delegate(void*){ writeln("test"); };
> void delegate(void*) dg2;
> void delegate(void*)[] dgs = [dg,dg,dg,dg];
> void delegate(void*)[] dgs2 = [null, null, null, null];
> dgs.writeln;
> moveAll(dgs, dgs2);
> move(dgs.front, dgs2.front);
> move(dg, dg2);
> dg2(null);

another example:

void delegate(void*) dg = delegate(void*){ writeln("test"); };
void delegate(void*) dg2;
void delegate(void*)[] dgs = [dg,dg,dg,dg];

//dgs.writeln; // fails
auto s = "%(%s %)".format(dgs); // fails
void delegate(void*)[] dgs2 = [null, null, null, null];
//dgs.writeln; works
//auto s = "%(%s %)".format(dgs); // works
moveAll(dgs, dgs2);
move(dgs.front, dgs2.front);
move(dg, dg2);
dg2(null);

--


Pyd extention with external dependancy

2018-02-17 Thread Samuel via Digitalmars-d
I have been trying to create a python extention using pyd and 
would like my D code to use an external library, in this case 
D-YAML. is there a way to tell pyd to include the lib when 
building the extention?


Re: Anybody still using the chm docs

2018-02-17 Thread Martin Nowak via Digitalmars-d

On Wednesday, 15 June 2016 at 10:58:04 UTC, Martin Nowak wrote:

It's a huge maintenance effort for us to produce the chm files.
We no longer generate documentation on Windows, but just for 
the chm generation we have dedicated tools [¹] to create an 
index (from a json generated via ddoc) and copy the html files.
So I'm wondering if in 2016 someone really needs an offline 
copy of a website shipped with a binary release?


Let's pull the plug, I think everybody agrees that we have more 
important issues than maintaining d.chm and dman (which hasn't 
been shipped since 2.076 anyhow).
Consider both tools as offered for adoption (as an external 
service or download).


https://github.com/dlang/installer/pull/298



Re: New abstraction: Layout

2018-02-17 Thread Andrei Alexandrescu via Digitalmars-d

On 02/17/2018 09:03 AM, Steven Schveighoffer wrote:

On 2/17/18 8:19 AM, Steven Schveighoffer wrote:

On 2/16/18 7:04 PM, Andrei Alexandrescu wrote:
I've been long bothered that the builtin .tupleof and our own 
abstractions Fields and RepresentationTypeTuple in std.traits - all 
omit the essential information of field offsets. That makes types 
that use align() to have the same .tupleof, Fields, and 
RepresentationTypeTuple even though they shouldn't.


The right answer is Layout a tuple of (offset, type) pairs describing 
entirely the memory layout of a type. We need such for memory 
allocation, garbage collection, serialization, and more.


The implementation turned out to be quite compact - 81 lines 
including a compile-time mergesort. Destroy!


https://github.com/dlang/phobos/pull/6192


Can't you just use offsetof?

struct S
{
    ubyte x;
    int y;
}

static foreach(i; 0 .. s.tupleof.length)
{
    writeln(s.tupleof[i].offsetof);
}

outputs:
0
4


I found this also works:

static foreach(alias x; S.tupleof)
{
    writeln(x.offsetof);
}


Yes, the implementation uses offsetof. -- Andrei



Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread ag0aep6g via Digitalmars-d-learn

On 02/17/2018 03:04 PM, Steven Schveighoffer wrote:
You have to be a bit careful here. pure functions can assume nothing is 
happening and simply not call the function.


That's only a problem when the called function is strongly pure, right?

Nordlöw's methods are only weakly pure. They have mutable indirections 
either in the return type or in a parameter type. So calls to them 
should not be optimized away.


[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #2 from ArturG  ---
its actually not only remove this fail also:

void delegate(void*) dg = delegate(void*){ writeln("test"); };
void delegate(void*) dg2;
void delegate(void*)[] dgs = [dg,dg,dg,dg];
//pragma(msg, isInputRange!(typeof(dgs)));
//assert(isInputRange!(typeof(dgs)));
dgs.writeln;
void delegate(void*)[] dgs2 = [null, null, null, null];
//moveAll(dgs, dgs2);
//move(dgs.front, dgs2.front);
move(dg, dg2);
dg2(null);

and this actually works:
void delegate(void*) dg = delegate(void*){ writeln("test"); };
void delegate(void*) dg2;
void delegate(void*)[] dgs = [dg,dg,dg,dg];
void delegate(void*)[] dgs2 = [null, null, null, null];
dgs.writeln;
moveAll(dgs, dgs2);
move(dgs.front, dgs2.front);
move(dg, dg2);
dg2(null);

--


Re: Project Highlight: The D Community Hub

2018-02-17 Thread Basile B. via Digitalmars-d-announce

On Saturday, 17 February 2018 at 12:56:34 UTC, Mike Parker wrote:
In case you aren't aware of the dlang-community organization at 
GitHub, it's an umbrella group of contributors working to keep 
certain D projects alive and updated. Sebastian Wilzbach filled 
me in on some details for the latest Project Highlight on the 
blog.


blog:
https://dlang.org/blog/2018/02/17/project-highlight-the-d-community-hub/

reddit:
https://www.reddit.com/r/programming/comments/7y6gw1/the_d_community_hub_an_umbrella_group_for_d/


BTW i wanted to ask, you live in Korea right ? What are you doing 
over there ?
You don't have at all the Asian physical style. Maybe because of 
work or GF ?


Re: Status of @nogc with the runtime

2018-02-17 Thread Seb via Digitalmars-d
On Saturday, 17 February 2018 at 12:18:28 UTC, Peter Campbell 
wrote:
Hi everyone, it's been almost a year since I used D but I was 
wanted to get back into it. I was checking the 2017 vision 
pages and was wondering why there hasn't been a 2018H1 vision 
page but also what the current status of being able to use D 
without a garbage collector is?


It was noted in the H1 and H2 pages for 2017 but looking 
through the compiler changelog doesn't indicate that we're 
there yet? https://wiki.dlang.org/Vision/2017H2


Thanks.


The garbage collector in druntime is now lazily initialized on 
the first use:


https://github.com/dlang/druntime/pull/2057

(in master since a few days)


Re: Project Highlight: The D Community Hub

2018-02-17 Thread Basile B. via Digitalmars-d-announce

On Saturday, 17 February 2018 at 12:56:34 UTC, Mike Parker wrote:
In case you aren't aware of the dlang-community organization at 
GitHub, it's an umbrella group of contributors working to keep 
certain D projects alive and updated. Sebastian Wilzbach filled 
me in on some details for the latest Project Highlight on the 
blog.


blog:
https://dlang.org/blog/2018/02/17/project-highlight-the-d-community-hub/

reddit:
https://www.reddit.com/r/programming/comments/7y6gw1/the_d_community_hub_an_umbrella_group_for_d/


Active contributors: 'Basile'  and not 'Basil'.

- Basil UK; US, also called great basil or Saint-Joseph's-wort, 
is a culinary herb of the family Lamiaceae.


- Basile FR, is a first name and not the identifier of a culinar 
herb.


;)


Re: New abstraction: Layout

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d

On 2/17/18 8:19 AM, Steven Schveighoffer wrote:

On 2/16/18 7:04 PM, Andrei Alexandrescu wrote:
I've been long bothered that the builtin .tupleof and our own 
abstractions Fields and RepresentationTypeTuple in std.traits - all 
omit the essential information of field offsets. That makes types that 
use align() to have the same .tupleof, Fields, and 
RepresentationTypeTuple even though they shouldn't.


The right answer is Layout a tuple of (offset, type) pairs describing 
entirely the memory layout of a type. We need such for memory 
allocation, garbage collection, serialization, and more.


The implementation turned out to be quite compact - 81 lines including 
a compile-time mergesort. Destroy!


https://github.com/dlang/phobos/pull/6192


Can't you just use offsetof?

struct S
{
    ubyte x;
    int y;
}

static foreach(i; 0 .. s.tupleof.length)
{
    writeln(s.tupleof[i].offsetof);
}

outputs:
0
4


I found this also works:

static foreach(alias x; S.tupleof)
{
   writeln(x.offsetof);
}

-Steve


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d-learn

On 2/17/18 8:32 AM, ag0aep6g wrote:

On 02/17/2018 01:35 PM, rikki cattermole wrote:

pure means no globals. As in none :)


... except immutable ones. And since PureMallocator has no fields, 
`instance` can be made immutable, and all the methods can be made static 
or const. Then they can be used in `pure` code.


You have to be a bit careful here. pure functions can assume nothing is 
happening and simply not call the function.


-Steve


Re: Return value in BetterC mode.

2018-02-17 Thread meppl via Digitalmars-d-learn

On Saturday, 17 February 2018 at 07:58:40 UTC, ANtlord wrote:

Hello!
Yesterday I found an interesting issue for myself while I was 
implementing unique pointer for my project in BetterC. When I 
was trying to return new instance from a `move` method I got 
calling of destructor the instance. When the instance is out of 
scope the calling is happens again. I also see that addresses 
of an instance that calls destructor are same.


That thing doesn't happen when I don't use BetterC mode. Is 
that bug or feature?
Please checkout code https://run.dlang.io/is/m1TRnT and try it 
in BetterC mode and in usual mode.


But if I return result of a constructor directly instead of 
saving the result to variable and returning the variable from 
the `move` method I don't see double calling of the same 
destructor.


I. e.
```
auto newObject = Box(this);
return newObject;
```
is replaced by
```
return Box(this);
```

So... is that bug or feature?


Okay, with the glorious help of the compiler-switch `-vcg-ast` I 
was able to see the source of that weirdness. See also: 
https://forum.dlang.org/thread/juxihybpqpjycmxiy...@forum.dlang.org


It seems that there is always a try-block when the struct has a 
destructor


I reduced your code to:



struct S {
~this() {}
}
S myFunction() {
S s = S();
return s;
}
extern( C) void main(){}




transformation of myFunction() with

$ dmd -betterC -vcg-ast source/app.d

S myFunction()
{
S s = S();
try
{
return s;
}
finally
s.~this();
}


transformation of myFunction() with

$ dmd -vcg-ast source/app.d

S myFunction()
{
S s = S();
try
return s;
catch(Throwable __o3)
{
s.~this();
throw __o3;
}
}



sadly I have no good idea how to name the title of that issue :/


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d-learn

On 2/17/18 7:33 AM, Nordlöw wrote:

I'm struggling with making

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d

callable in pure functions such as here

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84 



Shouldn't a shared

     static shared PureMallocator instance;

make it possible to call

     PureMallocator.instance.allocate(16);

in pure functions?


Pure functions cannot access shared or thread-local data. They are not 
supposed to have any side effects.


Keep in mind, allocators have side effects, we just pretend they don't. 
You need to fool the compiler into thinking you aren't doing anything to 
global data.


The design of allocators makes this difficult. I suggested at one point 
in the past that such allocators make all functions static, which solves 
other problems. Oh, I even made a PR: 
https://github.com/dlang/phobos/pull/4288


But it wasn't to allow purity, it was to allow storage of an "instance" 
anywhere.


-Steve


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread ag0aep6g via Digitalmars-d-learn

On 02/17/2018 01:35 PM, rikki cattermole wrote:

pure means no globals. As in none :)


... except immutable ones. And since PureMallocator has no fields, 
`instance` can be made immutable, and all the methods can be made static 
or const. Then they can be used in `pure` code.


Re: New abstraction: Layout

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d

On 2/16/18 7:04 PM, Andrei Alexandrescu wrote:
I've been long bothered that the builtin .tupleof and our own 
abstractions Fields and RepresentationTypeTuple in std.traits - all omit 
the essential information of field offsets. That makes types that use 
align() to have the same .tupleof, Fields, and RepresentationTypeTuple 
even though they shouldn't.


The right answer is Layout a tuple of (offset, type) pairs describing 
entirely the memory layout of a type. We need such for memory 
allocation, garbage collection, serialization, and more.


The implementation turned out to be quite compact - 81 lines including a 
compile-time mergesort. Destroy!


https://github.com/dlang/phobos/pull/6192


Can't you just use offsetof?

struct S
{
   ubyte x;
   int y;
}

static foreach(i; 0 .. s.tupleof.length)
{
   writeln(s.tupleof[i].offsetof);
}

outputs:
0
4

-Steve


[Issue 17570] Misleading error message illegal conditional function definition

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17570

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/4bf5a6b931b5075c08da7626a4eb8ba47dffb37c
Fix Issue 17570 - Misleading error message illegal conditional function
definition

https://github.com/dlang/dmd/commit/59b705cb0b9402110a1da170d488e411b69aa9dc
Merge pull request #7892 from RazvanN7/Issue_17570

Fix Issue 17570 - Misleading error message illegal conditional function
definition
merged-on-behalf-of: Mike Franklin 

--


Re: Faking a non-pure function as pure

2018-02-17 Thread Nordlöw via Digitalmars-d-learn

On Friday, 16 February 2018 at 18:03:40 UTC, Ali Çehreli wrote:

auto pureF = assumePure();
pureF(42);

Ali


Thanks!


Re: Project Highlight: The D Community Hub

2018-02-17 Thread rjframe via Digitalmars-d-announce
On Sat, 17 Feb 2018 12:56:34 +, Mike Parker wrote:

> In case you aren't aware of the dlang-community organization at GitHub,
> it's an umbrella group of contributors working to keep certain D
> projects alive and updated. Sebastian Wilzbach filled me in on some
> details for the latest Project Highlight on the blog.


It's nice to see this advertised.

One thing: "Common best policies" in the list of benefits is an awkward 
phrase; I'm not sure if the intention is something like "Common best 
practices" or "Common branch policies".

--Ryan


Re: Project Highlight: The D Community Hub

2018-02-17 Thread rikki cattermole via Digitalmars-d-announce

FYI if you need something pulled ping me (I don't do tags however)

GH: rikkimax
IRC (FreeNode & OFTC): alphaglosined
Discord: alphaglosined


Project Highlight: The D Community Hub

2018-02-17 Thread Mike Parker via Digitalmars-d-announce
In case you aren't aware of the dlang-community organization at 
GitHub, it's an umbrella group of contributors working to keep 
certain D projects alive and updated. Sebastian Wilzbach filled 
me in on some details for the latest Project Highlight on the 
blog.


blog:
https://dlang.org/blog/2018/02/17/project-highlight-the-d-community-hub/

reddit:
https://www.reddit.com/r/programming/comments/7y6gw1/the_d_community_hub_an_umbrella_group_for_d/


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn
On Saturday, 17 February 2018 at 12:35:00 UTC, rikki cattermole 
wrote:

in pure functions?


pure means no globals. As in none :)


I guess one solution is to make the member functions in 
PureMallocator static and change how the template argument 
`Allocator` for a container is used to call these member 
functions directly instead of via `instance`, right?


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread rikki cattermole via Digitalmars-d-learn

On 17/02/2018 12:48 PM, Nordlöw wrote:

On Saturday, 17 February 2018 at 12:35:00 UTC, rikki cattermole wrote:

in pure functions?


pure means no globals. As in none :)


I don't understand.

I thought std.experimental.allocators API was designed to be able 
express these needs, @andralex?


Library code cannot change the language.

pure functions cannot access globals period, it does not matter what you 
write. Its a hard limit. You simply don't want pure here.


Re: New abstraction: Layout

2018-02-17 Thread Andrei Alexandrescu via Digitalmars-d

On 02/16/2018 10:10 PM, rikki cattermole wrote:

On 17/02/2018 12:04 AM, Andrei Alexandrescu wrote:
I've been long bothered that the builtin .tupleof and our own 
abstractions Fields and RepresentationTypeTuple in std.traits - all 
omit the essential information of field offsets. That makes types that 
use align() to have the same .tupleof, Fields, and 
RepresentationTypeTuple even though they shouldn't.


The right answer is Layout a tuple of (offset, type) pairs describing 
entirely the memory layout of a type. We need such for memory 
allocation, garbage collection, serialization, and more.


The implementation turned out to be quite compact - 81 lines including 
a compile-time mergesort. Destroy!


https://github.com/dlang/phobos/pull/6192


Andrei


Could use the name for the field as well. At the minimum useful for 
debugging purposes.


That would be tricky because fields are decomposed down to primitive 
types. -- Andrei


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn
On Saturday, 17 February 2018 at 12:35:00 UTC, rikki cattermole 
wrote:

in pure functions?


pure means no globals. As in none :)


I don't understand.

I thought std.experimental.allocators API was designed to be able 
express these needs, @andralex?


Re: Status of @nogc with the runtime

2018-02-17 Thread Eugene Wissner via Digitalmars-d
On Saturday, 17 February 2018 at 12:18:28 UTC, Peter Campbell 
wrote:
Hi everyone, it's been almost a year since I used D but I was 
wanted to get back into it. I was checking the 2017 vision 
pages and was wondering why there hasn't been a 2018H1 vision 
page but also what the current status of being able to use D 
without a garbage collector is?


It was noted in the H1 and H2 pages for 2017 but looking 
through the compiler changelog doesn't indicate that we're 
there yet? https://wiki.dlang.org/Vision/2017H2


Thanks.


Let me do a bit advertising :) I'm writing a library for @nogc D 
programming, tanya. It has different aims than -betterC: I use 
the full set of D features, just except features that require GC. 
It isn't complete, I'm using it only in personal projects and it 
is also a big learn project for me, so don't wonder that it 
reimplements a lot of features "from scratch" and almost doesn't 
depend on phobos. But if you like to play with it, you're welcome:

https://github.com/caraus-ecms/tanya


Re: Status of @nogc with the runtime

2018-02-17 Thread Mike Franklin via Digitalmars-d
On Saturday, 17 February 2018 at 12:18:28 UTC, Peter Campbell 
wrote:
I was checking the 2017 vision pages and was wondering why 
there hasn't been a 2018H1 vision page but also what the 
current status of being able to use D without a garbage 
collector is?


There are a number of ways to use D without the garbage 
collector.  However, one of the easiest is with the -betterC 
flag.  You'll want to read the two blog articles here 
(https://dlang.org/blog/category/betterc/) for more information 
about that.


2.079, the upcoming release will also have a way to use D without 
the runtime and without -betterC.  What this allows you to do is 
partially implement just the runtime features you wish to 
support.  You can read more about it in the nightly changelog 
here (https://dlang.org/changelog/pending.html#minimal_runtime)


You might also be interested in this article: 
https://wiki.dlang.org/Memory_Management


Mike





Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn

I'm struggling with making

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d

callable in pure functions such as here

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84

Shouldn't a shared

static shared PureMallocator instance;

make it possible to call

PureMallocator.instance.allocate(16);

in pure functions?


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn

On Saturday, 17 February 2018 at 12:33:25 UTC, Nordlöw wrote:

PureMallocator.instance.allocate(16);


currently errors as

pure_mallocator.d(84,16): Error: pure function 
'pure_mallocator.__unittest_pure_mallocator_82_0' cannot access 
mutable static data 'instance'


Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread rikki cattermole via Digitalmars-d-learn

On 17/02/2018 12:33 PM, Nordlöw wrote:

I'm struggling with making

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d

callable in pure functions such as here

https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84 



Shouldn't a shared

     static shared PureMallocator instance;

make it possible to call

     PureMallocator.instance.allocate(16);

in pure functions?


pure means no globals. As in none :)


Status of @nogc with the runtime

2018-02-17 Thread Peter Campbell via Digitalmars-d
Hi everyone, it's been almost a year since I used D but I was 
wanted to get back into it. I was checking the 2017 vision pages 
and was wondering why there hasn't been a 2018H1 vision page but 
also what the current status of being able to use D without a 
garbage collector is?


It was noted in the H1 and H2 pages for 2017 but looking through 
the compiler changelog doesn't indicate that we're there yet? 
https://wiki.dlang.org/Vision/2017H2


Thanks.


Attention DConf 2018 Registrants!

2018-02-17 Thread Mike Parker via Digitalmars-d-announce
If you've already signed up for DConf 2018 and haven't yet seen 
an email from soc...@dlang.org, please be sure to check your spam 
folder. If it has been marked as spam, please whitelist dlang.org 
in case we need to send out any critical messages.


[Issue 8295] Struct member destructor can not be called from shared struct instance

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8295

--- Comment #11 from Marco Leise  ---
Uh, I think I just contradicted my two years younger self from the linked bug
report. I guess whether or not `stdout` (or any reference counter) should use
atomic operations must not depend on whether the struct itself is `shared` for
the afore mentioned reasons. `stout` being a global variable should of course
be `shared`, but threads are free to create a local, unshared copy of that RC
pointer. These copies would still uses atomic operations internally. That way I
can reconcile the both of me.

TL;DR Let's not use shared to signify whether an RC pointer should use atomic
ops internally. Value types can always be copied stripping their top-level
qualifiers!

--


Re: LDC 1.8.0-beta1

2018-02-17 Thread 9il via Digitalmars-d-announce

On Friday, 16 February 2018 at 22:30:35 UTC, kinke wrote:

Hi everyone,

on behalf of the LDC team, I'm glad to announce the first beta 
for LDC 1.8. The highlights of this version in a nutshell:


* Based on D 2.078.3.
* New switch `-link-defaultlib-shared` to link against shared 
druntime/Phobos.

* Plugins support, compatible with existing Clang plugins.
* Support for LLVM IR-based PGO as alternative to existing 
(AST-based) PGO.

* Basic support for LLVM XRay instrumentation.

Full release log and downloads: 
https://github.com/ldc-developers/ldc/releases/tag/v1.8.0-beta1


Thanks to all contributors!


Thank you for the fast beta!


[Issue 8295] Struct member destructor can not be called from shared struct instance

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8295

--- Comment #10 from Marco Leise  ---
Thanks for the clarification. Shared has never been fully fleshed out. What we
can currently take away from the specification is this:

   "8.8 shared Attribute

   The shared attribute modifies the type from T to shared(T), the same way as
   const does."

My thinking is that top level qualifiers on assignments and function parameters
only have informative character. Sometimes we want to enforce a coding practice
that says that function parameters are no scratch space or make it easier to
reason about a piece of code by ensuring that variables cannot be modified
after the initial assignment. In any case these are copies of the values that
are assigned to them.
You can tell where I'm going: Copy a shared reference counting struct and it is
no longer shared except for the data it references. So in my brain there is no
"shared(RefCounter!T)" that atomically decrements the counter. For that I would
have to create another "SharedRefCounter". Whether or not the payload is shared
is independent of that.

I don't know what I can say about thread local allocators. You can still share
data allocated with them as long as upon destruction you queue the item in for
freeing on the correct thread's "items to be free'd list". It all has to be
manually implemented without help from the language.

--


Re: Which language futures make D overcompicated?

2018-02-17 Thread Laeeth Isharc via Digitalmars-d

On Friday, 9 February 2018 at 19:01:30 UTC, H. S. Teoh wrote:

If somebody *paid* me to work on dub, then perhaps I will.  But 
right now, my level of motivation and interest in doing so is 
pretty low, and is on the losing side of the competition 
against the myriad other projects that I could be working on.



T


I've paid John Colvin in the past out of my own pocket to work on 
dub.  Some of our pull requests were accepted, some are stuck in 
the queue. We have too much to do currently for core people to 
work on it, but if there are things that would make a difference 
for us and others we could explore sponsoring further development.


If we could make a list of what needs doing that is interesting 
to you to fix and order of magnitude how long things might take, 
I could consider that.  I think you have my email.



Laeeth




[Issue 17605] [REG2.066.0] __traits(compiles, closure) adds link-time reference to _d_allocmemory

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17605

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 17605] [REG2.066.0] __traits(compiles, closure) adds link-time reference to _d_allocmemory

2018-02-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17605

--- Comment #5 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/1c6169c719c3dba0664e315b42a481d013b14530
fix Issue 17605 - [REG2.066.0] __traits(compiles, closure) adds link-time
reference to _d_allocmemory

https://github.com/dlang/dmd/commit/2568f3dae7e5ab4631adc0aaf1e3d27358a3eb74
Merge pull request #7897 from WalterBright/fix17605

fix Issue 17605 - [REG2.066.0] __traits(compiles, closure) adds link-…

--


Re: Release D 2.078.2

2018-02-17 Thread Thomas Mader via Digitalmars-d-announce

On Friday, 16 February 2018 at 11:25:42 UTC, Martin Nowak wrote:

On 02/10/2018 09:17 AM, Thomas Mader wrote:
https://github.com/dlang/dub/releases/latest doesn't point to 
1.7.2.


Out of curiosity, do you have a strong use-case to 
install/update dub separately of the compiler?


I don't even use or need latest as of yet. I need to download the 
exact same version in my scripts nevertheless.

I just saw that it was not updated and wanted to let you know.

But I package dub and the tools as a separate package from dmd.
Archlinux is doing the same and I find it reasonable. dub and the 
tools should be buildable with other compilers too and one day I 
might switch to ldc as the default compiler for the distribution 
because of speed.


Re: New abstraction: Layout

2018-02-17 Thread thedeemon via Digitalmars-d
On Saturday, 17 February 2018 at 00:04:16 UTC, Andrei 
Alexandrescu wrote:
The implementation turned out to be quite compact - 81 lines 
including a compile-time mergesort. Destroy!


Off-topic:
I've just realized Andrei puts "Destroy!" at the end of his 
messages because it's the end of scope and he wants to free any 
allocated resources. ;)


Re: LDC 1.8.0-beta1

2018-02-17 Thread Walter Bright via Digitalmars-d-announce

On 2/16/2018 2:30 PM, kinke wrote:

on behalf of the LDC team, I'm glad to announce the first beta for LDC 1.8.


Congratulations!


Return value in BetterC mode.

2018-02-17 Thread ANtlord via Digitalmars-d-learn

Hello!
Yesterday I found an interesting issue for myself while I was 
implementing unique pointer for my project in BetterC. When I was 
trying to return new instance from a `move` method I got calling 
of destructor the instance. When the instance is out of scope the 
calling is happens again. I also see that addresses of an 
instance that calls destructor are same.


That thing doesn't happen when I don't use BetterC mode. Is that 
bug or feature?
Please checkout code https://run.dlang.io/is/m1TRnT and try it in 
BetterC mode and in usual mode.


But if I return result of a constructor directly instead of 
saving the result to variable and returning the variable from the 
`move` method I don't see double calling of the same destructor.


I. e.
```
auto newObject = Box(this);
return newObject;
```
is replaced by
```
return Box(this);
```

So... is that bug or feature?