[Issue 19279] mutable does not promote to shared

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19279 --- Comment #1 from Manu --- Conversation: https://github.com/dlang/dmd/pull/8782 Reveals that `scope` is also necessary to guarantee that the promoted reference does not escape. Promotion is safe so long as no promoted-reference outlives the call

Typo: to not be a warning (n/t)

2018-09-30 Thread FeepingCreature via Digitalmars-d
Typo: to not* be a warning

Re: Warn on unused imports?

2018-09-30 Thread FeepingCreature via Digitalmars-d
On Wednesday, 26 September 2018 at 16:29:24 UTC, Neia Neutuladh wrote: * If you encounter a mixin in the module you're analyzing, give up. Unfortunately, our code uses mixins heavily, so I don't think this would be useful for us. In any case, I fundamentally don't consider the approach of

[Issue 19280] New: Remove unnecessary error checks in core.time.currSystemTick

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19280 Issue ID: 19280 Summary: Remove unnecessary error checks in core.time.currSystemTick Product: D Version: D2 Hardware: All OS: All Status: NEW

Re: `shared`...

2018-09-30 Thread Nicholas Wilson via Digitalmars-d
On Monday, 1 October 2018 at 04:22:24 UTC, Manu wrote: Ah, good point. So, it could only be allowed if scope... struct Bob { void setThing() shared scope; } That's going to require far-reaching proliferation of `scope`. Do we infer `scope` like the other attributes? For templates (either

Re: `shared`...

2018-09-30 Thread Manu via Digitalmars-d
On Sun, Sep 30, 2018 at 9:00 PM Nicholas Wilson via Digitalmars-d wrote: > > On Monday, 1 October 2018 at 03:33:16 UTC, Manu wrote: > > On Sun, Sep 30, 2018 at 8:20 PM Nicholas Wilson via > > Digitalmars-d wrote: > >> > >> On Monday, 1 October 2018 at 02:29:40 UTC, Manu wrote: > >> > struct Bob

[Issue 19279] New: mutable does not promote to shared

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19279 Issue ID: 19279 Summary: mutable does not promote to shared Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority:

Re: `shared`...

2018-09-30 Thread Nicholas Wilson via Digitalmars-d
On Monday, 1 October 2018 at 03:33:16 UTC, Manu wrote: On Sun, Sep 30, 2018 at 8:20 PM Nicholas Wilson via Digitalmars-d wrote: On Monday, 1 October 2018 at 02:29:40 UTC, Manu wrote: > struct Bob > { > void setThing() shared; > } > > As I understand, `shared` attribution intends to

Re: `shared`...

2018-09-30 Thread Manu via Digitalmars-d
On Sun, Sep 30, 2018 at 8:20 PM Nicholas Wilson via Digitalmars-d wrote: > > On Monday, 1 October 2018 at 02:29:40 UTC, Manu wrote: > > struct Bob > > { > > void setThing() shared; > > } > > > > As I understand, `shared` attribution intends to guarantee that > > I dun > > synchronisation

Re: `shared`...

2018-09-30 Thread Nicholas Wilson via Digitalmars-d
On Monday, 1 October 2018 at 02:29:40 UTC, Manu wrote: struct Bob { void setThing() shared; } As I understand, `shared` attribution intends to guarantee that I dun synchronisation internally. This method is declared shared, so if I have shared instances, I can call it... because it must

`shared`...

