[Issue 19161] Wrong mangle for C++ classes

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19161 Nicholas Wilson changed: What|Removed |Added CC||iamthewilsona...@hotmail.co

Re: Engine of forum

2018-08-20 Thread Walter Bright via Digitalmars-d
On 8/20/2018 8:42 PM, Ali wrote: Many of those new comers who ask about the forum software .. they never stick, they dont complain, or question, or try to change for the better, they simply leave Ask 10 people, and you'll get 10 different answers on what a better forum would be. If people

[Issue 19097] Extend Return Scope Semantics

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19097 --- Comment #6 from Mike Franklin --- As I work to understand this proposal and evaluate it I've noticed it bears resemblance to Problem Case #3 in Rust's Non-Lexical Lifetimes design in 2016:

[Issue 19078] dmd does not remove inlined functions

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19078 Jonathan Marler changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Issue 19078] dmd does not remove inlined functions

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19078 Nicholas Wilson changed: What|Removed |Added CC||iamthewilsona...@hotmail.co

Re: Engine of forum

2018-08-20 Thread Ali via Digitalmars-d
On Monday, 20 August 2018 at 09:52:01 UTC, Peter Alexander wrote: What are the specific problems solved or opportunities realised by moving to a real forum? What are the specific problems solved by using better software? Well, most software projects, have different channels of

Re: Generically call a function on Variant's payload?

2018-08-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 20, 2018 8:29:30 PM MDT Nick Sabalausky (Abscissa) via Digitalmars-d-learn wrote: > On 08/20/2018 04:34 PM, Jonathan M Davis wrote: > > foreach(T; TypesThatVariantHolds) > > Yea, that's what I would've just done, but I wanted to support > user-created types not already

[Issue 19184] New: pragma(crt_con/destructor) missing in spec list of predefined pragmas

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19184 Issue ID: 19184 Summary: pragma(crt_con/destructor) missing in spec list of predefined pragmas Product: D Version: D2 Hardware: x86 OS: Mac OS X

Re: Engine of forum

2018-08-20 Thread Tony via Digitalmars-d
On Monday, 20 August 2018 at 09:52:01 UTC, Peter Alexander wrote: On Monday, 20 August 2018 at 08:39:38 UTC, Andrey wrote: On Sunday, 19 August 2018 at 11:11:56 UTC, rikki cattermole wrote: This is a news group not a forum. The web interface is driven by DFeed and is written in D. It has been

Re: Generically call a function on Variant's payload?

2018-08-20 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/20/2018 04:34 PM, Jonathan M Davis wrote: foreach(T; TypesThatVariantHolds) Yea, that's what I would've just done, but I wanted to support user-created types not already known to my library. You can't just call functions on completely unknown types, because the compiler

Re: D need an ORM library!

2018-08-20 Thread binghoo dang via Digitalmars-d-learn
On Monday, 20 August 2018 at 23:24:04 UTC, Matthias Klumpp wrote: On Monday, 20 August 2018 at 15:58:37 UTC, Jesse Phillips wrote: [...] There are a number of things out there, but personally don't know there state or simplicity. 2016 there was a talk: http://dconf.org/2016/talks/nowak.html

Re: Auto keyword and when to use it

2018-08-20 Thread Mike Parker via Digitalmars-d-learn
On Monday, 20 August 2018 at 17:24:19 UTC, QueenSvetlana wrote: I'm struggling to understand what the auto keyword is for and it's appropriate uses. From research, it seems to share the same capabilities as the var keyword in C#. auto is one of the most misunderstood understood features in

Re: Engine of forum

2018-08-20 Thread jurr via Digitalmars-d
On Tuesday, 21 August 2018 at 01:09:29 UTC, MattCoder wrote: On Tuesday, 21 August 2018 at 00:54:17 UTC, jurr wrote: ...If you just want to make a comment on a topic without replying to any specific person... I don't get because I think most of the time when you post something, you do by

Re: Engine of forum

