vibe / self contained standalone executable?

2019-07-28 Thread Robert M. Münch via Digitalmars-d-learn
Is it possible to pack a complete "web-app" (serving web-pages and providing REST API) into a single executable so that no other files need to be accessed and everything is servered from something like a "virtual filesystem" which is in memory only? -- Robert M. Münch http://www.saphirion.com

Re: vibe / self contained standalone executable?

2019-07-28 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-07-28 14:14:06 +, Sebastiaan Koppe said: I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on binary files as well. And this works than good together with the vibe framework? So, it's not requiring or forcing one to use fil

Undefined symbol: _dyld_enumerate_tlv_storage (OSX)

2019-10-10 Thread Robert M. Münch via Digitalmars-d-learn
I have two project I want to compile and both times get this error: Undefined symbols for architecture x86_64: "_dyld_enumerate_tlv_storage", referenced from: __d_dyld_getTLSRange in libphobos2.a(osx_tls.o) I'm wondering where this comes from as I didn't see it in the past. Any idea? -- R

Re: Undefined symbol: _dyld_enumerate_tlv_storage (OSX)

2019-10-11 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-10 18:31:25 +, Daniel Kozak said: What dmd version? I think I had an older one like 2.085 or so. I updated to 2.088 and it now seems to work. https://issues.dlang.org/show_bug.cgi?id=20019 I'm on OSX 10.14.6, so this might not be directly related to Catalina but maybe mor

Re: Undefined symbol: _dyld_enumerate_tlv_storage (OSX)

2019-10-14 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-11 18:09:01 +, Jacob Carlborg said: No, I don't think that's the problem. I have the same setup and I don't have this problem. Interesting... but the update seems to have solved the problem. Maybe some old DMD compiler stuff lying around got in the way. What result do you ge

... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-20 Thread Robert M. Münch via Digitalmars-d-learn
I get this error message, which doesn't tell me a lot: rx_filter_subject.d(38,8): Error: class rx_filter_subject.FilterSubject use of rx.subject.SubjectObject!(message).SubjectObject.subscribe(Observer!(message) observer) is hidden by FilterSubject; use alias subscribe = SubjectObject.subscri

Re: ... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-21 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-21 07:04:33 +, John Chapman said: This should work: class FilterSubject : SubjectObject!message { alias subscribe = typeof(super).subscribe; Disposable subscribe(myWidget observer){...} } This now gives: rx_filter_subject.d(66,23): Error: rx_filter_subject.FilterSubject