2018-09-30 Thread Manu via Digitalmars-d
struct Bob { void setThing() shared; } As I understand, `shared` attribution intends to guarantee that I dun synchronisation internally. This method is declared shared, so if I have shared instances, I can call it... because it must handle thread-safety internally. void f(ref shared Bob a, ref

[Issue 19278] extern(C++, "name") doesn't accept expressions

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19278 --- Comment #1 from Manu --- String expressions don't work (obviously) ``` extern (C++, "std" ~ (UseCxx11Namespace ? "::__1" : "")): ``` --

[Issue 19278] extern(C++, "name") doesn't accept expressions

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19278 Manu changed: What|Removed |Added Keywords||C++ Hardware|x86

[Issue 19278] New: extern(C++, "name") doesn't accept expressions

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19278 Issue ID: 19278 Summary: extern(C++, "name") doesn't accept expressions Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement

[Issue 19258] Cannot @disable ~this()

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19258 --- Comment #5 from Nicholas Wilson --- For structs if no destructor is given then no destructor is compiled. struct S { this(int i){} } extern(C++) S foo() { return S(3); } void main() { import std.traits; import std.stdio;

Re: lodash like utility/algorithms library for D

2018-09-30 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 30 September 2018 at 22:17:05 UTC, aliak wrote: On Saturday, 29 September 2018 at 19:27:29 UTC, Paul Backus wrote: I agree that this is useful, but why not just return a naked `SumType!(string, JSONError)` in that case? Is there some additional value added by the `Expect` wrapper

Re: lodash like utility/algorithms library for D

2018-09-30 Thread aliak via Digitalmars-d-announce
On Saturday, 29 September 2018 at 19:27:29 UTC, Paul Backus wrote: On Saturday, 29 September 2018 at 12:40:14 UTC, aliak wrote: I.e. by allowing you to define the unexepcted you could for instance: enum JSONError { invalidKey, notString, notNumber } auto a = parse(jsonData);

Re: automem v0.3.5 - now with more vector (like std::vector, not Physics)!

2018-09-30 Thread ikod via Digitalmars-d-announce
On Thursday, 20 September 2018 at 14:57:42 UTC, Atila Neves wrote: If you've never heard of automem before, I wrote it to have C++-style smart pointers in D that I could use in @nogc code: http://code.dlang.org/packages/automem Sorry for asking here. Shouldn't this code work? import

Re: Linking with a non-default druntime

2018-09-30 Thread Basile B. via Digitalmars-d-learn
On Sunday, 30 September 2018 at 19:03:17 UTC, Per Nordlöw wrote: How can I link my dmd-compiled program with a specific version of the druntime? druntime is within libphobos. So you must change this. I need this when experimenting with a new GC. Did you try what i proposed earlier ? Until

Linking with a non-default druntime

2018-09-30 Thread Per Nordlöw via Digitalmars-d-learn
How can I link my dmd-compiled program with a specific version of the druntime? I need this when experimenting with a new GC.

[Issue 19277] New: storage class used in alias statement has no effect

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19277 Issue ID: 19277 Summary: storage class used in alias statement has no effect Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

[Issue 19258] Cannot @disable ~this()

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19258 --- Comment #4 from Илья Ярошенко --- (In reply to Nicholas Wilson from comment #3) > I'm not sure what the desired effect of @disabling the destructor is > supposed to achieve? If this is for C++ integration either: a) don't declare > it or b) if

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 30 September 2018 at 14:06:20 UTC, Vinod K Chandran wrote: Thanks. It worked. I would like to compile this as a gui. Now it starts with the cmd. Google search didn't gave me the link i want. Any help ? With the default OPTLINK linker: dmd -L/SUBSYSTEM:windows app.d In this

Re: inline ASM function calling conventions.

2018-09-30 Thread Sjoerd Nijboer via Digitalmars-d-learn
On Sunday, 30 September 2018 at 12:32:08 UTC, kinke wrote: 1) `asm {}` is supported by DMD and LDC, but not by GDC. Good to know. Guess I will be targeting DMD and LDC then. 4) For x86_64, there are 2 (completely different) ABIs, Win64 and the System V one. Specs can be found online. In

Re: inline ASM function calling conventions.