2018-08-20 Thread MattCoder via Digitalmars-d
On Tuesday, 21 August 2018 at 00:54:17 UTC, jurr wrote: ...If you just want to make a comment on a topic without replying to any specific person... I don't get because I think most of the time when you post something, you do by replying to someone anyway, you don't say things out of blue,

Re: Using a C++ class in a D associative array

2018-08-20 Thread Paul O'Neil via Digitalmars-d
Potentially related: https://issues.dlang.org/show_bug.cgi?id=13875

Re: Engine of forum

2018-08-20 Thread jurr via Digitalmars-d
delete: If you just want to make a comment on a topic without replying to any specific person Didn't mean to post this as I don't think any forum really has that unless you just reply to the first post.

Re: Engine of forum

2018-08-20 Thread jurr via Digitalmars-d
On Monday, 20 August 2018 at 10:55:54 UTC, rikki cattermole wrote: On 20/08/2018 10:38 PM, Andrey wrote: On Monday, 20 August 2018 at 09:52:01 UTC, Peter Alexander wrote: user profiles, Why do you need that? All the information you need is embedded right into the messages themselves (its

Re: Engine of forum

2018-08-20 Thread jurr via Digitalmars-d
Should not need an extension for this *

Re: Using a C++ class in a D associative array

2018-08-20 Thread kinke via Digitalmars-d
On Monday, 20 August 2018 at 22:16:09 UTC, Jacob Carlborg wrote: At the third line there's a call from object.TypeInfo_Class.getHash. I looked up to see what the "getHash" method is doing in druntime [2], the method looks like this: override size_t getHash(scope const void* p) @trusted const

Re: Is @safe still a work-in-progress?

2018-08-20 Thread Walter Bright via Digitalmars-d
On 8/20/2018 6:46 AM, Steven Schveighoffer wrote: I would, but I have no idea how dip1000 is supposed to work. I think only you understand it. Even looking at the PR that you have been citing over and over, I can't make heads or tails of what it does or what it allows. The way to understand

Re: D need an ORM library!

2018-08-20 Thread Matthias Klumpp via Digitalmars-d-learn
On Monday, 20 August 2018 at 15:58:37 UTC, Jesse Phillips wrote: [...] There are a number of things out there, but personally don't know there state or simplicity. 2016 there was a talk: http://dconf.org/2016/talks/nowak.html But personally I preferred this one:

Using a C++ class in a D associative array

2018-08-20 Thread Jacob Carlborg via Digitalmars-d
I'm playing around with using the DMD frontend as a library. I wanted to store some nodes from the AST in a set. Since there doesn't seem to be a set container that is shipped with Phobos I wrapped an associative array and added some functions to use the AA as a set. To my surprise when I did

Re: Pure opEquals in a class

2018-08-20 Thread ag0aep6g via Digitalmars-d-learn
On Monday, 20 August 2018 at 19:36:15 UTC, werter wrote: The code below doesn't work. Is it possible to make a pure opEquals in a class? [...] pure bool opEquals(const A rhs) const { return b == rhs.b; } It doesn't

Re: Generically call a function on Variant's payload?

2018-08-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 20, 2018 1:38:13 PM MDT Nick Sabalausky (Abscissa) via Digitalmars-d-learn wrote: > There are a bunch of discriminated union types available for D, but the > only one I'm aware of that *doesn't* require a finite-sized list of > types known ahead-of-time is Phobos's Variant. The

Re: Is @safe still a work-in-progress?

2018-08-20 Thread Walter Bright via Digitalmars-d
On 8/20/2018 6:08 AM, Atila Neves wrote: As mentioned in my other thread, I went to file one and it was declared not a bug: https://issues.dlang.org/show_bug.cgi?id=17927 I'll look at it again.

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-20 Thread jmh530 via Digitalmars-d-announce
On Monday, 20 August 2018 at 19:06:36 UTC, Seb wrote: [snip] That looks pretty cool! I added optional to run.dlang.io (e.g. https://run.dlang.io/is/912kVG) and the project tester (https://github.com/dlang/ci/pull/288). It's interesting that both sumtype and optional have match templates.

Re: Trouble with LDC2 and definition file to hide console?

2018-08-20 Thread kinke via Digitalmars-d-learn
For LDC, just rename your main() to WinMain(). Or alternatively, `-L/SUBSYSTEM:WINDOWS -L/ENTRY:mainCRTStartup` in the LDC cmdline.

Re: Generically call a function on Variant's payload?

2018-08-20 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/19/2018 11:31 PM, Paul Backus wrote: You are basically reinventing OOP here. Yes, I am. Deliberately, in fact. Class inheritance is my backup plan, though. My use-case is actually very, very similar to std.digest: There are various benefits to using a template-and-constraint based

Pure opEquals in a class

2018-08-20 Thread werter via Digitalmars-d-learn
The code below doesn't work. Is it possible to make a pure opEquals in a class? void main() { class A { bool a; int b; this(bool g, int h) { a = g; b

Re: Trouble with LDC2 and definition file to hide console?

2018-08-20 Thread kinke via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:49:19 UTC, rikki cattermole wrote: That is for Optlink not for MSVC link which ldc uses. Exactly. For LDC, just rename your main() to WinMain().

[Issue 19181] Semantic errors in opDispatch argument lead to "no property X"

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19181 --- Comment #1 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/4ea34855e59b42efe29cc3475df81ce0046051b2 Fix Issue 19181: when an UFCS or opDispatch call has

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-20 Thread Seb via Digitalmars-d-announce
On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm [...] That looks pretty cool! I added optional to run.dlang.io (e.g. https://run.dlang.io/is/912kVG) and the project tester (https://github.com/dlang/ci/pull/288).

[Issue 19181] Semantic errors in opDispatch argument lead to "no property X"

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19181 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

Re: Dagon 3D game framewordk/engine

2018-08-20 Thread aberba via Digitalmars-d
On Sunday, 19 August 2018 at 23:25:01 UTC, Norm wrote: On Friday, 17 August 2018 at 08:56:56 UTC, aberba wrote: I'm quite happy to find a project like Dagon (https://code.dlang.org/packages/dagon) receiving more improvements. Already, it has quite a number of cutting edge features. The

Dub and it's build directory

2018-08-20 Thread Russel Winder via Digitalmars-d-learn
Hi, Given a package X, let us assume it's a library such that X = unit- threaded, we find that in the ~/.dub/packages directory there is: .dub/packages/unit-threaded-0.7.51/unit-threaded/gen_ut_main* .dub/packages/unit-threaded-0.7.51/unit-threaded/libunit-threaded.a These are the compilation

Re: D need an ORM library!

2018-08-20 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-08-20 at 15:58 +, Jesse Phillips via Digitalmars-d- learn wrote: > On Monday, 20 August 2018 at 02:30:16 UTC, binghoo dang wrote: > > hi, > > > > I thinks D need an ORM library for Sqlite/Mysql/PostgreSQL, > > entity currently support all the three targets, but entity's > > API

Re: Beta 2.082.0

2018-08-20 Thread jmh530 via Digitalmars-d-announce
On Friday, 17 August 2018 at 20:01:32 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.082.0 release, ♥ to the 47 contributors for this release. [snip] On the "UDAs on function arguments are now supported" part of the change log, just to be clear, @(22) is added to "a" for

Re: Auto keyword and when to use it

2018-08-20 Thread JN via Digitalmars-d-learn
On Monday, 20 August 2018 at 17:52:17 UTC, QueenSvetlana wrote: Great! So I can't declare class level variables with auto, correct? only local method variables? You can, globals, class members: class Foo { auto bar = "hi"; } Foo.bar will be of string type here, because "hi" is a

Re: Auto keyword and when to use it

2018-08-20 Thread Colin via Digitalmars-d-learn
On Monday, 20 August 2018 at 17:52:17 UTC, QueenSvetlana wrote: Great! So I can't declare class level variables with auto, correct? only local method variables? You can use auto if you're setting the class level variable to a default. class X { auto i = 42; // i will be an int }

Re: Auto keyword and when to use it

2018-08-20 Thread QueenSvetlana via Digitalmars-d-learn
Great! So I can't declare class level variables with auto, correct? only local method variables?

Re: Deduce type of struct in function arguments

2018-08-20 Thread Seb via Digitalmars-d-learn
On Monday, 20 August 2018 at 12:33:34 UTC, Andrey wrote: On Monday, 20 August 2018 at 11:38:39 UTC, Paul Backus wrote: Create an overload of foo that takes two arguments and combines them into a `Data` struct internally: void foo(int a, string text) { Data data = {a, text}; foo(data);

Re: Auto keyword and when to use it

2018-08-20 Thread JN via Digitalmars-d-learn
On Monday, 20 August 2018 at 17:24:19 UTC, QueenSvetlana wrote: I'm new to D programming, but have I have a background with Python. I'm struggling to understand what the auto keyword is for and it's appropriate uses. From research, it seems to share the same capabilities as the var keyword

Auto keyword and when to use it

2018-08-20 Thread QueenSvetlana via Digitalmars-d-learn
I'm new to D programming, but have I have a background with Python. I'm struggling to understand what the auto keyword is for and it's appropriate uses. From research, it seems to share the same capabilities as the var keyword in C#. From the C# documentation, it states:

Re: UDA on double nested struct

2018-08-20 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 20 August 2018 at 16:27:55 UTC, Basile B. wrote: Hello, it works fine here. Maybe there was another error that you removed when you have minimized the example. See https://run.dlang.io/is/ZrW7kI, that says that the example works since 2.068.2. Although that are are possibility that

Re: Make function alias

2018-08-20 Thread Basile B. via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote: Hello, I want to make an alias to function "std.stdio.writeln" and "std.stdio.write" and use it like: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(); text.print(); }

Re: UDA on double nested struct

2018-08-20 Thread Basile B. via Digitalmars-d-learn
On Monday, 20 August 2018 at 16:16:04 UTC, Sebastiaan Koppe wrote: Hey, I am trying to get UDAs from a doubly nested struct, to no avail: code --- import std.traits : hasUDA; enum hover; struct Style { struct Root { auto margin = "10px"; auto backgroundColor = "white"; @hover

UDA on double nested struct

2018-08-20 Thread Sebastiaan Koppe via Digitalmars-d-learn
Hey, I am trying to get UDAs from a doubly nested struct, to no avail: code --- import std.traits : hasUDA; enum hover; struct Style { struct Root { auto margin = "10px"; auto backgroundColor = "white"; @hover struct Hover { auto backgroundColor = "gray"; } } }

Re: Make function alias

2018-08-20 Thread Andrey via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:35:07 UTC, ag0aep6g wrote: On 08/20/2018 03:14 PM, Andrey wrote: Thanks everybody for your answers.

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Dgame via Digitalmars-d
On Monday, 20 August 2018 at 15:55:54 UTC, Kagamin wrote: On Monday, 20 August 2018 at 13:02:23 UTC, Atila Neves wrote: On Monday, 20 August 2018 at 12:56:42 UTC, Kagamin wrote: You need `return` attribute there, not `scope`: struct MyStruct { import core.stdc.stdlib; int* ints;

Re: D need an ORM library!

2018-08-20 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 20 August 2018 at 02:30:16 UTC, binghoo dang wrote: hi, I thinks D need an ORM library for Sqlite/Mysql/PostgreSQL, entity currently support all the three targets, but entity's API is too complex and cumbersome for using. Is there a more light-weight and simpler implementation

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Kagamin via Digitalmars-d
On Monday, 20 August 2018 at 13:02:23 UTC, Atila Neves wrote: On Monday, 20 August 2018 at 12:56:42 UTC, Kagamin wrote: You need `return` attribute there, not `scope`: struct MyStruct { import core.stdc.stdlib; int* ints; this(int size) @trusted { ints = cast(int*) malloc(size); }

DIP Draft Reviews

2018-08-20 Thread Mike Parker via Digitalmars-d-announce
I'm getting ready to start prepping one of the DIPs in the PR queue for community review. It proposes adding an `in` operator for arrays. I haven't gone through it in detail yet, so I invite anyone with time on their hands to provide feedback on the Draft so we can more speedily get in shape

Re: [OT] Leverage Points

2018-08-20 Thread Mike Parker via Digitalmars-d
On Monday, 20 August 2018 at 08:31:15 UTC, Dave Jones wrote: n production. Im not trying to be negative but if Nim or Rust released a blog post saying "We made find faster" is it going to get you to try them out? Is it enough of an enticement to get over you preconceptions about those

Re: Is @safe still a work-in-progress?

2018-08-20 Thread Jonathan M Davis via Digitalmars-d
On Monday, August 20, 2018 7:46:48 AM MDT Steven Schveighoffer via Digitalmars-d wrote: > I would, but I have no idea how dip1000 is supposed to work. I think > only you understand it. Even looking at the PR that you have been citing > over and over, I can't make heads or tails of what it does or

Re: D kernel for Jupyter notebook

2018-08-20 Thread Martin Nowak via Digitalmars-d-announce
On 08/20/2018 02:14 AM, Shigeki Karita wrote: > On Sunday, 19 August 2018 at 20:33:45 UTC, Laeeth Isharc wrote: >> Proof of concept works, but it requires some further development to be >> useful to do work in. >> >> [...] > > Great. I have tried DUB integration. It seems to work. >

[Issue 17927] [scope] `scope inout` parameter value can be escaped via return

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17927 Steven Schveighoffer changed: What|Removed |Added Status|RESOLVED|REOPENED CC|

Re: Is @safe still a work-in-progress?

2018-08-20 Thread Steven Schveighoffer via Digitalmars-d
On 8/17/18 11:04 PM, Walter Bright wrote: On 8/17/2018 11:17 AM, bachmeier wrote: This is a good example of D needing to evolve or fizzle out. I don't see evidence that the community has yet figured out how to evolve the language. If it had, these problems would not be around for so many

Re: Trouble with LDC2 and definition file to hide console?

2018-08-20 Thread rikki cattermole via Digitalmars-d-learn
On 21/08/2018 1:42 AM, spikespaz wrote: I am trying to add a *.def file to my program to hide the console window on launch, as it doesn't need to display anything to function. It is a Windows only application. I saw at this post (https://forum.dlang.org/post/ilj5vn$ef4$1...@digitalmars.com)

Re: Trouble with LDC2 and definition file to hide console?

2018-08-20 Thread spikespaz via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:42:58 UTC, spikespaz wrote: I am trying to add a *.def file to my program to hide the console window on launch, as it doesn't need to display anything to function. It is a Windows only application. [...] Also adding that the linker flag I have stated above

Trouble with LDC2 and definition file to hide console?

2018-08-20 Thread spikespaz via Digitalmars-d-learn
I am trying to add a *.def file to my program to hide the console window on launch, as it doesn't need to display anything to function. It is a Windows only application. I saw at this post (https://forum.dlang.org/post/ilj5vn$ef4$1...@digitalmars.com) that I could either use a linker flag,

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Steven Schveighoffer via Digitalmars-d
On 8/20/18 5:43 AM, Nicholas Wilson wrote: On Monday, 20 August 2018 at 09:31:09 UTC, Atila Neves wrote: On Friday, 17 August 2018 at 13:39:29 UTC, Steven Schveighoffer wrote: // used to be scope int* ptr() { return ints; } scope inout(int)* ptr() inout { return ints; } Does scope apply to

Re: Make function alias

2018-08-20 Thread ag0aep6g via Digitalmars-d-learn
On 08/20/2018 03:14 PM, Andrey wrote: Hello, I want to make an alias to function "std.stdio.writeln" and "std.stdio.write" and use it like: static void log(bool newline = true)(string text) {    alias print(T...) = newline ? :    _file.print();    text.print(); } Unfortunately, it

Re: [OT] Leverage Points

2018-08-20 Thread Laeeth Isharc via Digitalmars-d
On Monday, 20 August 2018 at 12:26:25 UTC, Laeeth Isharc wrote: On Monday, 20 August 2018 at 11:55:33 UTC, Joakim wrote: Finally, regarding leverage, I keep pointing out that mobile has seen a resurgence of AoT-compiled native languages, but nobody seems to be trying D out in that fertile

Re: Make function alias

2018-08-20 Thread Paul Backus via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote: Hello, I want to make an alias to function "std.stdio.writeln" and "std.stdio.write" and use it like: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(); text.print(); }

Re: Make function alias

2018-08-20 Thread vit via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:22:02 UTC, Andrey wrote: On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote: Mistake... this is: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(text); text.print(); } static void log(bool newline

Re: Make function alias

2018-08-20 Thread Andrey via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote: Mistake... this is: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(text); text.print(); }

Re: Deduce type of struct in function arguments

2018-08-20 Thread Paul Backus via Digitalmars-d-learn
On Monday, 20 August 2018 at 12:33:34 UTC, Andrey wrote: On Monday, 20 August 2018 at 11:38:39 UTC, Paul Backus wrote: Create an overload of foo that takes two arguments and combines them into a `Data` struct internally: void foo(int a, string text) { Data data = {a, text}; foo(data);

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Jonathan M Davis via Digitalmars-d
On Monday, August 20, 2018 3:43:46 AM MDT Nicholas Wilson via Digitalmars-d wrote: > On Monday, 20 August 2018 at 09:31:09 UTC, Atila Neves wrote: > > On Friday, 17 August 2018 at 13:39:29 UTC, Steven Schveighoffer > > > > wrote: > >>> // used to be scope int* ptr() { return ints; } > >>> scope

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 ag0aep6g changed: What|Removed |Added CC||ag0ae...@gmail.com --- Comment #1 from ag0aep6g

Make function alias

2018-08-20 Thread Andrey via Digitalmars-d-learn
Hello, I want to make an alias to function "std.stdio.writeln" and "std.stdio.write" and use it like: static void log(bool newline = true)(string text) { alias print(T...) = newline ? : _file.print(); text.print(); } Unfortunately, it doesn't work... Also tried with "enum print

Re: Is @safe still a work-in-progress?

2018-08-20 Thread Atila Neves via Digitalmars-d
On Saturday, 18 August 2018 at 02:17:01 UTC, Walter Bright wrote: On 8/17/2018 4:33 AM, Atila Neves wrote: I've been using -dip1000 a lot lately. Great news! :) I hit two bugs yesterday. In D? or in your code? In dmd. Bugs don't count if they're not in bugzilla! As mentioned in

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 Atila Neves changed: What|Removed |Added Keywords||safe --

[Issue 19183] New: DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 Issue ID: 19183 Summary: DIP1000 defeated if auto used instead of scope in variable declaration with template this member function Product: D Version: D2

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Kagamin via Digitalmars-d
AIU, `return` for `scope` is what `inout` is for `const`. I proposed to extend `inout` to mean `return`, but Walter said that they are independent.

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Atila Neves via Digitalmars-d
On Monday, 20 August 2018 at 09:43:46 UTC, Nicholas Wilson wrote: On Monday, 20 August 2018 at 09:31:09 UTC, Atila Neves wrote: On Friday, 17 August 2018 at 13:39:29 UTC, Steven Schveighoffer wrote: [...] Does scope apply to the return value or the `this` reference? I assumed the return

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Atila Neves via Digitalmars-d
On Monday, 20 August 2018 at 12:56:42 UTC, Kagamin wrote: You need `return` attribute there, not `scope`: struct MyStruct { import core.stdc.stdlib; int* ints; this(int size) @trusted { ints = cast(int*) malloc(size); } ~this() @trusted { free(ints); } inout(int)* ptr()

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Kagamin via Digitalmars-d
You need `return` attribute there, not `scope`: struct MyStruct { import core.stdc.stdlib; int* ints; this(int size) @trusted { ints = cast(int*) malloc(size); } ~this() @trusted { free(ints); } inout(int)* ptr() return inout { return ints; } }

[Issue 19173] [scope][dip1000] Using a `lazy` parameter defeats scope and dip1000

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19173 Atila Neves changed: What|Removed |Added Keywords||safe --

Re: [OT] Leverage Points

2018-08-20 Thread Laeeth Isharc via Digitalmars-d
On Monday, 20 August 2018 at 08:31:15 UTC, Dave Jones wrote: On Monday, 20 August 2018 at 03:04:30 UTC, Mike Parker wrote: On Sunday, 19 August 2018 at 19:52:44 UTC, Dave Jones wrote: What you need a blog post saying the GC has been made 4x faster. Stuff like that, hey we made D much better

Mini numerical optimizer in D

2018-08-20 Thread Sean O'Connor via Digitalmars-d-announce
Mini numerical optimizer in D: https://github.com/S6Regen/Dopt I also have this Walsh Hadamard code in D for Linux AMD 64: // Linux AMD64 extern(C) void hsixteen(float* x,ulong n,float scale){ asm{ naked; shufps XMM0,XMM0,0; align 16; h16:

[Issue 19182] New: missing semicolon crashes compiler

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19182 Issue ID: 19182 Summary: missing semicolon crashes compiler Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: ice Severity:

Re: Deduce type of struct in function arguments

2018-08-20 Thread Andrey via Digitalmars-d-learn
On Monday, 20 August 2018 at 11:38:39 UTC, Paul Backus wrote: Create an overload of foo that takes two arguments and combines them into a `Data` struct internally: void foo(int a, string text) { Data data = {a, text}; foo(data); } Hmm, not very good solution. In C++ you can not to

Re: [OT] Leverage Points

2018-08-20 Thread Laeeth Isharc via Digitalmars-d
On Monday, 20 August 2018 at 11:55:33 UTC, Joakim wrote: "So how do you change paradigms? Thomas Kuhn, who wrote the seminal book about the great paradigm shifts of science, has a lot to say about that. In a nutshell, you keep pointing at the anomalies and failures in the old paradigm, you

[Issue 18569] std.traits.moduleName problem with enum

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18569 ag0aep6g changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 14501] template result is reused for equal but non-identical alias arguments

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14501 ag0aep6g changed: What|Removed |Added CC||claud...@live.fr --- Comment #2 from ag0aep6g

[Issue 18569] std.traits.moduleName problem with enum

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18569 Basile B. changed: What|Removed |Added CC||b2.t...@gmx.com Hardware|x86_64

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-20 Thread aliak via Digitalmars-d-announce
On Monday, 20 August 2018 at 09:16:18 UTC, ikod wrote: On Thursday, 16 August 2018 at 16:20:09 UTC, aliak wrote: On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: It's also @nogc and @safe No it's not. Not dispatching at least. Dunno why though. Seems safey is because taking an

Re: [OT] Leverage Points

2018-08-20 Thread Joakim via Digitalmars-d
On Monday, 20 August 2018 at 04:46:35 UTC, Laeeth Isharc wrote: On Sunday, 19 August 2018 at 18:49:53 UTC, Joakim wrote: On Saturday, 18 August 2018 at 13:33:43 UTC, Andrei Alexandrescu wrote: A friend recommended this article:

[Issue 18700] iota with floating type + padRigh asserts

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18700 Basile B. changed: What|Removed |Added Status|NEW |RESOLVED CC|

Re: Deduce type of struct in function arguments

2018-08-20 Thread Paul Backus via Digitalmars-d-learn
On Monday, 20 August 2018 at 09:23:27 UTC, Andrey wrote: Hello, I have a function and a struct: void foo(ref Data data) { ... } struct Data { int a; string text; } How to pass struct into function without naming its type? This doesn't work: foo({1234, "Hello!"}); Create an

[Issue 18693] std.math.rndtonl and core.math.rndtonl result in link errors

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18693 Basile B. changed: What|Removed |Added Status|NEW |RESOLVED CC|

Re: Engine of forum

2018-08-20 Thread rikki cattermole via Digitalmars-d
On 20/08/2018 10:38 PM, Andrey wrote: On Monday, 20 August 2018 at 09:52:01 UTC, Peter Alexander wrote: What are the specific problems solved or opportunities realised by moving to a real forum? Normal view, DFeed supports multiple views, is there some special one you wish to request?

Re: ushort + ushort = int?

2018-08-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 20, 2018 4:29:56 AM MDT Andrey via Digitalmars-d-learn wrote: > On Monday, 20 August 2018 at 09:56:13 UTC, Jonathan M Davis wrote: > > It's a combination of keeping the C semantics (in general, C > > code is valid D code with the same semantics, or it won't > > compile) and the

Re: Engine of forum

2018-08-20 Thread Andrey via Digitalmars-d
On Monday, 20 August 2018 at 09:52:01 UTC, Peter Alexander wrote: What are the specific problems solved or opportunities realised by moving to a real forum? Normal view, user profiles, formatting of messages (we are programmers - we need format), when reply you don't need to quote... It's a

Re: ushort + ushort = int?

2018-08-20 Thread Andrey via Digitalmars-d-learn
On Monday, 20 August 2018 at 09:56:13 UTC, Jonathan M Davis wrote: It's a combination of keeping the C semantics (in general, C code is valid D code with the same semantics, or it won't compile) and the fact that D requires casts for narrowing conversions. When you add two shorts in C/C++, it

Re: ushort + ushort = int?

2018-08-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 20, 2018 3:19:04 AM MDT Andrey via Digitalmars-d-learn wrote: > On Monday, 20 August 2018 at 08:49:00 UTC, rikki cattermole wrote: > > Yes. On x86 int's will be faster just an FYI so it does make > > sense to use them for computation. > > Inconveniently always use casts. Why in

Re: Engine of forum

2018-08-20 Thread Peter Alexander via Digitalmars-d
On Monday, 20 August 2018 at 08:39:38 UTC, Andrey wrote: On Sunday, 19 August 2018 at 11:11:56 UTC, rikki cattermole wrote: This is a news group not a forum. The web interface is driven by DFeed and is written in D. It has been designed to be very fast (quite a notable feature). I see this

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Nicholas Wilson via Digitalmars-d
On Monday, 20 August 2018 at 09:31:09 UTC, Atila Neves wrote: On Friday, 17 August 2018 at 13:39:29 UTC, Steven Schveighoffer wrote: // used to be scope int* ptr() { return ints; } scope inout(int)* ptr() inout { return ints; } Does scope apply to the return value or the `this` reference? I

Re: Friends don't let friends use inout with scope and -dip1000

2018-08-20 Thread Atila Neves via Digitalmars-d
On Friday, 17 August 2018 at 13:39:29 UTC, Steven Schveighoffer wrote: On 8/17/18 3:36 AM, Atila Neves wrote: Here's a struct: - struct MyStruct {     import core.stdc.stdlib;     int* ints;     this(int size) @trusted { ints = cast(int*) malloc(size); }     ~this()

Re: ushort + ushort = int?

2018-08-20 Thread rikki cattermole via Digitalmars-d-learn
On 20/08/2018 9:19 PM, Andrey wrote: On Monday, 20 August 2018 at 08:49:00 UTC, rikki cattermole wrote: Yes. On x86 int's will be faster just an FYI so it does make sense to use them for computation. Inconveniently always use casts. Why in D one decided to do in such way? C.

  1   2   >