On Monday, 15 January 2024 at 23:06:00 UTC, Steven Schveighoffer
wrote:
As a workaround, you can alias the outer function in the struct:
```d
struct S
{
alias foo = S_foo;
}
```
This might be less than ideal, but at least it works.
It does! And it's good enough for me. Thanks a lot!
-- B
I'm increasingly using nested delegates to partition code.
```d
void foo(Thing thing)
{
void sendThing(const string where, int i)
{
send(thing, where, i);
}
sendThing("bar", 42);
}
```
...where the nested `sendThing` sometimes returns something,
sometimes doesn't. `Thin
I found myself a bit perplexed when it comes to the usage of
"nested imports" and selective imports. It seems that prominent D
programmers have varied opinions on the matter. I would love to
hear your insights and experiences on this topic.
Here's a quick summary of what I've come across from
Yes, I try to place my imports at the most general location that makes
sense.
Sometimes that is at the module level, other times its in a single function.
Or anywhere in between (such as a struct).
On Tuesday, 16 January 2024 at 13:19:59 UTC, Orfeo wrote:
I found myself a bit perplexed when it comes to the usage of
"nested imports" and selective imports. It seems that prominent
D programmers have varied opinions on the matter. I would love
to hear your insights and experiences on this top
On Tuesday, 16 January 2024 at 13:37:59 UTC, user1234 wrote:
Implementation detail. D frontend resolves identifiers using
associative arrays (that's called symtabs in the compiler
IIRC), hence the only complexity is the scope (plus the import
decls found while going back to the module scope).
On Tuesday, 16 January 2024 at 10:56:58 UTC, Anonymouse wrote:
I'm increasingly using nested delegates to partition code.
```d
void foo(Thing thing)
{
void sendThing(const string where, int i)
{
send(thing, where, i);
}
sendThing("bar", 42);
}
```
...
3. Those reference
On Tuesday, 16 January 2024 at 13:19:59 UTC, Orfeo wrote:
I found myself a bit perplexed when it comes to the usage of
"nested imports" and selective imports. It seems that prominent
D programmers have varied opinions on the matter. I would love
to hear your insights and experiences on this top
On Tuesday, 16 January 2024 at 13:45:22 UTC, FeepingCreature
wrote:
Am I safe as long as I don't do something like, pass
`&sendThing` as an argument to `std.concurrency.receive`?
Yes.
Thank you.
And to make sure I don't misunderstand the spec; in the case I
*do* have a delegate I want to pa
On Mon, Jan 15, 2024 at 08:10:55PM +, Renato via Digitalmars-d-learn wrote:
> On Monday, 15 January 2024 at 01:10:14 UTC, Sergey wrote:
> > On Sunday, 14 January 2024 at 17:11:27 UTC, Renato wrote:
> > > If anyone can find any flaw in my methodology or optmise my code so
> > > that it can still
On Tue, Jan 16, 2024 at 07:50:35AM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> Unfortunately there seems to be some discrepancy between the output I
> got and the prescribed output in your repository. For example, in your
> output the number 1556/0 does not have an encoding, but isn't
P.S. Compiling my program with `ldc -O2`, it runs so fast that I
couldn't measure any meaningful running time that's greater than startup
overhead. So I wrote a helper program to generate random phone numbers
up to 50 characters long, and found that it could encode 1 million phone
numbers in 2.2 s
On Tuesday, 16 January 2024 at 15:50:35 UTC, H. S. Teoh wrote:
Unfortunately there seems to be some discrepancy between the
output I got and the prescribed output in your repository. For
example, in your output the number 1556/0 does not have an
encoding, but isn't "1 Mai 0" a valid encoding ac
On Tuesday, 16 January 2024 at 15:39:07 UTC, Anonymouse wrote:
If I make a `scope` variable of the delegate and pass *it* to
`receiveTimeout`, there no longer seems to be any mention of
the closure in the error (given 2.092 or later).
```d
void foo(Thing thing) @nogc
{
void sendThing(const
On Tuesday, 16 January 2024 at 16:56:04 UTC, Siarhei Siamashka
wrote:
On Tuesday, 16 January 2024 at 15:50:35 UTC, H. S. Teoh wrote:
Unfortunately there seems to be some discrepancy between the
output I got and the prescribed output in your repository. For
example, in your output the number 155
On Tuesday, January 16, 2024 6:19:59 AM MST Orfeo via Digitalmars-d-learn
wrote:
> I found myself a bit perplexed when it comes to the usage of
> "nested imports" and selective imports. It seems that prominent D
> programmers have varied opinions on the matter. I would love to
> hear your insights
On Tue, Jan 16, 2024 at 06:54:56PM +, Renato via Digitalmars-d-learn wrote:
> On Tuesday, 16 January 2024 at 16:56:04 UTC, Siarhei Siamashka wrote:
[...]
> > You are not allowed to emit "1" as the first token in the output as
> > long as there are any dictionary word matches at that position. T
On Tue, Jan 16, 2024 at 12:28:49PM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> Anyway, I've fixed the problem, now my program produces the exact same
> output as Renato's repo. Code is posted below.
[...]
Oops, forgot to actually paste the code. Here it is:
-
On Monday, 15 January 2024 at 22:19:56 UTC, Steven Schveighoffer
wrote:
You may have to do the same thing I did with redis:
https://github.com/vibe-d/vibe.d/pull/2372
Good luck! I would also say, I don't know why Windows doesn't
do the same trace info debug thing, except that probably
whomeve
Wow, that was... exhaustive. Thanks for that. :)
One more question that I have, though...
On Tuesday, 16 January 2024 at 19:05:43 UTC, Jonathan M Davis
wrote:
The downside of course is that you then have import statements
throughout your code, and they're often going to be duplicated
throughou
On Tuesday, 16 January 2024 at 20:34:48 UTC, H. S. Teoh wrote:
On Tue, Jan 16, 2024 at 12:28:49PM -0800, H. S. Teoh via
Digitalmars-d-learn wrote: [...]
Anyway, I've fixed the problem, now my program produces the
exact same output as Renato's repo. Code is posted below.
[...]
Great, I ran th
On Tuesday, 16 January 2024 at 21:15:19 UTC, Renato wrote:
I can't explain why it's so incredibly fast, specially for the
`count` case. I tried using the same hashing function on my
solution, but that didn't really help me!
That's dynamic programming with memoization. Basically caching
the al
On Tue, Jan 16, 2024 at 09:15:19PM +, Renato via Digitalmars-d-learn wrote:
> On Tuesday, 16 January 2024 at 20:34:48 UTC, H. S. Teoh wrote:
> > On Tue, Jan 16, 2024 at 12:28:49PM -0800, H. S. Teoh via
> > Digitalmars-d-learn wrote: [...]
> > > Anyway, I've fixed the problem, now my program pro
On Tuesday, 16 January 2024 at 21:15:19 UTC, Renato wrote:
For the record (I already posted this on GitHub)... here's [my
current fastest
solution](https://github.com/renatoathaydes/prechelt-phone-number-encoding/blob/dlang-key-hash-incremental/src/d/src/dencoder.d) time using the same algorithm
On Tue, Jan 16, 2024 at 10:15:04PM +, Siarhei Siamashka via
Digitalmars-d-learn wrote:
> On Tuesday, 16 January 2024 at 21:15:19 UTC, Renato wrote:
[...]
> > ... what I am really curious about is what the code I wrote is doing
> > wrong that causes it to run 4x slower than Rust despite doing "
On Tuesday, January 16, 2024 1:42:04 PM MST bomat via Digitalmars-d-learn
wrote:
> Wow, that was... exhaustive. Thanks for that. :)
> One more question that I have, though...
>
> On Tuesday, 16 January 2024 at 19:05:43 UTC, Jonathan M Davis
>
> wrote:
> > The downside of course is that you then ha
On Tuesday, 16 January 2024 at 02:25:32 UTC, matheus wrote:
...
I'll reply to myself but I just would like to say thanks to
Jonathan M Davis and Mike Shah.
I started with TDPL but I'll fill my knowledge with the other
suggestions you gave me.
Thanks again,
Matheus.
On Tuesday, 16 January 2024 at 22:15:04 UTC, Siarhei Siamashka
wrote:
On Tuesday, 16 January 2024 at 21:15:19 UTC, Renato wrote:
For the record (I already posted this on GitHub)... here's [my
current fastest
solution](https://github.com/renatoathaydes/prechelt-phone-number-encoding/blob/dlang-k
On Tuesday, 16 January 2024 at 22:13:55 UTC, H. S. Teoh wrote:
used for the recursive calls. Getting rid of the .format ought
to speed it up a bit. Will try that now...
That will make no difference for the `count` option which is
where your solution was very slow. To run the slow test manual
29 matches
Mail list logo