2018-09-30 Thread Sjoerd Nijboer via Digitalmars-d-learn
On Sunday, 30 September 2018 at 12:07:53 UTC, Basile B. wrote: On Sunday, 30 September 2018 at 11:53:17 UTC, Basile B. wrote: Hello, i think this should be here (https://dlang.org/spec/abi.html) because myself i never remember them correctly without playing a bit with a disassembler. After

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 13:21:59 UTC, Adam D. Ruppe wrote: On Sunday, 30 September 2018 at 13:17:33 UTC, Vinod K Chandran wrote: Thanks for the reply. But it says "toUTFz" is not defined. do i missing any import statement ? import std.utf; Thanks. It worked. I would like to compile

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 13:17:33 UTC, Vinod K Chandran wrote: On Sunday, 30 September 2018 at 12:48:17 UTC, Adam D. Ruppe wrote: so usage is: toUTFz!(wchar*)(your_string_here); If passing string literals to Windows, you can put a w at the end, like: MessageBoxW(null, "Hello"w,

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 30 September 2018 at 13:17:33 UTC, Vinod K Chandran wrote: Thanks for the reply. But it says "toUTFz" is not defined. do i missing any import statement ? import std.utf;

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 12:48:17 UTC, Adam D. Ruppe wrote: so usage is: toUTFz!(wchar*)(your_string_here); If passing string literals to Windows, you can put a w at the end, like: MessageBoxW(null, "Hello"w, "World"w, 0); // note the ""w Thanks for the reply. But it says

Re: LDC 1.12.0-beta2 (based on LLVM 7)

2018-09-30 Thread kinke via Digitalmars-d-announce
On Sunday, 30 September 2018 at 12:31:20 UTC, Dennis wrote: "LTO now basically working for Win64 too" That's great! Why the "basically"? Just a precaution as it hasn't been tested extensively yet; Guillaume Piolat (p0nce) successfully tested it with his commercial codebase though, so it's

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 30 September 2018 at 06:56:41 UTC, bauss wrote: There is function that does it for you called toStringz() https://dlang.org/library/std/string/to_stringz.html Not really best for Windows. That's for calling C functions with char*, for Windows, you should be working with wchar*

[Issue 19276] Document accurately calling conventions and demo them in inline asm

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19276 ki...@gmx.net changed: What|Removed |Added CC||ki...@gmx.net --- Comment #1 from

Re: LDC 1.12.0-beta2 (based on LLVM 7)

2018-09-30 Thread Dennis via Digitalmars-d-announce
"LTO now basically working for Win64 too" That's great! Why the "basically"? On Saturday, 29 September 2018 at 19:00:09 UTC, kinke wrote: * New, Easy::jit-like interface for dynamic/JIT compilation. What are the applications of that? Is there a code sample I can check out?

Re: inline ASM function calling conventions.

2018-09-30 Thread kinke via Digitalmars-d-learn
On Sunday, 30 September 2018 at 10:46:33 UTC, Sjoerd Nijboer wrote: I'm kinda puzzled. I'm having trouble getting started with inline asm in D. Suppowse I have the following: void Foo(MyStrunct* first_arg, MyStrunct* second_arg) { asm { naked; version(X86) {

Re: inline ASM function calling conventions.

2018-09-30 Thread Basile B. via Digitalmars-d-learn
On Sunday, 30 September 2018 at 11:53:17 UTC, Basile B. wrote: On Sunday, 30 September 2018 at 10:46:33 UTC, Sjoerd Nijboer wrote: [...] Hello, i think this should be here (https://dlang.org/spec/abi.html) because myself i never remember them correctly without playing a bit with a

[Issue 19276] New: Document accurately calling conventions and demo them in inline asm

2018-09-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19276 Issue ID: 19276 Summary: Document accurately calling conventions and demo them in inline asm Product: D Version: D2 Hardware: All OS: All Status: NEW

Re: inline ASM function calling conventions.

2018-09-30 Thread Basile B. via Digitalmars-d-learn
On Sunday, 30 September 2018 at 10:46:33 UTC, Sjoerd Nijboer wrote: I'm kinda puzzled. I'm having trouble getting started with inline asm in D. Suppowse I have the following: void Foo(MyStrunct* first_arg, MyStrunct* second_arg) { asm { naked; version(X86) {

Re: Most Effective way of developing a new GC for D

2018-09-30 Thread Basile B. via Digitalmars-d
On Sunday, 30 September 2018 at 09:40:10 UTC, Per Nordlöw wrote: I'm gonna play around with creating a GC that alleviates some of the uses described in https://olshansky.me/gc/runtime/dlang/2017/06/14/inside-d-gc.html What's the most effective way of incrementally developing a new pluggable

Re: New With Struct and Getting Class Object Pointers

2018-09-30 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 30 September 2018 at 09:30:38 UTC, Vijay Nayar wrote: Is there a way to either have a constant reference to a class that can be set to a new value, or is there a way to convert the class variable to a class pointer? Alex has mentioned Rebindable, which is the answer to your first

inline ASM function calling conventions.

2018-09-30 Thread Sjoerd Nijboer via Digitalmars-d-learn
I'm kinda puzzled. I'm having trouble getting started with inline asm in D. Suppowse I have the following: void Foo(MyStrunct* first_arg, MyStrunct* second_arg) { asm { naked; version(X86) { /* Do something with the content of I and J. */ }

Re: New With Struct and Getting Class Object Pointers

2018-09-30 Thread Vijay Nayar via Digitalmars-d-learn
On Sunday, 30 September 2018 at 10:28:25 UTC, Alex wrote: On Sunday, 30 September 2018 at 09:30:38 UTC, Vijay Nayar wrote: Is there a way to either have a constant reference to a class that can be set to a new value, or is there a way to convert the class variable to a class pointer? I

Re: New With Struct and Getting Class Object Pointers

2018-09-30 Thread Alex via Digitalmars-d-learn
On Sunday, 30 September 2018 at 09:30:38 UTC, Vijay Nayar wrote: Is there a way to either have a constant reference to a class that can be set to a new value, or is there a way to convert the class variable to a class pointer? For example: void main() { class Thing {} class

Most Effective way of developing a new GC for D

2018-09-30 Thread Per Nordlöw via Digitalmars-d
I'm gonna play around with creating a GC that alleviates some of the uses described in https://olshansky.me/gc/runtime/dlang/2017/06/14/inside-d-gc.html What's the most effective way of incrementally developing a new pluggable GC for druntime with regards to prevention of

Re: New With Struct and Getting Class Object Pointers

2018-09-30 Thread Vijay Nayar via Digitalmars-d-learn
On Sunday, 30 September 2018 at 09:16:42 UTC, Nicholas Wilson wrote: On Sunday, 30 September 2018 at 07:29:00 UTC, Vijay Nayar wrote: Second question. const class variables may not be re-assigned, so if you need a variable that may be reassigned, but may never modify the underlying object, a

Re: New With Struct and Getting Class Object Pointers

2018-09-30 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 30 September 2018 at 07:29:00 UTC, Vijay Nayar wrote: I have two brief questions. Code that uses "new" to create struct objects appears to compile and run. Is this an actual language feature, to get structs on the heap? void main() { struct S {int data = 1;} S* s1

Re: DIP 1014

2018-09-30 Thread Jonathan M Davis via Digitalmars-d
On Sunday, September 30, 2018 1:35:28 AM MDT Shachar Shemesh via Digitalmars-d wrote: > On 30/09/18 10:26, Manu wrote: > > Other implementations make much better use of that built-in space by > > not wasting 8 bytes on an interior pointer for small-strings. > > I will point out that a pointer

Re: New With Struct and Getting Class Object Pointers

2018-09-30 Thread rikki cattermole via Digitalmars-d-learn
On 30/09/2018 8:29 PM, Vijay Nayar wrote: I have two brief questions. Code that uses "new" to create struct objects appears to compile and run. Is this an actual language feature, to get structs on the heap? void main() { struct S {int data = 1;} S* s1 = new S(); S* s2 = s1;  

Re: DIP 1014

2018-09-30 Thread Shachar Shemesh via Digitalmars-d
On 30/09/18 10:26, Manu wrote: Other implementations make much better use of that built-in space by not wasting 8 bytes on an interior pointer for small-strings. I will point out that a pointer that *sometimes* points to an internal member was one of the use cases I documented when I

New With Struct and Getting Class Object Pointers

2018-09-30 Thread Vijay Nayar via Digitalmars-d-learn
I have two brief questions. Code that uses "new" to create struct objects appears to compile and run. Is this an actual language feature, to get structs on the heap? void main() { struct S {int data = 1;} S* s1 = new S(); S* s2 = s1; S s3 = *s1; // Still

Re: DIP 1014

2018-09-30 Thread Manu via Digitalmars-d
On Sat, Sep 29, 2018 at 11:50 PM Walter Bright via Digitalmars-d wrote: > > On 9/29/2018 9:34 PM, Manu wrote: > > GNU's std::string implementation stores an interior pointer! >_< > > > > No other implementation does this. It's a really bad implementation > > actually, quite inefficient. It could

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 06:56:41 UTC, bauss wrote: On Sunday, 30 September 2018 at 06:33:47 UTC, rikki cattermole wrote: null terminated, nothing really special. To elaborate on this. There is function that does it for you called toStringz()

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 06:33:47 UTC, rikki cattermole wrote: No. 2. Can we use D strings in win api functions ?, If not, please show me how to convert strings null terminated, nothing really special. Hi, Thanks for the reply. I somehow managed to display a messagebox with

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread bauss via Digitalmars-d-learn
On Sunday, 30 September 2018 at 06:33:47 UTC, rikki cattermole wrote: null terminated, nothing really special. To elaborate on this. There is function that does it for you called toStringz() https://dlang.org/library/std/string/to_stringz.html

Re: DIP 1014

2018-09-30 Thread Walter Bright via Digitalmars-d
On 9/29/2018 9:34 PM, Manu wrote: GNU's std::string implementation stores an interior pointer! >_< No other implementation does this. It's a really bad implementation actually, quite inefficient. It could make better use of its space for small-strings if it wasn't wasting 8-bytes for an

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread rikki cattermole via Digitalmars-d-learn
On 30/09/2018 7:24 PM, Vinod K Chandran wrote: Hi, I would like to do some win api coding in D. I just taste the syntactic sugar but cant do anything more. I have few questions. 1. Does WinMain is needed for a D program in order to use win api ? No. 2. Can we use D strings in win api

Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
Hi, I would like to do some win api coding in D. I just taste the syntactic sugar but cant do anything more. I have few questions. 1. Does WinMain is needed for a D program in order to use win api ? 2. Can we use D strings in win api functions ?, If not, please show me how to convert strings

Re: Prevent opening binary/other garbage files

2018-09-30 Thread bauss via Digitalmars-d-learn
On Saturday, 29 September 2018 at 15:52:30 UTC, helxi wrote: I'm writing a utility that checks for specific keyword(s) found in the files in a given directory recursively. What's the best strategy to avoid opening a bin file or some sort of garbage dump? Check encoding of the given file? If

Re: DIP 1014

2018-09-30 Thread Jonathan M Davis via Digitalmars-d
On Saturday, September 29, 2018 10:34:20 PM MDT Manu via Digitalmars-d wrote: > Who knows about DIP 1014? (struct move hook) > Is it well received? Is it likely to be accepted soon? > > I'm working on the std::string binding, it's almost finished... but > then I hit a brick wall. > GNU's

Re: DIP 1014

2018-09-30 Thread Mike Parker via Digitalmars-d
On Sunday, 30 September 2018 at 04:34:20 UTC, Manu wrote: Who knows about DIP 1014? (struct move hook) Is it well received? Is it likely to be accepted soon? I'm working on the std::string binding, it's almost finished... but then I hit a brick wall. GNU's std::string implementation stores an