On 8/27/21 11:43 AM, Ki Rill wrote:
On Friday, 27 August 2021 at 15:24:14 UTC, Steven Schveighoffer wrote:
I suspect your MSVC installation is bad, or there are some other
switches causing problems.
Hmm... well, I will use the default setup and think about it later.
I mostly use Linux
On 8/27/21 11:19 AM, Ki Rill wrote:
On Friday, 27 August 2021 at 14:52:15 UTC, Mike Parker wrote:
On Friday, 27 August 2021 at 14:46:56 UTC, Ki Rill wrote:
On Friday, 27 August 2021 at 13:54:18 UTC, Steven Schveighoffer wrote:
[...]
How do I tell DUB where to look for `raylibdll.lib
On 8/27/21 10:35 AM, Ki Rill wrote:
On Friday, 27 August 2021 at 13:54:18 UTC, Steven Schveighoffer wrote:
In the end, I got it to build and run, but I'd highly recommend just
linking against the `raylibdll.lib` and using the dll.
Steve, thank you! I got it working with `raylibdll.lib
On 8/27/21 9:21 AM, Ki Rill wrote:
I have a Raylib project on Windows using DUB. I've added raylib-d via
`dub add`. But what I can't figure out is how to tell DUB to link
against raylib library.
I have the following project structure:
```
-> source
---> app.d
-> libraylib.a
-> raylib.dll
->
On 8/27/21 6:34 AM, Kirill wrote:
On Friday, 27 August 2021 at 09:51:46 UTC, Mathias LANG wrote:
On Friday, 27 August 2021 at 06:52:10 UTC, Kirill wrote:
Is there a way to do mixin or similar during runtime?
I'm trying to read a csv file and extract data types. Any ideas on
how this should
On 8/27/21 12:41 AM, Merlin Diavova wrote:
On Friday, 27 August 2021 at 04:01:19 UTC, Ali Çehreli wrote:
On 8/26/21 7:17 PM, Merlin Diavova wrote:
[...]
Then the operations downstream will not produce any results. For
example, the array will be empty below:
import std.stdio;
import
On 8/14/21 5:54 PM, Steven Schveighoffer wrote:
# BEERCONF!
Hi everyone, beerconf is happening once again! This time on August
28-29. So bring your favorite brews and favorite D topics and join us
for 48 hours of non-stop frivolity!
Also, don't forget that the [Dconf Online 2021](https
On 8/25/21 12:46 PM, Joseph Rushton Wakeling wrote:
On Wednesday, 25 August 2021 at 10:59:44 UTC, Steven Schveighoffer wrote:
structs still provide a mechanism (postblit/copy ctor) to properly
save a forward range when copying, even if the guts need copying
(unlike classes). In general, I
On 8/25/21 10:58 AM, WebFreak001 wrote:
Hm I'm not quite seeing how the error handler is related to an "Expected
type interface" that the compiler could expect.
This would be without compiler changes.
Currently with exceptions the scope things are implemented using
try-catch-finally, this
On 8/25/21 10:42 AM, Steven Schveighoffer wrote:
I think it's possible to work with some mechanics that aren't
necessarily desirable. Something like:
One has to weigh how much this is preferred to actual exception handling...
If something like DIP1008 could become usable, it might
On 8/25/21 10:22 AM, Paul Backus wrote:
On Wednesday, 25 August 2021 at 14:04:54 UTC, WebFreak001 wrote:
Would it be possible to extend `scope(exit)` and `scope(success)` to
trigger properly for functions returning `Expected!T` as defined in
the
On 8/25/21 7:26 AM, Alexandru Ermicioi wrote:
On Wednesday, 25 August 2021 at 11:04:35 UTC, Steven Schveighoffer wrote:
It never has called `save`. It makes a copy, which is almost always
the equivalent `save` implementation.
Really?
Then what is the use for .save method then?
The only
On 8/25/21 6:06 AM, Alexandru Ermicioi wrote:
On Wednesday, 25 August 2021 at 08:15:18 UTC, frame wrote:
I know, but foreach() doesn't call save().
Hmm, this is a regression probably, or I missed the time frame when
foreach moved to use of copy constructor for forward ranges.
Do we have a
On 8/25/21 4:31 AM, frame wrote:
On Tuesday, 24 August 2021 at 21:15:02 UTC, Steven Schveighoffer wrote:
I'm surprised you bring PHP as an example, as it appears their foreach
interface works EXACTLY as D does:
Yeah, but the point is, there is a rewind() method. That is called every
time
On 8/25/21 6:06 AM, Joseph Rushton Wakeling wrote:
On Tuesday, 24 August 2021 at 09:15:23 UTC, bauss wrote:
A range should be a struct always and thus its state is copied when
the foreach loop is created.
That's quite a strong assumption, because its state might be a reference
type, or it
On 8/24/21 2:12 PM, frame wrote:
You can call `popFront` if you need to after the loop, or just before
the break. I have to say, the term "useless" does not even come close
to describing ranges using foreach in my experience.
I disagree, because foreach() is a language construct and therefore
On 8/24/21 4:36 AM, frame wrote:
Consider a simple input range that can be iterated with empty(), front()
and popFront(). That is comfortable to use with foreach() but what if
the foreach loop will be cancelled? If a range isn't depleted yet and
continued it will supply the same data twice on
I just released an updated version of
[raylib-d](https://code.dlang.org/packages/raylib-d) binding. This was
completely regenerated using dstep from the raylib 3.7.0 sources, along
with the hand-edits to keep it working, BIG thanks to contributor Soaku!
PLEASE NOTE: raylib 3.7.0 is binary
On 8/17/21 2:36 PM, JG wrote:
Thanks for the suggestions and explanations. I am not sure what to do in
my case though. The situation is as follows. I have a struct that is
populated via user input not necessarily at single instance (so that
seems to rule out immutable). On the other
hand while
On 8/17/21 2:11 PM, james.p.leblanc wrote:
Evening All,
Eponymous templates allow a nice calling syntax. For example, "foo"
here can
be called without needing the exclamation mark (!) at calling sites. We
see that
foo is restricting a, and b to be of the same type ... so far, so good.
On 8/17/21 2:07 PM, Rekel wrote:
On Tuesday, 17 August 2021 at 16:24:38 UTC, Steven Schveighoffer wrote:
All these are calling with array literals, which default to dynamic
arrays, not static arrays.
I realise that is their default, though in this scenario they should (I
believe) be used
On 8/17/21 10:20 AM, Rekel wrote:
As my post was not the actual cause of my issue (my apology for the
mistake), I think I have found the actual reason I'm currently having
problems.
This seems to be related to a (seeming, I might be wrong) inability to
specialize over both 1d and 2d arrays
On 8/17/21 8:21 AM, Ferhat Kurtulmuş wrote:
Hello folks,
Hope everyone is doing fine. Considering the following code, in the
first condition, I am extracting the type Point from the slice Point[].
I searched in the std.traits, and could not find a neater solution
something like
On 8/17/21 7:05 AM, JG wrote:
Hi
I have a program with two threads. One thread produces data that is put
in a queue
and then consumed by the other thread. I initially built a custom queue
to do this, but thought this should have some standard solution in D? I
looked at std.concurrency and
On 8/15/21 2:10 AM, rempas wrote:
So when I'm doing something like the following: `string name = "John";`
Then what's the actual type of the literal `"John"`?
In the chapter [Calling C
functions](https://dlang.org/spec/interfaceToC.html#calling_c_functions)
in the "Interfacing with C" page,
# BEERCONF!
Hi everyone, beerconf is happening once again! This time on August
28-29. So bring your favorite brews and favorite D topics and join us
for 48 hours of non-stop frivolity!
Also, don't forget that the [Dconf Online 2021](https://dconf.org)
submission deadline is approaching, if
On 8/13/21 7:23 PM, Marcone wrote:
On Friday, 13 August 2021 at 23:08:07 UTC, jfondren wrote:
On Friday, 13 August 2021 at 22:09:59 UTC, Marcone wrote:
Isn't there some unario operator template that I can use with lambda
to handle a string literal?
So, something other than an exact
On 8/13/21 5:05 PM, Marcone wrote:
How to extend the string class to return this inside the square bracket
the same way opDollar $ returns the length of the string? Thank you.
import std;
void main(){
writeln("Hello World!"[0..this.indexOf("o")]);
}
There is no
On 8/13/21 4:58 PM, Paul Backus wrote:
On Friday, 13 August 2021 at 15:26:15 UTC, Steven Schveighoffer wrote:
The issue is that you can't convert const (or immutable or mutable) to
inout implicitly, and the member variable is inout inside an inout
constructor. Therefore, there's no viable copy
On 8/13/21 3:59 PM, Mike Parker wrote:
On Friday, 13 August 2021 at 16:18:06 UTC, Ruby The Roobster wrote:
Context for this: I am creating a module of my own, and this is a
class contained in the module. You will notice that after calling
this class' constructor anywhere in a Win32 API
On 8/12/21 12:12 PM, Paul Backus wrote:
The reason for this is a bit subtle. Normally, `inout` can convert to
`const`, so you might expect that the `const` copy constructor could be
used to construct a copy of an `inout` object. However, copy
constructors take their arguments by `ref`, and
On 8/13/21 11:04 AM, james.p.leblanc wrote:
Dear All,
How does one use 'alias' to incorporate function arguments as well?
(I believe this is possible, from some of the examples of aliasSeq, and
the traits.Parameters documentation. However, I was unable to come up
with anything that works.)
On 8/12/21 10:08 AM, Learner wrote:
On Thursday, 12 August 2021 at 13:56:17 UTC, Paul Backus wrote:
On Thursday, 12 August 2021 at 12:10:49 UTC, Learner wrote:
That worked fine, but the codebase is @safe:
```d
cast from `int[]` to `inout(int[])` not allowed in safe code
```
So copy
On Wednesday, 11 August 2021 at 14:08:59 UTC, Paul Backus wrote:
On Wednesday, 11 August 2021 at 14:03:50 UTC, Paul Backus wrote:
On Wednesday, 11 August 2021 at 14:00:33 UTC, Steven
Schveighoffer wrote:
I have a template function like this:
```d
auto foo(T, Args...)(Args args
I have a template function like this:
```d
auto foo(T, Args...)(Args args) {...}
```
If I try to bind the T only, and produce a partial template
function which can accept any number of parameters, but has T
already specified, I get an error, because instantiating `foo!T`
means Args is length
On 8/11/21 5:31 AM, tastyminerals wrote:
I would like to trigger tests in a simple dub project.
```
source/my_script.d
dub.json
```
Here is a dub config:
```json
{
"targetPath": "build",
"targetType": "executable",
"sourcePaths": ["source"],
"name": "my_script",
On 8/9/21 12:32 PM, Marcone wrote:
My main program need import a local module called mymodule.d.
How can I add this module using DUB? Thank you.
You mean how to add a local project (that isn't on code.dlang.org)?
`dub add-local .` inside the project directory.
I don't think you can add a
On 8/5/21 11:09 AM, someone wrote:
On Thursday, 5 August 2021 at 10:28:00 UTC, Steven Schveighoffer wrote:
H.S. Teoh, I know you know better than this ;) None of this is
necessary, you just need `rtValue` for both runtime and CTFE (and
compile time parameters)!
Now, the original question
On 8/4/21 11:20 PM, H. S. Teoh wrote:
On Thu, Aug 05, 2021 at 01:39:42AM +, someone via Digitalmars-d-learn wrote:
[...]
What happens in the following case ?
public immutable enum gudtLocations = [
r"BUE"d : structureLocation(r"arg"d, r"Buenos Aires"d, r"ART"d),
r"GRU"d :
On 8/4/21 10:27 PM, Ali Çehreli wrote:
I wonder whether this feature is thanks to 'lazy' parameters, which are
actually delegates.
No, the default parameters are used directly as if they were typed in at
the call site (more or less, obviously the `__FILE__` example is weird).
So:
```d
On 8/4/21 10:27 PM, someone wrote:
On Thursday, 5 August 2021 at 02:06:13 UTC, Steven Schveighoffer wrote:
On 8/4/21 9:14 PM, H. S. Teoh wrote:
Unless you have a specific reason to, avoid using `enum` with string and
array literals, because they will trigger a memory allocation *at every
On 7/26/21 1:05 PM, Stefan Koch wrote:
On Monday, 26 July 2021 at 12:01:23 UTC, Adam D Ruppe wrote:
On Monday, 26 July 2021 at 11:43:56 UTC, workman wrote:
__FILE__[0..$]
Why do you have that [0..$] there? It is probably breaking the
__FILE__ magic.
Correct.
The compiler has to evaluate
On 8/4/21 9:14 PM, H. S. Teoh wrote:
Unless you have a specific reason to, avoid using `enum` with string and
array literals, because they will trigger a memory allocation *at every
single reference to them*, which is probably not what you want.
Just want to chime in and say this is NOT true
On 8/4/21 11:08 AM, someone wrote:
However, __traits(hasMember, ...) checks for the existence of anything
labeled lstrCurrencyID within the class (eg: unrelated variables with
same name; not gonna happen, but, I like to code it the right way); so,
question is: is there any way to search the
On 8/4/21 4:18 AM, evilrat wrote:
On Wednesday, 4 August 2021 at 07:21:56 UTC, Denis Feklushkin wrote:
On Sunday, 1 August 2021 at 17:37:01 UTC, evilrat wrote:
vibe-d - probably because it handles DB connection and/or keep things
async way, sure you probably can do it with Phobos but it will
On 8/1/21 11:38 AM, Alain De Vos wrote:
Dub has two big problems.
1. Unmaintained dub stuff.
2. Let's say you need bindings to postgresql library and you will see
dub pulling in numerous of libraries, which have nothing at all to do
with postgresql.
More like a framework stuff. This creates
On 7/23/21 3:30 PM, apz28 wrote:
On Friday, 23 July 2021 at 18:44:47 UTC, Steven Schveighoffer wrote:
On 7/22/21 7:43 PM, apz28 wrote:
In any case, it's possible that fbConnection being null does not mean
a null dereference, but I'd have to see the class itself. I'm
surprised if you don't
On 7/22/21 7:43 PM, apz28 wrote:
FbConnection is a class, FbXdrReader is a struct and for this call,
response.data is not null & its' length will be greater than zero and
FbConnection is not being used. So why DMD try to evaluate at compiled
time hence error
1. Should not evaluate at compile
On 7/22/21 2:38 PM, apz28 wrote:
On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote:
On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer wrote:
2. It's hard for me to see where the null dereference would be in
that function (the `bool` implementation is pretty simple).
DMD
On 7/11/21 10:01 AM, Steven Schveighoffer wrote:
# BEERCONF!
In 2 weeks we will have the 14th
[mensual](https://www.merriam-webster.com/dictionary/mensual) online
Beerconf on July 24-25!
Just a reminder, this is happening in ~~2 days~~ 1 day! Iain is going to
start it early for our friends
On 7/22/21 1:46 AM, seany wrote:
Consider :
int [] ii;
foreach(i,dummy; parallel(somearray)) {
ii ~= somefunc(dummy);
}
This is not safe, because all threads are accessing the same array and
trying to add values and leading to collision.
Correct. You must synchronize
On 7/21/21 7:56 AM, apz28 wrote:
On Wednesday, 21 July 2021 at 11:52:39 UTC, apz28 wrote:
On Wednesday, 21 July 2021 at 04:52:44 UTC, Mathias LANG wrote:
It seems the compiler is doing extra analysis and seeing that a null
pointer is being dereferenced. Can you provide the code for
On 7/21/21 5:07 AM, vit wrote:
Thanks, it works, but now I have different problem.
I need call static method for all instantions of template struct from
`crt_constructor`.
Is there way to iterate over all instantions of template?
Not unless you register them somehow upon instantiation.
Or
On 7/20/21 11:00 PM, Mathias LANG wrote:
But if you take a step back, I think you might find this solution is far
from ideal.
Having worked on a JSON library myself, I can tell you they are all
implemented with a tagged union. And converting a tagged union to a
tagged union is no improvement.
On 7/19/21 10:58 PM, H. S. Teoh wrote:
I didn't check the implementation to verify this, but I'm pretty sure
`break`, `continue`, etc., in the parallel foreach body does not change
which iteration gets run or not.
`break` should be undefined behavior (it is impossible to know which
loops
On 7/16/21 4:11 PM, Dylan Graham wrote:
On Friday, 16 July 2021 at 19:37:53 UTC, Steven Schveighoffer wrote:
I would possibly suggest that instead of a record template that
accepts directives using inline lambdas, etc, just accept a model type
and use udas to adjust the record type
On 7/16/21 10:52 AM, Dylan Graham wrote:
On Friday, 16 July 2021 at 13:54:36 UTC, vit wrote:
What adventage has record over normal immutable/const class?
In terms of mutability, none.
The duplicate method, however, lets you copy and mutate (once at
duplication) a record without impacting
On 7/15/21 1:43 PM, Tejas wrote:
How do you write the equivalent of that in D? Is the answer still the
same? Manually keep it in the same module, or is there a programmatic
way of converting this to D?
Functions in the same module can access `private` members. Functions in
the same package
On 7/14/21 9:00 AM, Alain De Vos wrote:
When I read a record out of the database I receive a jsonb datatatype as
a string.
How do I convert this string into a json object and parse and manipulate
it?
Isn't jsonb just a storage assumption for the database (so it can do
efficient
# BEERCONF!
In 2 weeks we will have the 14th
[mensual](https://www.merriam-webster.com/dictionary/mensual) online
Beerconf on July 24-25!
As usual, we will be discussing any and all D topics, and anything else
that suits your fancy, while drinking our favorite beverages! Sadly, I
will not
On 7/9/21 5:13 PM, rempas wrote:
On Friday, 9 July 2021 at 20:54:21 UTC, Paul Backus wrote:
On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote:
I'm reading the library reference for
[core.time](https://dlang.org/phobos/core_time.html#Duration) and It
says that the duration is taken in
On 7/11/21 8:49 AM, Adam D Ruppe wrote:
On Sunday, 11 July 2021 at 05:20:49 UTC, someone wrote:
```d
mixin template templateUGC (
typeStringUTF,
alias lstrStructureID
) {
public struct lstrStructureID {
typeStringUTF whatever;
}
This creates a struct with teh literal
On 7/10/21 12:32 PM, Mathias LANG wrote:
On Saturday, 10 July 2021 at 01:38:06 UTC, russhy wrote:
On Saturday, 10 July 2021 at 01:23:26 UTC, Steven Schveighoffer wrote:
I think it's the throwing/catching of the `Throwable` that is
allocating. But I don't know from where the allocation
On 7/9/21 8:44 PM, russhy wrote:
On Friday, 9 July 2021 at 23:34:25 UTC, Ali Çehreli wrote:
On 7/9/21 4:12 PM, russhy wrote:
>> One way of forcing compile-time evaluation in D is to define
an enum
>> (which means "manifest constant" in that use).
That's all I meant. It was a general comment.
On 7/9/21 5:04 PM, Ali Çehreli wrote:
On 7/9/21 1:54 PM, Paul Backus wrote:
On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote:
I'm reading the library reference for
[core.time](https://dlang.org/phobos/core_time.html#Duration) and It
says that the duration is taken in "hnsecs" and I cannot
On 7/9/21 11:31 AM, Dennis wrote:
On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer wrote:
But reading/writing, closing these file descriptors is always the same.
For sockets you'd typically use `recv` and `send` instead or `read` and
`write` because the former give extra options
On 7/9/21 10:51 AM, rempas wrote:
The file can be found quickly
[here](https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d)
or in your system if you want. Now the question is, why isn't there an
"open" function for the equivalent system call? "close", "write", "read"
On 7/7/21 3:52 PM, Sebastiaan Koppe wrote:
On Wednesday, 7 July 2021 at 13:30:28 UTC, Steven Schveighoffer wrote:
On 7/7/21 5:54 AM, rassoc wrote:
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer wrote:
So I have this situation where I need to split a string, then where
On 7/7/21 5:54 AM, rassoc wrote:
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer wrote:
So I have this situation where I need to split a string, then where
the splits are, insert a string to go between the elements making a
new range, all without allocating (hopefully
On 7/6/21 11:42 PM, Jon Degenhardt wrote:
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer wrote:
This is pretty minimal, but does what I want it to do. Is it ready for
inclusion in Phobos? Not by a longshot! A truly generic interleave
would properly forward everything else
So I have this situation where I need to split a string, then where the
splits are, insert a string to go between the elements making a new
range, all without allocating (hopefully).
Looking around phobos I found inside the documentation of
On 7/6/21 9:27 AM, Jack Applegame wrote:
On Tuesday, 6 July 2021 at 12:33:20 UTC, Adam D Ruppe wrote:
The language always allows `a = b;` to be rewritten as `a(b);`.
And that's sad. It should happen for properties only.
Yes, I lament that there is no way to control how people call your
On 7/3/21 4:08 PM, frame wrote:
On Saturday, 3 July 2021 at 17:39:18 UTC, Steven Schveighoffer wrote:
But in practice, the compiler does not have to clean up anything when
an `Error` is thrown. Whether it does or not is defined by the
implementation.
This should be really mentionend
On 7/3/21 1:20 PM, Luis wrote:
This is intentional ?
```
should(function void() {
auto emptyStack = SimpleStack!int();
scope(exit) emptyStack.free; // <= This is never called
emptyStack.reserve(16);
emptyStack.top;
On 7/1/21 8:26 PM, someone wrote:
... just wondering:
I am writing pretty trivial code, nothing out of the ordinary, and
attempted to check how much of it could be marked safe ...
It should be quite a bit.
- Lots of tiny common library functions are pretty easy
- Getter/Setter properties
On 7/2/21 12:21 AM, Kirill wrote:
I have a `Tuple!(string, ..., string)[] data` that I would like to print
out:
`a b c`
`1 2 3`
`4 5 6`
Furthermore, I want to be able to print any N rows and M columns of
that table. For instance:
`b c`
`2 3`
or
On 7/1/21 10:56 AM, Keivan Shah wrote:
Using the handler I was able to get the stack trace and it seems that
the segFault is caused by `joiner` trying to call `.save` on a null
object leading to a `NullPointerError`. But I have not been able to
debug it further. Mostly it seems that there is
On 6/29/21 4:25 PM, vnr wrote:
Nevertheless, the problem persists and seems to be even deeper, indeed,
my site is hosted on Heroku and I can see what a user who is on another
machine has written (behavior I just found out). Fortunately, this
little site is only for entertainment purposes, but
On 6/28/21 11:53 AM, Paul Backus wrote:
On Monday, 28 June 2021 at 15:17:34 UTC, Steven Schveighoffer wrote:
I have a situation where I want to wrap a certain type to add a few
methods to that type.
UFCS is not an option, because the library that will use this type
will not import the UFCS
I have a situation where I want to wrap a certain type to add a few
methods to that type.
UFCS is not an option, because the library that will use this type will
not import the UFCS methods.
`std.typecons.Proxy` doesn't seem to wrap static methods, and besides, I
want to return wrappers if
Just a reminder that Beerconf June (the 1 year anniversary!) is 2 days away.
At this moment, I have had one person contact me with a possible
presentation, but nothing firm, so it probably will just happen if it
does, at whatever time the presenter decides to do it.
If anyone else has
On 6/23/21 7:07 PM, someone wrote:
On Wednesday, 23 June 2021 at 22:46:28 UTC, Steven Schveighoffer wrote:
Use the `release` method:
```d
return lnumRange.sort!(...).release;
```
Fantastic, issue solved, I previously used sort ascending even
descending but first time on floats.
So I
On 6/23/21 6:36 PM, JN wrote:
I'm looking for a way to test a struct for these conditions:
1. has members named x, y and z
2. these members are floating point type
This works, but feels kinda verbose, is there some shorter way? Can I
somehow avoid the hasMember/getMember calls?
```d
import
On 6/23/21 6:30 PM, Jordan Wilson wrote:
On Wednesday, 23 June 2021 at 19:53:24 UTC, someone wrote:
Please, look for the line marked +++
This is a structure with a public property returning a (still
unsorted) range built on-the-fly from already-set properties, a basic
range from a to z with
On 6/21/21 5:00 PM, Elronnd wrote:
On Monday, 21 June 2021 at 03:59:10 UTC, someone wrote:
Is there a way to filter the collection at the foreach-level to avoid
the inner if ?
Here's how I would do it:
foreach (k, v; coll) {
if (k == unwanted) continue;
...
}
You still have an if,
On 6/21/21 4:55 AM, frame wrote:
On Monday, 21 June 2021 at 03:32:58 UTC, someone wrote:
Since memory serves I use to name files with - instead of the more
common _
The module name has to be strict and "-" is not allowed.
However, you should be able to import files with a "-" in the name.
On 6/21/21 12:12 AM, someone wrote:
I mean, coding as following:
```d
int intWhatever = 0; /// default being zero anyway
foreach (classComputer objComputer, objComputers) { ... } /// explicitly
declaring the type instead of letting the compiler to figure it out
struc Whatever {
public
On 6/18/21 9:46 AM, Steven Schveighoffer wrote:
On 6/18/21 5:05 AM, Mike Brown wrote:
Hi all,
I would like to convert a D string to an int - im doing this in a
compile time function as well. conv throws an error due to it using
TypeInfo?
How would I do this?
std.conv.to really should
On 6/18/21 5:05 AM, Mike Brown wrote:
Hi all,
I would like to convert a D string to an int - im doing this in a
compile time function as well. conv throws an error due to it using
TypeInfo?
How would I do this?
std.conv.to really should support it, that seems like a bug.
But just FYI,
On 6/18/21 12:40 AM, Mathias LANG wrote:
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer wrote:
A final switch on an enum complains if you don't handle all the enum's
cases. I like this feature.
However, sometimes the data I'm switching on is coming from elsewhere
(i.e
On 6/18/21 6:35 AM, Johan wrote:
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer wrote:
However, sometimes the data I'm switching on is coming from elsewhere
(i.e. a user), and while I want to enforce that the data is valid
(it's one of the enum values), I don't want to crash
On 6/17/21 5:54 PM, H. S. Teoh wrote:
On Thu, Jun 17, 2021 at 05:41:28PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
[.[..]
Oh, and to throw a monkey wrench in here, the value is a string, not
an integer. So I can't use std.conv.to to verify the enum is valid
(plus, then I'm
A final switch on an enum complains if you don't handle all the enum's
cases. I like this feature.
However, sometimes the data I'm switching on is coming from elsewhere
(i.e. a user), and while I want to enforce that the data is valid (it's
one of the enum values), I don't want to crash the
On 6/17/21 5:01 PM, Ali Çehreli wrote:
What's the difference? In both cases an int is being converted to a Foo.
I think the "working" case is against the design of D.
Likely there is a subtlety that I am missing...
The difference might be that construction has only one set of overloads
On 6/17/21 4:22 PM, kdevel wrote:
On Thursday, 17 June 2021 at 19:14:28 UTC, Steven Schveighoffer wrote:
On 6/17/21 12:26 PM, JG wrote:
However, what I *have* wanted is to have attribute values support
`Nullable!T` such that they are only included if the item is non-null.
See [here](https
On 6/17/21 4:15 PM, H. S. Teoh wrote:
On Thu, Jun 17, 2021 at 07:44:31PM +, JN via Digitalmars-d-learn wrote:
[...]
Foo[int] foos = [
0: Foo("abc"),
1: Foo(5)
];
}
```
Why does D need the explicit declarations whereas C++ can infer it?
Because D does not
On 6/17/21 12:26 PM, JG wrote:
Thanks, this works. I would have thought this would be a common enough
use case to have support in diet. Anyone else wanted this?
I haven't found a need for it, as I'm usually only dynamically
configuring attribute values, not attribute names. But my web-fu is
On 6/16/21 5:11 PM, Ali Çehreli wrote:
On 6/16/21 2:03 PM, Ali Çehreli wrote:
This was mentioned in an earlier post but I don't remember seeing a
separate announcement.
https://www.youtube.com/playlist?list=PLgM-lc_kSqFQPF0UXgmFZpZalqcrSofe-
Ali
In case your client does not include
On 6/15/21 12:24 AM, surlymoor wrote:
All my custom range types perform all their meaningful work in their
respective popFront methods, in addition to its expected source data
iteration duties. The reason I do this is because I swear I read in a
github discussion that front is expected to be
On 6/14/21 11:09 AM, Jalil David Salamé Messina wrote:
I'm searching for a way to do something like this in D:
```cpp
struct MyStruct {
const size_t length;
int *const data;
MyStruct(size_t n) : length(n) {
data = new int[length];
}
}
```
This way it is mutable, but non
801 - 900 of 11673 matches
Mail list logo