Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-04 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 02:54:47 UTC, Joe wrote: On Wednesday, 4 July 2018 at 02:16:00 UTC, Seb wrote: Hmm, calling e.g. fprintf with stdout should just work: --- void main() { import core.stdc.stdio; fprintf(stdout, "Hello %s", "world".ptr); } --- Could you maybe provide your who

Inference of auto storage classes for interface function return type

2018-07-04 Thread Timoses via Digitalmars-d-learn
How can I return inferred storage class from interface functions? I can't use auto as return value in interface. Neither can I use "inout" as I don't pass a parameter. // Ref Type interface IRef { Ref opIndex(size_t idx) const; } class CRe

Re: Inference of auto storage classes for interface function return type

2018-07-04 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 14:07:35 UTC, Timoses wrote: How can I return inferred storage class from interface functions? I can't use auto as return value in interface. Neither can I use "inout" as I don't pass a parameter. // Ref Type interface IRef {

Re: Inference of auto storage classes for interface function return type

2018-07-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 04, 2018 14:07:35 Timoses via Digitalmars-d-learn wrote: > How can I return inferred storage class from interface functions? > I can't use auto as return value in interface. Neither can I use > "inout" as I don't pass a parameter. > > // Ref Type > interface IRef > { >

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-04 Thread aliak via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 14:43:37 UTC, Steven Schveighoffer wrote: On 7/3/18 10:37 AM, ag0aep6g wrote: On Tuesday, 3 July 2018 at 13:32:52 UTC, aliak wrote: foreach (c; "👩‍👩‍👦‍👦🏳️‍🌈") {   writeln(c); } So basically the above just doesn't work. Prints gibberish. Because you're printing one

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-04 Thread aliak via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 14:37:32 UTC, Adam D. Ruppe wrote: On Tuesday, 3 July 2018 at 13:32:52 UTC, aliak wrote: [...] What system are you on? Successfully printing this stuff depends on a lot of display details too, like writeln goes to a terminal/console and they are rarely configured t

Cleanup class after method?

2018-07-04 Thread JN via Digitalmars-d-learn
Imagine I have a very short-lived class: void print(File f) { PrinterManager pm = new PrinterManager(); pm.print(f); } My understanding is that PrinterManager will be GC allocated, and when it goes out of scope, the GC will possibly clean it up at some point in the future. But I know t

Re: Cleanup class after method?

2018-07-04 Thread Mr.Bingo via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 15:47:25 UTC, JN wrote: Imagine I have a very short-lived class: void print(File f) { PrinterManager pm = new PrinterManager(); pm.print(f); } My understanding is that PrinterManager will be GC allocated, and when it goes out of scope, the GC will possibly

Re: Inference of auto storage classes for interface function return type

2018-07-04 Thread Timoses via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 15:12:15 UTC, Jonathan M Davis wrote: You can make opIndex inout instead of const. That way, inout applies to the invisible this reference, just like it would with const. Awww, thanks! I was kinda hovering around this[1] section and didn't quite see the MemberFu

Re: Cleanup class after method?

2018-07-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 04, 2018 15:47:25 JN via Digitalmars-d-learn wrote: > Imagine I have a very short-lived class: > > void print(File f) > { > PrinterManager pm = new PrinterManager(); > pm.print(f); > } > > My understanding is that PrinterManager will be GC allocated, and > when it goes

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-04 Thread ag0aep6g via Digitalmars-d-learn
On 07/04/2018 05:12 PM, aliak wrote: Is updating unicode stuff to the latest a matter of some config file somewhere with the code point configurations that result in specific graphemes? I don't know. [...] Also, any reason (technical or otherwise) that we have to slice a grapheme to get it pr

Using C++ with D / returning a templated type from C++

2018-07-04 Thread Robert M. Münch via Digitalmars-d-learn
I have the following C++ code and want to give the D/C++ integration a new try: template class Array {...} class myClass {...} typedef Array myClassArray; myClassArray classA::getArray() noexcept {...} How does the D binding for this look like? I tried something l

Re: Inference of auto storage classes for interface function return type

2018-07-04 Thread ag0aep6g via Digitalmars-d-learn
On 07/04/2018 05:59 PM, Timoses wrote: There's an empty 19.10.10 point without content[3] : D. Maybe a placeholder? [...] [3]: https://dlang.org/spec/function.html#inout-functions Just a bug. https://github.com/dlang/dlang.org/pull/2407

Re: Using C++ with D / returning a templated type from C++

2018-07-04 Thread vit via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 17:32:49 UTC, Robert M. Münch wrote: I have the following C++ code and want to give the D/C++ integration a new try: template class Array {...} class myClass {...} typedef Array myClassArray; myClassArray classA::getArray() noexcept {

Re: Using C++ with D / returning a templated type from C++

2018-07-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/4/18 1:32 PM, Robert M. Münch wrote: I have the following C++ code and want to give the D/C++ integration a new try: template class Array {...} class myClass {...} typedef Array myClassArray; myClassArray classA::getArray() noexcept {...} How does the D binding for thi

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-04 Thread Chris M. via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 18:35:43 UTC, kinke wrote: On Tuesday, 3 July 2018 at 17:54:08 UTC, Seb wrote: [...] AFAICT, the issue is that MinGW is used, as opposed to MinGW-w64 (a confusingly separate project unfortunately AFAIK). There's no SetWindowLongPtr for Win32, it's #defined as SetW

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-04 Thread kinke via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 20:36:55 UTC, Chris M. wrote: On Tuesday, 3 July 2018 at 18:35:43 UTC, kinke wrote: On Tuesday, 3 July 2018 at 17:54:08 UTC, Seb wrote: [...] AFAICT, the issue is that MinGW is used, as opposed to MinGW-w64 (a confusingly separate project unfortunately AFAIK). T

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-04 Thread crimaniak via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 14:39:34 UTC, ag0aep6g wrote: Looks like forum.dlang.org has a problem when they appear side by-side. Works (in the preview): 👩‍👩‍👦‍👦 🏳️‍🌈 Doesn't work: 👩‍👩‍👦‍👦🏳️‍🌈 For me, it looks as the used font has ligatures for these faces. Mozilla under Linux, I guess it's

how to import file from another path in dub ?

2018-07-04 Thread Flaze07 via Digitalmars-d-learn
I have a dub project, and I put the importPath to the path of the file I want to import and the source file to the source folder, and it appears that I have succeeded at importing the module, but there's one problem, it appears like I need to define some sort of thing, because the error says "

Re: Cleanup class after method?

2018-07-04 Thread Flaze07 via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 16:02:25 UTC, Jonathan M Davis wrote: -dip1000 fully implements scope so that it verifies that no reference escapes, but it's not ready yet, let alone the default behavior. - Jonathan M Davis I read the proposal about -dip1000 ( not all, some ) and there is also

Re: Using C++ with D / returning a templated type from C++

2018-07-04 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-07-04 18:04:25 +, Steven Schveighoffer said: On 7/4/18 1:32 PM, Robert M. Münch wrote: I have the following C++ code and want to give the D/C++ integration a new try: template class Array {...} class myClass {...} typedef Array myClassArray; myClassArray classA::get