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
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,
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
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
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
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?
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
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
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]
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
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 :
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
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 |
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
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
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
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
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
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
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
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:
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
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
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:
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
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
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 +=
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
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
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;
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
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;
}
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
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
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
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 =
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
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
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
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
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
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;
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
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):
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
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
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
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
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-point = code
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
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
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
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)
{
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
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;
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;
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));
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
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
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
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).
--
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
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):
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
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
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
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 ;-)
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
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 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?
--
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
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
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
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
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
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):
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:
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 =
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
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
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?
--
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
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
On 2019-07-03 19:07:10 +, ag0aep6g said:
On 03.07.19 20:20, Robert M. Münch wrote:
So, I need to carry around the object from which a delegate was created
from because it's not possible to query the delegate for the object
later somewhere else in the code.
It is possible to get the
I have something like:
template myStruct(T){
auto makeMyStruct(T,E)(T context, void delegate(E) myFunc){
static struct myObject {
this(T context, void delegate(E) myFunc){
_context = context;
On 2019-06-30 17:47:27 +, a11e99z said:
Private means that only members of the enclosing class can access the
member, or
vvv
members and functions in the same module as the enclosing class.
I have a case, with templates, where an assert in a unittest can access
a private memember and I don't know how this can happen.
Before trying to creat an equivalent case, I want to cross-check, if
assert has special semantics in a unittest so that it can access
private memembers?
--
Robert
On 2019-06-17 20:53:28 +, aliak said:
Less typing for one. Otherwise you'd have to write:
auto observer = observerObject!int.observerObject(TestObserver());
Since code is many times more read than written I will never understand
why the syntax is polluted to save some keystrokes, making
On 2019-06-16 15:14:37 +, rikki cattermole said:
observerObject is an eponymous template.
What this means (in essence) is the symbol inside the template block ==
template block.
Hmm... ok. Is there any reason to have these "eponymous templates"? I
don't see any benefit...
--
Robert
How does the observerObject Template and function work? I'm struggling
because both use the same name and how is the template parameter R
deduced/where is it coming from? Looks like it's somehow implicitly
deduced.
class ObserverObject(R, E...){...}
template observerObject(E)
{
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be mixed. But
the standard function std.functional.toDelegate converts a function to
a delegate."
Your example compiles if the assignment is changed to dg =
toDelegate(); (given
Why does the follwing code give: Error: cannot implicitly convert
expression & myFunc of type void function(int a) to void delegate(int)
void myFunc(int a){return;}
void main()
{
void delegate(int) dg;
dg =
}
See: https://run.dlang.io/is/iTYo2L
--
Robert M. Münch
On 2019-06-12 13:58:49 +, Meta said:
There are two versions of find that can find a range within another:
https://dlang.org/phobos/std_algorithm_searching.html#.find
https://dlang.org/phobos/std_algorithm_searching.html#.find.3
Thanks, that looks good. I read the find docs, but somehow
On 2019-06-11 17:34:00 +, Paul Backus said:
It's a space/time tradeoff. foreach with canFind is O(n^2) time and O(1) space.
Yes, that's why I asekd. They haystack is most likely >10 times larger
than the needles. Speed has priority.
If you use an associative array or a set, it's O(n)
Is there a simple and elegant way to do this? Or is just using a
foreach(...) with canFind() the best way?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2019-06-01 04:43:13 +, Alex said:
That's ok, but could you provide an example anyway? Is it like this?
´´´
void main(){
auto target = new myClass!int();
target.objects.length = 4;
auto val = 42;
put(target, val, testfunction); // does the test function enters here?
On 2019-05-30 18:29:44 +, Steven Schveighoffer said:
You can dub add-local your local fork, and it will use that instead of
going out to code.dlang.org.
Ok, any chance to switch back and forth between local/remote versions?
--
Robert M. Münch
http://www.saphirion.com
smarter | better |
On 2019-05-31 11:07:00 +, Alex said:
Not sure, if I understood your problem correctly.
I can imagine... I try my best :-)
It is meant that the class myClass defines an array of myOtherClass objects?
Yes. So there is one class having an array of other stuff.
The code does not compile
I have myClass and I want to add a way where I can provide a delegate
to iterate over myClass.objects when a member function put(...) of
myClass is called. The idea is that a user of myClass can provide
something like an "iterator filter" so that the function is only called
on a subset of
Is there a best practice how I can use a fork if mine of a project that
can be access via "dependencies": {...} so that my own code is used?
I think that would make it pretty easy to switch between different versions.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
1 - 100 of 310 matches
Mail list logo