Re: ... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-22 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-21 18:02:06 +, Robert M. Münch said: This now gives: rx_filter_subject.d(66,23): Error: rx_filter_subject.FilterSubject.subscribe called with argument types (myWidget) matches both: /Users/robby/.dub/packages/rx-0.13.0/rx/source/rx/subject.d(72,16): rx.subject.SubjectObject!(

Re: ... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-23 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-22 20:59:41 +, Ali ‡ehreli said: That says "private paste" for me. Ups, sorry and thanks for letting me know. But I think you have a member function template in the base class. This the lib I use: https://github.com/lempiji/rx/blob/dev/source/rx/subject.d and which gives

Re: ... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-24 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-23 17:22:38 +, Ali ‡ehreli said: On 10/23/2019 02:43 AM, Robert M. Münch wrote: >> Unfortunately, member function template instances are never virtual >> functions, so you can't override them. > > What I don't understand is: > > 1. The RX lib has a member function template

Re: ... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-25 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-24 19:45:42 +, Ali ‡ehreli said: One practical reason is, the number of their instances cannot be known when the interface (or base class) is compiled. ... Ali, first, thanks a lot for your answers. If the compiler is a 1-pass one I see the problem, otherwise one could first

Re: ... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

2019-10-26 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-25 15:20:21 +, Ali ‡ehreli said: On 10/25/2019 07:34 AM, Robert M. Münch wrote: > If the compiler is a 1-pass one I see the problem, otherwise one could > first get a "total overview" and create the necessary vtbl entries after > everything is known. Maybe this is not "how a

Re: Good way let low-skill people edit CSV files with predefined row names?

2019-10-26 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-24 16:03:26 +, Dukc said: We're planning to have our product preview program to calculate and suggest a price for the product displayed. There are a lot of variables to take into account, so it's essential the users can edit the price variables themselves. Hi, maybe you want t

Read Once then reset/init value?

2019-10-29 Thread Robert M. Münch via Digitalmars-d-learn
I quite often have the pattern where a value should be read just once and after this reset itself. The idea is to avoid that others read the value by accident and get an older state, instead they get an "invalid/reset" value. Is there a library function that can mimic such a behaviour? -- Rob

Re: Accuracy of floating point calculations

2019-10-30 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-29 17:43:47 +, H. S. Teoh said: On Tue, Oct 29, 2019 at 04:54:23PM +, ixid via Digitalmars-d-learn wrote: On Tuesday, 29 October 2019 at 16:11:45 UTC, Daniel Kozak wrote: On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: AFAIK dmd use real for floating point operations i

Re: Accuracy of floating point calculations

2019-10-31 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-30 15:12:29 +, H. S. Teoh said: It wasn't a wrong *decision* per se, but a wrong *prediction* of where the industry would be headed. Fair point... Walter was expecting that people would move towards higher precision, but what with SSE2 and other such trends, and the general ne

Re: Accuracy of floating point calculations

2019-10-31 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-31 16:07:07 +, H. S. Teoh said: Maybe you might be interested in this: https://stackoverflow.com/questions/6769881/emulate-double-using-2-floats Thanks, I know the 2nd mentioned paper. Maybe switch to PPC? :-D Well, our customers don't use PPC Laptops ;-) otherwise

Re: Read Once then reset/init value?

2019-11-03 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-29 23:28:35 +, Simen Kjærås said: On Tuesday, 29 October 2019 at 22:24:20 UTC, Robert M. Münch wrote: I quite often have the pattern where a value should be read just once and after this reset itself. The idea is to avoid that others read the value by accident and get an older s

csvReader & specifying separator problems...

2019-11-14 Thread Robert M. Münch via Digitalmars-d-learn
Just trying a very simple thing and it's pretty hard: "Read a CSV file (raw_data) that has a ; separator so that I can iterate over the lines and access the fields." csv_data = raw_data.byLine.joiner("\n") From the docs, which I find extremly hard to understand: auto csvReader(Conte

Re: csvReader & specifying separator problems...

2019-11-14 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-11-14 13:08:10 +, Mike Parker said: Contents, ErrorLevel, Range, and Separator are template (i.e. compile-time) parameters. Input, delimiter, and quote are function (i.e. runtime) parameters. Mike, thanks a lot... I feel like an idiot. As casual D programmer the template-syntax i

std.json / nested key/value access?

2019-11-15 Thread Robert M. Münch via Digitalmars-d-learn
I have: JSONValue j = parseJSON(json_string).object; writeln(j);// works writeln(j["a"]); // works writeln(j["a"].object["b"]); // bombs Runtime error: std.json.JSONException@std/json.d(276): JSONV

Re: std.json / nested key/value access?

2019-11-15 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-11-15 17:23:38 +, Steven Schveighoffer said: On 11/15/19 12:05 PM, Robert M. Münch wrote: JSONValue j = parseJSON(json_string).object;  writeln(j); // works  writeln(j["a"]); // works  writeln(j["a"].object["b"]); // bombs Maybe

static assert(version(x)) ?

2019-11-26 Thread Robert M. Münch via Digitalmars-d-learn
How can I write something like this to check if any of a set of specific versions is used? static assert(!(version(a) | version(b) | version(c)): The problem is that I can use version(a) like a test, and the symbol a is not accessbile from assert (different, non-accessible namespace). -- Rob

Re: static assert(version(x)) ?

2019-11-28 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-11-27 18:50:07 +, Johan Engelen said: On Tuesday, 26 November 2019 at 12:53:02 UTC, Jonathan M Davis wrote: On Tuesday, November 26, 2019 4:29:18 AM MST S.G via Digitalmars-d-learn wrote: On Tuesday, 26 November 2019 at 10:24:00 UTC, Robert M. Münch wrote: How can I write somethin

Template mixin / unresolved external / scope problem?

2019-11-28 Thread Robert M. Münch via Digitalmars-d-learn
I have: a.d: extern (C) void myFuncA(); void myFuncB() { myFuncA(); } b.d: public import a; mixin template MYFUNCA() { extern (C) void myFuncA() {...} } c.d: import b; mixin MYFUNCA; ...further code... Compiling such a structure gives me an unresolved external in a.d/myFunc

Re: Template mixin / unresolved external / scope problem?

2019-11-29 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-11-28 16:36:36 +, Jacob Carlborg said: Are you using the latest version, 2.089.0? It might be fixed in that version [1]. [1] https://dlang.org/changelog/2.089.0.html#mixin_template_mangling Ha! Thanks Jacob, that looks like the root-cause. Didn't expect to use a feature which wa

Strange casting error when using lamdas

2019-12-03 Thread Robert M. Münch via Digitalmars-d-learn
I have very strange casting error I don't understand: alias typeof(windows_message_streams[WM_MOUSEMOVE].filter!(win => (win.wParam & MK_LBUTTON))) WM_MOUSEMOVE_LBUTTON_TYPE; WM_MOUSEMOVE_LBUTTON_TYPE WM_MOUSEMOVE_LBUTTON_STREAM; pragma(msg,typeof(WM_MOUSEMOVE_LBUTTON_STREAM)); FilterObservab

Re: Strange casting error when using lamdas

2019-12-03 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-03 16:34:43 +, Robert M. Münch said: I have very strange casting error I don't understand: alias typeof(windows_message_streams[WM_MOUSEMOVE].filter!(win => (win.wParam & MK_LBUTTON))) WM_MOUSEMOVE_LBUTTON_TYPE; WM_MOUSEMOVE_LBUTTON_TYPE WM_MOUSEMOVE_LBUTTON_STREAM; pragma(msg,

Re: Strange casting error when using lamdas

2019-12-04 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-03 16:34:43 +, Robert M. Münch said: I have very strange casting error I don't understand: alias typeof(windows_message_streams[WM_MOUSEMOVE].filter!(win => (win.wParam & MK_LBUTTON))) WM_MOUSEMOVE_LBUTTON_TYPE; WM_MOUSEMOVE_LBUTTON_TYPE WM_MOUSEMOVE_LBUTTON_STREAM; pragma(msg,

Re: Strange casting error when using lamdas

2019-12-05 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-04 19:23:07 +, Steven Schveighoffer said: Is one a delegate and one a function pointer? This can easily happen for untyped lambdas. That's a very good point and hint. A function pointer will be 8LU and a delegate 16LU, right? This is a strong argument that this is really the p

Re: Strange casting error when using lamdas

2019-12-05 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-04 19:23:07 +, Steven Schveighoffer said: Is one a delegate and one a function pointer? This can easily happen for untyped lambdas. Not sure if the code-snippets already give an explanation but the differences I have are: 1. Working case template filter(alias pred) {

D-ish way to work with strings?

2019-12-22 Thread Robert M. Münch via Digitalmars-d-learn
I want to do all the basics mutating things with strings: append, insert, replace What is the D-ish way to do that since string is aliased to immutable(char)[]? Using arrays, using ~ operator, always copying, changing, combining my strings into a new one? Does it make sense to think about redu

Re: D-ish way to work with strings?

2019-12-22 Thread Robert M. Münch via Digitalmars-d-learn
Want to add I'm talking about unicode strings. Wouldn't it make sense to handle everything as UTF-32 so that iteration is simple because code-point = code-unit? And later on, convert to UTF-16 or UTF-8 on demand? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Re: D-ish way to work with strings?

2019-12-27 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-22 18:45:52 +, Steven Schveighoffer said: switch to using char[]. Unfortunately, there's a lot of code out there that accepts string instead of const(char)[], which is more usable. I think many people don't realize the purpose of the string type. It's meant to be something that

Re: D-ish way to work with strings?

2019-12-27 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-23 15:05:20 +, H. S. Teoh said: On Sun, Dec 22, 2019 at 06:27:03PM +0100, Robert M. Münch via Digitalmars-d-learn wrote: Want to add I'm talking about unicode strings. Wouldn't it make sense to handle everything as UTF-32 so that iteration is simple because code-po

What type does byGrapheme() return?

2019-12-27 Thread Robert M. Münch via Digitalmars-d-learn
I love these documentation lines in the D docs: auto byGrapheme(Range)(Range range) How should I know what auto is? Why not write the explicit type so that I know what to expect? When declaring a variable as class/struct member I can't use auto but need the explicit type... I used ty

Re: What type does byGrapheme() return?

2019-12-29 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-27 17:54:28 +, Steven Schveighoffer said: This is the rub with ranges. You need to use typeof. There's no other way to do it, because the type returned by byGrapheme depends on the type of Range. Hi, ok, thanks a lot and IMO these are the fundamental important information for

Re: What type does byGrapheme() return?

2019-12-29 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-27 19:44:59 +, H. S. Teoh said: Since graphemes are variable-length in terms of code points, you can't exactly *edit* a range of graphemes -- you can't replace a 1-codepoint grapheme with a 6-codepoint grapheme, for example, since there's no space in the underlying string to store

Re: What type does byGrapheme() return?

2020-01-04 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-31 21:36:56 +, Steven Schveighoffer said: The fact that a Grapheme's return requires you keep the grapheme in scope for operations seems completely incorrect and dangerous IMO (note that operators are going to always have a ref this, even when called on an rvalue). So even thoug

decodeGrapheme & static array

2020-01-04 Thread Robert M. Münch via Digitalmars-d-learn
I have: Grapheme[] gr; dchar[1] buf; encode(buf, cast(dchar)myData); gr =~ decodeGrapheme(buf[]); Which gives: Error: template std.uni.decodeGrapheme cannot deduce function from argument types !()(dchar[]), candidates are: C:\D\dmd2\windows\bin\..\..\src\phobos\std\uni.d(7164,10): deco

Re: What type does byGrapheme() return?

2020-01-06 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-01-05 04:18:34 +, H. S. Teoh said: At a minimum, I think we should file a bug report to investigate whether Grapheme.opSlice can be implemented differently, such that we avoid this obscure referential behaviour that makes it hard to work with in complex code. I'm not sure if this is

What is the difference between a[x][y] and a[x,y]?

2020-01-07 Thread Robert M. Münch via Digitalmars-d-learn
I read all the docs but I'm not toally sure. Is it that [x][y] is a 2D array-index, where as [x,y] is a slice? But the example in docs for opIndexAssign uses the [x,y] syntax, which is confusing: ``` struct A { int opIndexAssign(int value, size_t i1, size_t i2); } void test() { A a;

Re: What is the difference between a[x][y] and a[x,y]?

2020-01-07 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-01-07 17:42:48 +, Adam D. Ruppe said: So [x][y] indexes an array of arrays. Yes, that's what I understand. And both can be dynamic, so that I can have a "flattering" layout where not all arrays have the same length. [x,y] indexes a single array that has two dimensions. Does

Re: What is the difference between a[x][y] and a[x,y]?

2020-01-08 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-01-07 19:06:09 +, H. S. Teoh said: It's up to you how to implement all of this, of course. The language itself doesn't ship a built-in type that implements this, but it does provide the scaffolding for you to build a custom multi-dimensional array type. Hi, thanks for your extensiv

How to use -profile when I initialize D-runtime myself?

2020-01-15 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I had a related question in the "Does -profile need the D runtime?" thread. Since D runtime is required for profile to work, the question is how can I use profile when initializing it myself? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

How to explicitly state the expression in with(...)?

2020-02-01 Thread Robert M. Münch via Digitalmars-d-learn
I have quite often this pattern: with(x.y.z){ xyzFunc(); // = x.y.z.xyzFunc() myFunc(x.y.z, ...); } and it would be cool to write: with(t = x.y.z){ // work like an implicit alias xyzFunc(); // = x.y.z.xyzFunc() myFunc(t, ...); } Is there anything which

dub / use git branch

2020-02-16 Thread Robert M. Münch via Digitalmars-d-learn
I want to use a specific branch version if a package. I specified the branch version in a dub.selections.json file. But it seems that dub requires a ZIP file that can be downloaded from code.dlang.org, which of course fails because the branch is only available on github. Fetching rtree ~fix-

Dynamic array of Cycle buffers of size 2 which use a struct?

2020-02-22 Thread Robert M. Münch via Digitalmars-d-learn
I don't get how I can create a dynamic array of Cycle buffers of size 2 which use a struct. struct ms { int a; int b; } ms[2] msBuffer; alias circularStructBuffersT = typeof(cycle(msBuffer)); circularStructBuffersT[int] circularStructBuffers; int i = 2; auto x = circularStructBuffe

std.datetime & timzone specifier: 2018-11-06T16:52:03+01:00

2020-03-07 Thread Robert M. Münch via Digitalmars-d-learn
It looks like std.datetime is not anticipating the +1:00 part of a date like: "2018-11-06T16:52:03+01:00" Those dates are used all over on the internet and I'mm wondering why it's not supported. Any reason? Is this +01:00 not ISO conforming? -- Robert M. Münch http://www.saphirion.com smarter

static foreach / How to construct concatenated string?

2020-03-07 Thread Robert M. Münch via Digitalmars-d-learn
I want to create a "CREATE TABLE data (...)" where the columns are derived from struct member names. Something like: string s = "CREATE TABLE data("; static foreach(f; FieldNameTuple!myStruct) { s ~= f ~ ","; } s ~= ");"; Which of course doesn't work... I didn't find any reference how to bu

Re: static foreach / How to construct concatenated string?

2020-03-07 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-03-07 16:40:15 +, Adam D. Ruppe said: Use regular foreach with a regular string. Put that inside a function. Then simply use that function to initialize your other thing and enjoy the magic of CTFE! Perfect! This implicit CTFE is a tricky thing to see/remember/... Feeling a bit

Re: static foreach / How to construct concatenated string?

2020-03-08 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-03-07 16:41:47 +, MoonlightSentinel said: On Saturday, 7 March 2020 at 16:30:59 UTC, Robert M. Münch wrote: Is this possible at all? You can use an anonymous lambda to build the string in CTFE: -- struct S { int a; bool b; } imp

Re: std.datetime & timzone specifier: 2018-11-06T16:52:03+01:00

2020-03-08 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-03-07 12:10:27 +, Jonathan M Davis said: I take it that you're asking why you don't get the time zone as part of the string when you call one of the to*String functions? The problem is, the from* functions give an error, that this is not an ISO date. I get this in an XML respons

Re: static foreach / How to construct concatenated string?

2020-03-08 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-03-07 16:41:47 +, MoonlightSentinel said: You can use an anonymous lambda to build the string in CTFE: -- struct S { int a; bool b; } import std; enum string sql = { string s = "CREATE TABLE data("; static foreach(f; Fi

Dynamically init a struct with values calculated from other values in the struct?

2020-04-04 Thread Robert M. Münch via Digitalmars-d-learn
I need to dynamically initialize a fixed number of entries of the form: (start, length) and iterate over them. Hence, I think a struct makes sense: struct S { s1, l1 , s2, l2 , s3, l3 } Now I need to initialize the values like this: S myS = {s1:0, l1:10, s2:(2*s1), ...}; So I somehow would

No implicit opOpAssign for structs with basic types?

2020-04-04 Thread Robert M. Münch via Digitalmars-d-learn
D doesn't have implicit operators for structs? struct S {float a, float b}; S a = {1, 5}; S b = {2, 5); a += b; Error: a is not a scalar, it is a S So I really have to write an overloaded operator for such cases? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Re: No implicit opOpAssign for structs with basic types?

2020-04-04 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-04 10:32:32 +, Ferhat Kurtulmuş said: Probably I didn't understand what you mean. Sorry if this is not the case, but this one is easy. ... struct S { float a; float b; S opOpAssign(string op)(ref S rhs) if (op == "+"){ this.a += rhs.a; this.b +=

Re: No implicit opOpAssign for structs with basic types?

2020-04-04 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-04 10:32:32 +, Ferhat Kurtulmuş said: struct S { float a; float b; S opOpAssign(string op)(ref S rhs) if (op == "+"){ this.a += rhs.a; this.b += rhs.b; return this; } } If the struct is from some 3rd party source, how can I add suc

__init unresolved external when using C library structs converted with dstep

2020-04-14 Thread Robert M. Münch via Digitalmars-d-learn
I use a C libary and created D imports with dstep. It translates the C structs to D structs. When I now use them, everything compiles fine but I get an unresolved external error: WindowsApp1.obj : error LNK2019: unresolved external symbol "myCstruct.__init" (_D7myCStruct6__initZ) referenced

Re: __init unresolved external when using C library structs converted with dstep

2020-04-14 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-14 18:23:05 +, Steven Schveighoffer said: On 4/14/20 1:51 PM, Robert M. Münch wrote: I use a C libary and created D imports with dstep. It translates the C structs to D structs. When I now use them, everything compiles fine but I get an unresolved external error: WindowsApp1

Re: __init unresolved external when using C library structs converted with dstep

2020-04-15 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-14 18:44:55 +, Steven Schveighoffer said: On 4/14/20 2:29 PM, Robert M. Münch wrote: Ah, ok. That's why the problem went (temporarly) away when I did a: myCstruct a = {0,0}; for example? I don't know what causes it to be emitted when. Sometimes it doesn't make a whole lot of

Re: __init unresolved external when using C library structs converted with dstep

2020-04-16 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-15 15:18:43 +, Steven Schveighoffer said: The difference is you are telling the compiler that it should generate any symbols for those types. If you just import them, then it's expecting something else to build those symbols. Maybe I'm a bit confused, but that's quite different

Re: __init unresolved external when using C library structs converted with dstep

2020-04-17 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-16 18:33:51 +, Basile B. said: On Tuesday, 14 April 2020 at 17:51:58 UTC, Robert M. Münch wrote: I use a C libary and created D imports with dstep. It translates the C structs to D structs. When I now use them, everything compiles fine but I get an unresolved external error:

Re: __init unresolved external when using C library structs converted with dstep

2020-04-17 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-17 09:06:44 +, Dominikus Dittes Scherkl said: On Friday, 17 April 2020 at 08:59:41 UTC, Robert M. Münch wrote: How would that look like? myStruct ms = void; // ??? Exactly. Cool... never saw this / thought about it... will remember it, hopefully. -- Robert M. Münch http://w

Wich: opIndex overloading by return type

2020-04-19 Thread Robert M. Münch via Digitalmars-d-learn
Wouldn't it make a lot of sense to allow different opIndex implementations based on return type? class myC { myT1 opIndex(int x) myT2 opIndex(int x) } Depending on the types involved myC[1] woudl return myT1 or myT2. Use-case: I have a geomentry object and in one case I get x0,

Idomatic way to guarantee to run destructor?

2020-04-30 Thread Robert M. Münch via Digitalmars-d-learn
For ressource management I mostly use this pattern, to ensure the destructor is run: void myfunc(){ MyClass X = new MyClass(); scope(exit) X.destroy; } I somewhere read, this would work too: void myfunc(){ auto MyClass X = new MyClass(); } What does this "auto" does here? Wouldn't void myf

Re: Idomatic way to guarantee to run destructor?

2020-05-02 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-30 17:04:43 +, Ben Jones said: I think you want to use scope rather than auto which will put the class on the stack and call its destructor: https://dlang.org/spec/attribute.html#scope Yes, thanks. -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Re: Idomatic way to guarantee to run destructor?

2020-05-02 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-30 17:45:24 +, Steven Schveighoffer said: No, auto is declaring that there's about to be a variable here. In actuality, auto does nothing in the first case, it just means local variable. But without the type name, the type is inferred (i.e. your second example). This does not do

countUntil with negated pre-defined predicate?

2020-05-02 Thread Robert M. Münch via Digitalmars-d-learn
This works: countUntil!(std.uni.isWhite)("hello world")) How can I switch this to (not working); countUntil!(!std.uni.isWhite)("hello world")) without having to write my own predicate? Or is there an even better way to search for all "drawable unicode characters"? -- Robert M

Re: Idomatic way to guarantee to run destructor?

2020-05-02 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-05-02 18:18:44 +, Steven Schveighoffer said: On 5/2/20 4:44 AM, Robert M. Münch wrote: How would that help, because the class instance is now unusable anyway. So I have it around like a zombie and others might think: "Hey you look normal, let's get in contact" and then you are doo

Re: Idomatic way to guarantee to run destructor?

2020-05-03 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-05-02 20:43:16 +, Steven Schveighoffer said: destroy sets all the values to the .init value. And it nulls the vtable pointer. Ok, that makes sense. Thanks for all the deep internal details. There is always a lot to learn. -- Robert M. Münch http://www.saphirion.com smarter | bet

Re: countUntil with negated pre-defined predicate?

2020-05-03 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-05-02 22:33:59 +, Harry Gillanders said: This depends on what you classify as drawable, and what you consider to be a character (the joys of Unicode), Absolutely... however, trying getting close to what works in most cases. and why you want to search for them anyway. I'm doing

Re: countUntil with negated pre-defined predicate?

2020-05-04 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-05-03 21:59:54 +, Harry Gillanders said: I'm unsure as to which part is unclear, Well, I was trapped by this formatting/syntax: size_t drawableCharacterCount (CodePoints) (auto ref CodePoints codePoints) if (isInputRange!CodePoints && is(ElementType!CodePoints : d

Are compile time generated, stable and unique IDs possible?

2020-05-08 Thread Robert M. Münch via Digitalmars-d-learn
Let's assume I have an GUI application and I want to record some user-actions which can be replayed. And this replay should be possible even if the application layout changes. Hence, I somehow need to identify the run-time objects in a way that this identification stays the same while the app

vibe / CTRL+C not terminating server

2020-06-13 Thread Robert M. Münch via Digitalmars-d-learn
After a CTRL+C I still have the server process running on OSX. Any idea? [main() INF] Listening for requests on http://[::1]:8080/ [main() INF] Listening for requests on http://127.0.0.1:8080/ [main() INF] Please open http://127.0.0.1:8080/ in your browser. ^C [main() INF] Receive

vibe.d / experience / feedback

2020-09-30 Thread Robert M . Münch via Digitalmars-d-learn
Hi, we are currently using vibe.d for a prototype and I want to post some experiences. I know one shouldn't only address the problems but provide some solutions. However, our current use-case is that we want to get a job done, and not creating a web-framework. 1. For many things the docs are mi

Re: vibe.d / experience / feedback

2020-10-03 Thread Robert M . Münch via Digitalmars-d-learn
On 3 Oct 2020 at 13:14:57 CEST, "0xEAB" wrote: > On Saturday, 3 October 2020 at 07:54:58 UTC, Martin wrote: >> On Friday, 2 October 2020 at 09:46:09 UTC, Denis Feklushkin >> wrote: >>> Because standard implementation worse? >> >> What do you mean with "worse"? > > It's said to be pretty sl

Re: vibe.d / experience / feedback

2020-10-11 Thread Robert M . Münch via Digitalmars-d-learn
On 6 Oct 2020 at 10:07:56 CEST, "ddcovery" wrote: > I found myself in a similar situation recently, and I can't help > but ask you: What technology do you use regularly? Hi, well we use a couple of different things. Scripting languages, C, Lua, .. > What drives/draws you to try dlang/vibe.d?

Re: vibe.d / experience / feedback

2020-10-12 Thread Robert M . Münch via Digitalmars-d-learn
On 11 Oct 2020 at 16:46:13 CEST, "Ola Fosheim Grøstad" wrote: > Ada, Java, Eiffel are supposed to. Yes... beside Java, the other two are already in the exotic department... > I'm not sure if Go is a success in that department either. I > suspect it tanks when programs get large. Go seems to b

Re: vibe.d / experience / feedback

2020-10-12 Thread Robert M . Münch via Digitalmars-d-learn
On 11 Oct 2020 at 21:10:20 CEST, "tastyminerals" wrote: > And I feel like you guys will just pick Go because it will get > stuff done. That's the main focus from a company perspective. We try to waste as less time & money as possible. > When I just started learning about D ecosystem, vibe freq

Re: vibe.d / experience / feedback

2020-10-12 Thread Robert M . Münch via Digitalmars-d-learn
On 12 Oct 2020 at 13:13:27 CEST, "Ola Fosheim Grøstad" wrote: > Yes, it is a good fit for web services with medium sized code > bases. We don't have a lot of "big project" experience with Go yet, but we would use it for a plain-old desktop application. Even most people seem to use Go for the w

Re: vibe.d / experience / feedback

2020-10-13 Thread Robert M . Münch via Digitalmars-d-learn
On 12 Oct 2020 at 21:58:12 CEST, "Ola Fosheim Grøstad" wrote: > On Monday, 12 October 2020 at 11:06:55 UTC, Robert M. Münch wrote: >> Go seems to be kept as simple as possible, even if you have to >> write more code. Which is, in the long run, the cheaper and >> smaller burden. No tricks, no

Re: vibe.d / experience / feedback

2020-10-13 Thread Robert M . Münch via Digitalmars-d-learn
On 13 Oct 2020 at 09:57:14 CEST, "aberba" wrote: > D is a great language that is capable of solving any problem > easier than what it'll take to do in equivalent languages. Don't get me wrong, D is great, it has a lot of technically cool things on board. As said, those technical things won't b

Interfacing with C++ Class named Object

2018-05-01 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I'm mostly doing simple C-API wrappers around C++ code to access thigns from D. However, I wanted to try how far I can come using C++ directly. I have the following C++ code in namespace N: class Image : public Object { Error create(int w, int h, uint32_t p) noexcept; } And I have

Re: Interfacing with C++ Class named Object

2018-05-01 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-01 16:07:30 +, Timoses said: On Tuesday, 1 May 2018 at 15:24:09 UTC, Robert M. Münch wrote: Hi, I'm mostly doing simple C-API wrappers around C++ code to access thigns from D. However, I wanted to try how far I can come using C++ directly. I have the following C++ code in name

Re: Interfacing with C++ Class named Object

2018-05-01 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-01 17:14:53 +, Robert M. Münch said: Yes, great! Thanks. I could extend the code now. But I get a next problem: extern (C++, b2d) { class AnyBase { bool isShared(); } pragma(mangle, "Object"); class b2dObject : AnyBase { } class Image : b2dObject { // class Im

Digger v3.0 alpha 5 / DMD 2.080.0 / Can't build...

2018-05-02 Thread Robert M. Münch via Digitalmars-d-learn
Hi, digger won't build because it sees some local changes to file, which I didn't do: D:\develop\d-language\Digger> ./digger build --model=64 digger: Building spec: master digger: Adding D:\develop\d-language\Digger\work\dl\git\cmd to PATH. digger: Updating repo... Fetching origin digger: Starti

Re: Digger v3.0 alpha 5 / DMD 2.080.0 / Can't build...

2018-05-02 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-02 09:39:41 +, Seb said: Works fine for me with 2.080.0. Did you maybe modify your working directory locally? Hi, not that I know about... If so, try nuking `work` away. I did and digger downloaded a bunch of things and failed wiht this: D:\develop\d-language\Digger> .\digg

C++ / Wrong function signature generated for reference parameter

2018-05-02 Thread Robert M. Münch via Digitalmars-d-learn
I have the following C++ function signature: uint _begin(Image& image, const InitParams* initParams) and the following D code: class InitParams { } class B2D { uint _begin(ref Image image, InitParams initParams); } But this compiles to the following signature which is not found by

Re: C++ / Wrong function signature generated for reference parameter

2018-05-02 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-03 02:23:27 +, Rubn said: If "Image" is a class then all classes are based as pointers to their respective object. Hi, ok. Didn't remember that this is always the case. So passing a ref to a class is kind of redundant. Yes, that's why I was confused. You want to use a struc

Re: C++ / Wrong function signature generated for reference parameter

2018-05-03 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-03 02:23:27 +, Rubn said: You want to use a struct which isn't passed by pointer, but by value. Which will then give you the signature you want. In addition to my other post, using struct won't give the correct signature. That's the signature I need: public: unsigned int __cd

Re: C++ / Wrong function signature generated for reference parameter

2018-05-03 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-03 09:34:56 +, kinke said: That's why there's `extern(C++, class) struct Image`, see https://dlang.org/spec/cpp_interface.html#classes. Hi, thanks. I didn't understand the docs as without any code examples for all the different cases, it's hard to derive the syntax and how to

C++ / const class pointer signature / unable to find correct D syntax

2018-05-04 Thread Robert M. Münch via Digitalmars-d-learn
I have a static C++ and can't make it to get a correct binding for one function: DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & __ptr64,class b2d::Context2D::InitParams const * __ptr64 const) __ptr64 LIB: public: unsigned int __cdecl b2d::Context2D::_begin(class b

C API / const char *text / std.string.toStringz pointer is always NULL on C side

2018-05-16 Thread Robert M. Münch via Digitalmars-d-learn
I have an extern(C) function in a DLL with this signature: result* myfunc(double x, double y, const char *text, stuff *myStuff, bool flag); I call it like this: result = myfunc(0, 0, std.string.toStringz("1"), stuff, true); The problem is, that on the DLL side *text is always NULL. I doesn'

Re: C API / const char *text / std.string.toStringz pointer is always NULL on C side

2018-05-16 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-16 15:09:41 +, rikki cattermole said: On 17/05/2018 3:07 AM, Robert M. Münch wrote: I have an extern(C) function in a DLL with this signature: result* myfunc(double x, double y, const char *text, stuff *myStuff, bool flag); I call it like this: result = myfunc(0, 0, std.stri

Re: C API / const char *text / std.string.toStringz pointer is always NULL on C side

2018-05-18 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-16 17:46:59 +, Steven Schveighoffer said: Well, for C see above on the D side: extern(C) {   result myfunc(double x, double y, const char *text, stuff *myStuff, bool measureOnly); } Shouldn't the result be a pointer? Indeed. And you know what? That was causi

Re: C API / const char *text / std.string.toStringz pointer is always NULL on C side

2018-05-19 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-18 14:42:17 +, Adam D. Ruppe said: On Friday, 18 May 2018 at 14:06:11 UTC, Robert M. Münch wrote: So, having a wrong return-type here, resulted in the const char *text parameter always being NULL. Not sure I understand the relation but looks strange to me... at least not very ob

auto & class members

2018-05-20 Thread Robert M. Münch via Digitalmars-d-learn
I use the D RX lib [1] and can create a filtered stream using the auto keyword: struct a { SubjectObject!myType myStream; ??? mySubStream; } void myfunc(){ a myA = new a(); auto mySubStream = a.myStream.filter!(a => a == myMessage); ... } The problem is,

Re: auto & class members

2018-05-20 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-20 14:49:59 +, Jonathan M Davis said: In cases like this, typeof is your friend. e.g. something like typeof(myStream.filter!(a => a == myMessage)) mySubStream; Hi Jonathan, great! This got me a step further. So I can declare my member now. But I get an implict cast error when

Re: auto & class members

2018-05-20 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-20 17:40:39 +, Robert M. Münch said: Hi Jonathan, great! This got me a step further. So I can declare my member now. But I get an implict cast error when I try: class a { ... myStream; } class b { typeof(a.myStream.filter!(x => x == myMessage)) mySubStream; } v

  1   2   3   4   >