On Friday, May 3, 2024 2:38:31 PM MDT Jonathan M Davis via Digitalmars-d-learn
wrote:
> On Friday, May 3, 2024 1:15:16 PM MDT Ben Jones via Digitalmars-d-learn
wrote:
> > In general, you can't skip a declaration with goto, but it seems
> > to be allowed if the declaration
ome reason, and one or more of the checks that it's supposed
to be doing is being missed.
- Jonathan M Davis
iving the explicit type of the Nullable at all.
- Jonathan M Davis
them now.
- Jonathan M Davis
but either no one
else has needed the bindings, or no one else has needed them for anything
other than Linux with glibc - or if they did, they didn't get them into
druntime.
- Jonathan M Davis
On Friday, April 5, 2024 3:11:42 AM MDT Dom DiSc via Digitalmars-d-learn
wrote:
> On Sunday, 24 March 2024 at 09:16:20 UTC, Jonathan M Davis wrote:
> > So, yes, you've run into a problem that it would be nice to
> > have a better fix for, but even if we could negate attributes
On Monday, April 1, 2024 5:37:56 PM MDT dany via Digitalmars-d-learn wrote:
> Actually I would get an ID's Usb
That's going to depend on the operating system, and it's also going to
depend on exactly what kind of ID you're looking for.
- Jonathan M Davis
hin a module accidentally
accessing other code within that module, then your module is probably too
large anyway.
So, if don't want code to be able to access any of the private members of
your QueueNode type, that code will need to be in a separate module rather
than in the same module as the QueueNode type.
- Jonathan M Davis
to do something
like generate a switch statement from the list of enum members.
https://dlang.org/phobos/std_traits.html#EnumMembers
- Jonathan M Davis
to the
code being changed.
So, yes, you've run into a problem that it would be nice to have a better
fix for, but even if we could negate attributes in general, there are good
reasons to prefer to avoid mass-applying attributes.
- Jonathan M Davis
ore than once. It should be initialized, and
then it should be treated as illegal to ever assign to it - or to do
anything else which would mutate it. So, clearly, the logic in static
constructors with regards to non-mutable variables is overly simple at the
moment.
- Jonathan M Davis
r worse, arrays do that to avoid requiring that you explicitly
slice them to pass them to range-based functions in the cases where you did
something like declare a string to be immutable. But nothing like that
happens with any other types, so if you pass a const Foo - or a const int -
to a templated function, it's instantiated with that exact type.
- Jonathan M Davis
e used for the same thing at
all. And having them be implicitly convertible could cause serious problems
with overloading.
If you want to do that conversion without a cast, then you can just use
std.string.representation (which will do the cast internally).
- Jonathan M Davis
On Wednesday, March 13, 2024 3:49:55 PM MDT zoujiaqing via Digitalmars-d-learn
wrote:
> On Wednesday, 13 March 2024 at 21:21:21 UTC, Jonathan M Davis
>
> wrote:
> > On Wednesday, March 13, 2024 3:03:30 PM MDT zoujiaqing via
> >
> > Digitalmars-d-learn wrote:
> >
oes a copy and remove instead
if moving within the file system doesn't work, but otherwise, you'll have to
implement that yourself, which could be as simple as catching the any
exceptions from move and then attempting to copy the file and then remove it
if an exception was thrown.
- Jonathan M Davis
On Monday, March 11, 2024 10:51:48 AM MDT Andy Valencia via Digitalmars-d-
learn wrote:
> On Monday, 11 March 2024 at 16:25:13 UTC, Jonathan M Davis wrote:
> > ...
> > But what exactly static means varies based on the context.
>
> Thank you for the list! But none of
tml#visibility_attributes
And specifically, to make a symbol only be visible inside a module, you
mark it with private.
- Jonathan M Davis
> scope(failure)?
If anything, I think that it's been decided that chained exceptions were a
mistake. So, if things go in any direction with them, it's likely to be
towards removing them, not doing more to support them.
- Jonathan M Davis
On Wednesday, February 28, 2024 10:44:08 PM MST Brad Roberts via Digitalmars-
d-announce wrote:
> On 2/28/2024 7:34 PM, Jonathan M Davis via Digitalmars-d-announce wrote:
> > On Wednesday, February 28, 2024 7:18:29 PM MST Mike Parker via
> > Digitalmars-d->
> > announce
On Wednesday, February 28, 2024 7:18:29 PM MST Mike Parker via Digitalmars-d-
announce wrote:
> On Wednesday, 28 February 2024 at 19:24:32 UTC, Jonathan M Davis
>
> wrote:
> > I see that they're up on the NNTP server, and the web forum is
> > hooked up to them, but the
are these lists not going to have mailing
lists like the others?
- Jonathan M Davis
line = __LINE__)
{
import core.exception : AssertError;
try
expression();
catch (T)
return;
static if (!is(immutable E == immutable noreturn))
throw new AssertError("assertThrown failed: No " ~ T.stringof ~
" was thrown" ~
(msg.length == 0 ? "." : ": ") ~ msg,
file, line);
}
- Jonathan M Davis
way const or immutable to fix the copy. The
only way to work properly with const or immutable is to construct the object
with the changes in the first place rather than mutating the copy after the
fact.
- Jonathan M Davis
d be taking that possibility into account, and it's
apparently not.
So, there's definitely a bug here, but it's a dmd bug. Its checks for
whether it can safely change the constness of the return type apparently
aren't sophisticated enough to catch this case.
- Jonathan M Davis
On Saturday, February 10, 2024 7:31:47 PM MST Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On Saturday, 10 February 2024 at 23:48:56 UTC, Jonathan M Davis
>
> wrote:
> > If I understand correctly, he cares about how far into the
> > month the dates
> > are,
hereas diffMonths ignores the smaller units, meaning that you get the
same result no matter when in the month the dates are. So,
2000-05-10 - 1990-05-09 would give 10, whereas 2000-05-10 - 1990-05-30
would give 9. diffMonths / 12 would give 10 in both cases.
- Jonathan M Davis
t definitely does the
wrong thing (e.g. with regards to leap years or DST). And math around months
is a prime area where it's difficult to get right in part because different
people have different requirements depending on the actual problem that
they're trying to solve.
- Jonathan M Davis
part(Date(2000, 2, 29), Date(2004, 2, 29)) == -4);
assert(yearsApart(Date(2000, 2, 29), Date(2005, 2, 28)) == -4);
}
- Jonathan M Davis
On Thursday, January 25, 2024 8:03:41 AM MST Max Samukha via Digitalmars-d-
announce wrote:
> On Monday, 22 January 2024 at 23:28:40 UTC, Jonathan M Davis
>
> wrote:
> > Of course, ultimately, different programmers have different
> > preferences, and none of us are go
of ranges are cleaner, and the range API will
likely see a redesign to fix that issue, among others, but the current range
API is as I've explained it to you, warts and all.
- Jonathan M Davis
As it is, you can probably only put the first dimension between the
brackets, because other languages do that, and allowing it makes it easier
to port code. Arguably though, for consistency, you should always put the
dimensions between the parens when allocating a new dynamic array.
- Jonathan M Davis
On Tuesday, January 23, 2024 4:11:00 AM MST ryuukk_ via Digitalmars-d-announce
wrote:
> On Tuesday, 23 January 2024 at 06:30:08 UTC, Jonathan M Davis
>
> wrote:
> > That being said, I expect that it would be pretty easy to write
> > a mixin to do something like that
n to
do something like that if you really wanted to. Also, if you're simply
looking to not have to name the type, you could do
dataGrid = new typeof(datagrid)(15);
- Jonathan M Davis
e happy about everything in any language. So, of
course, there are going to be some folks who are unhappy with how D defines
private, but it's not a feature that has actually been causing us problems,
and it really doesn't make sense at this point to change how it works.
- Jonathan M Davis
On Friday, January 19, 2024 3:49:29 AM MST Jim Balter via Digitalmars-d-learn
wrote:
> On Friday, 17 November 2017 at 17:55:30 UTC, Jonathan M Davis
>
> wrote:
> > When you have
> >
> > foreach(e; range)
> >
> > it gets lowered to something like
> >
On Thursday, January 18, 2024 4:58:32 PM MST zoujiaqing via Digitalmars-d-
learn wrote:
> On Thursday, 18 January 2024 at 23:43:13 UTC, Jonathan M Davis
>
> wrote:
> > On Thursday, January 18, 2024 4:26:42 PM MST zoujiaqing via
> >
> > Digitalmars-d- learn wrote:
> &g
us properties on SysTime and passing them to something
like std.format's format to create a string, or there are several packages
on https://code.dlang.org which have functions for doing custom date/time
formatting.
- Jonathan M Davis
On Wednesday, January 17, 2024 11:33:48 PM MST zjh via Digitalmars-d-learn
wrote:
> On Thursday, 18 January 2024 at 04:30:33 UTC, Jonathan M Davis
> wrote:
> but for a lot of code, using auto and size_t makes it
>
> > so that you don't need to use int, and it would be a big
>
would then be ulong on 64-bit
systems. Obviously, when you do need to convert to int, then that can be
annoying, but for a lot of code, using auto and size_t makes it so that you
don't need to use int, and it would be a big problem in general if the
language made length int.
- Jonathan M Davis
ith regards to tooling.
- Jonathan M Davis
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 downsi
me that I
had a problem due to a selective import. Regardless, obviously, you are
going to have to decide what works for you, and that could change over time.
Both features can definitely help with code encapsulation and with
understanding where the symbols being used are actually coming from, but the
cost-benefit analysis is likely to differ based on how you think and
function.
- Jonathan M Davis
at you'd get out of TDPL
that you wouldn't get from Ali's book, so there's definitely something to
said for reading both, but again, whether that makes sense largely depends
on whether you want to deal with figuring out which parts of TDPL are still
valid.
- Jonathan M Davis
will work directly with a static array (and should
take it by ref to avoid copying) - at least so long as the function that
it's given compiles properly. Personally, I'd just use a foreach loop and
don't see much point in each at all, but looking at its implementation, it
does look like the OP should be able to use it with static arrays in spite
of the fact that they're not ranges
- Jonathan M Davis
On Tuesday, January 9, 2024 4:13:23 AM MST Alexibu via Digitalmars-d-learn
wrote:
> On Tuesday, 9 January 2024 at 10:44:34 UTC, Jonathan M Davis
>
> wrote:
> > How would it even be possible for a static array to be a range?
> > It has a fixed length. For a type to work
ut the dynamic array (or any ranges which wrap it) escaping from
the scope where the static array is, because if the static array goes out of
scope and is destroyed, then any dynamic arrays referring to it will be
referring to invalid memory, and you'll get undefined behavior. So, while
slicing static
On Tuesday, January 2, 2024 3:41:55 AM MST Anonymouse via Digitalmars-d-learn
wrote:
> On Monday, 1 January 2024 at 19:49:28 UTC, Jonathan M Davis wrote:
> > [...]
>
> Thank you. Yes, `Foo` is a class for the purposes of inheritance
> -- I left that out of the example.
>
&g
yourself as well
as casting away shared to then operate on the AA while it's protected. It's
a bug when you can do pretty much anything with a shared AA other than pass
it around without casting away shared first.
- Jonathan M Davis
ining both
the AA and the mutex around than to pass the AA around by itself given that
the whole point of the mutex is to protect that AA.
- Jonathan M Davis
, it has
functions for reading in and writing to files.
std.stdio also has some functions for reading from and writing to files, but
the difference there is that it does it in pieces, whereas std.file reads
and writes files as single units (e.g. std.stdio might read in a file 4096
bytes at a time, wher
.
So, based on what I can see here, it looks like you need to be marking your
functions with @safe where you can, and if any of your code is doing stuff
that isn't guaranteed to be memory-safe (and thus can't be @safe), then
you'll need to make sure that what it's doing is actually memory-safe (in
spite of the fact that the compiler can't guarantee it) and mark it with
@trusted to indicate that you've verified it, and then @safe code can call
it.
- Jonathan M Davis
acing 'Dummy' with {}
>
> Suggestions?
Normally, if you're not going to actually use the member variables, then
there's no point in them even being there. However, if you need them there
for alignment purposes, then you can just make them private.
- Jonathan M Davis
compiler to more easily get an overview of the public symbols within
those modules. But if you're not contributing to those projects, there
really isn't any reason to see those modules.
- Jonathan M Davis
om/dlang/dmd/blob/master/druntime/src/object.d#L269
- Jonathan M Davis
longer than the char* that it's a slice
of. But if all you're doing is comparing it against a D string, then
presumably, you don't need to keep the char[] around, and you won't have to
allocate a copy.
https://dlang.org/phobos/std_string.html#.fromStringz
- Jonathan M Davis
, once you're dealing with an
interface or base class, you just use it as that and don't need to do
anything class-specific to it. So, if possible, it's generally better to
figure out how to rework your code so that you don't need to set anything
that's class-specific in the parts of the code which deal with the object
through an interface or base class reference.
- Jonathan M Davis
in the past), but it's unlikely to change at this point.
So, if we were to add something to std.traits for them, it would probably be
something more like isManifestConstant than isEnum. In spite of the keyword
being used, they really aren't intended to be considered enums.
- Jonathan M Davis
On Thursday, November 16, 2023 6:04:43 PM MST Jonathan M Davis via
Digitalmars-d-learn wrote:
> I would suggest that you open up a bug report for it -
> https://issues.dlang.org - and certainly, there's a good argument that what
> you're seeing here is a bug. I fully expect that wh
hen the other bugs for visibility attributes on aliases were fixed however
many years ago that was now. I very much doubt that what you're seeing is
the intended behavior - or at least I fully expect that if Walter or one of
the other compiler devs sees the issue, they will agree that what you're
trying to do should work.
- Jonathan M Davis
On Wednesday, November 15, 2023 3:26:27 AM MST Sergey via Digitalmars-d-
announce wrote:
> On Wednesday, 15 November 2023 at 09:27:53 UTC, Jonathan M Davis
>
> wrote:
> > On Tuesday, November 14, 2023 12:37:29 PM MST Sergey via
> >
> > Digitalmars-d- announce wrote:
&
take care of it
rather than require that new code slap editions stuff everywhere), but there
is a good reason for the approach that they're currently looking at taking.
- Jonathan M Davis
And in this case, not only does a template solve the problem quite
easily, but it's solving a problem that only rarely needs to be solved these
days.
So, while some might prefer a language solution, this really isn't the sort
of problem that D is likely to solve in the language at this point.
- Jonathan M Davis
t that's going to be _very_ surprising to anyone else using your
project and might cause issues if it's a project that other projects end up
depending on.
- Jonathan M Davis
ird party libraries on code.dlang.org which
support custom formatting for dates and times (e.g.
https://code.dlang.org/packages/ae), but I'm not familiar enough with any of
them to tell you how to solve your problem with them. That being said, since
you seem to haves strings that are almost in the ISO extendend format, it
should be pretty easy to get them to work with D's standard library.
- Jonathan M Davis
s foo/a.d and foo/b.d, with public imports in
mymodule.d like you would have done in mymodule/package.d. You then either
deprecate everything in mymodule.d so that folks will eventually change
their code to use foo/a.d and foo/b.d directly, or you leave the code in the
weird situation of everything being in the foo package, but existing code
continues to import mymodule potentially forever.
- Jonathan M Davis
other modules in order to be able to import a single module
and get several modules. Either way, personally, I don't think that that's
something that should typically be done (with package.d or with any module
name), but for whatever reason, some folks seem to love the idea.
- Jonathan M Davis
On Tuesday, October 31, 2023 8:23:28 AM MDT Salih Dincer via Digitalmars-d-
learn wrote:
> On Tuesday, 31 October 2023 at 10:24:56 UTC, Jonathan M Davis
>
> wrote:
> > On Tuesday, October 31, 2023 4:09:53 AM MDT Salih Dincer via
> >
> > Digitalmars-d- learn wrote:
>
apper to use in your own code.
- Jonathan M Davis
On Monday, October 16, 2023 12:05:04 PM MDT Paul via Digitalmars-d-learn
wrote:
> On Thursday, 12 October 2023 at 21:20:44 UTC, Jonathan M Davis
>
> wrote:
> > look like?
> >
> > Types can have static members.
> >
> > Basically what it comes down to is t
On Monday, October 16, 2023 12:05:04 PM MDT Paul via Digitalmars-d-learn
wrote:
> On Thursday, 12 October 2023 at 21:20:44 UTC, Jonathan M Davis
>
> wrote:
> > look like?
> >
> > Types can have static members.
> >
> > Basically what it comes down to is t
y can access
via their arguments (be it by getting pointers from those arguments or
calling other pure functions on them).
- Jonathan M Davis
ve your post too (which of course means that I'm adding to
the problem as well, but at least now you know).
- Jonathan M Davis
ing
variables in general to string, then it shouldn't be hard to write a simple
function that converts from an integer to a string. So, if that's all that
you're looking to do, it shouldn't be hard to avoid Phobos. However, you're
still going to need to implement it yourself.
- Jonathan M Davis
at
the lengths of the arrays don't much.
As such, I'm not sure that there's actually anything that the compiler could
do here to catch the problem in the OP's case (at least not without doing
code flow analysis, which isn't going to happen).
- Jonathan M Davis
any programmers, Tuple and tuple from std.typecons are good enough,
and whether we ever get tuples added to the language will largely depend on
whether anyone can come up with a proposal for them that convinces Walter
and Atila that they're worth adding.
Either way, the unpacking of dynamic arrays likely stands no chance
whatsoever of ever being added, because it would require runtime checks to
determine whether the unpacking was valid.
- Jonathan M Davis
elements are assigned to
depends on how much of foo you slice, and how those elements are assigned to
depends on the type of x.
- Jonathan M Davis
e.
https://dlang.org/spec/template.html#template_constraints
https://dlang.org/spec/version.html#staticif
https://dlang.org/spec/statement.html#if-statement
http://ddili.org/ders/d.en/templates.html
http://ddili.org/ders/d.en/cond_comp.html
http://ddili.org/ders/d.en/if.html
- Jonathan M Davis
d in regardless (and
potentially result in compiler errors if it doesn't work with the type that
that the template is being instantiated with). So, you usually want to use
static if with compile-time tests and not if.
- Jonathan M Davis
ange or
container, and then either opIndex or opSlice with no parameters to return a
slice of the entire container (in which case, personally, I'd use opSlice,
because semantically, that's what you're doing, but either should work IIRC).
- Jonathan M Davis
xact performance characteristics are going to depend on what
you're doing in your program, and whether the approach of D's dynamic arrays
or C++'s std::vector is better depends on what your code is doing, but for
most code, D's approach works extremely well. It just tends to take some
getting us
up yet though, since the videos are currently in the process
of getting rendered and uploaded to youtube.
https://forum.dlang.org/thread/rgevjorzaoeylhwii...@forum.dlang.org
- Jonathan M Davis
a variety of items on my todo list.
- Jonathan M Davis
um), but that's pretty much it, and even then, that doesn't
remove it from the mailing list, because you can't get an e-mail back once
it's been sent. So, once you send something to the forum, it's out there
forever.
- Jonathan M Davis
On Thursday, September 21, 2023 9:29:17 AM MDT Uranuz via Digitalmars-d-learn
wrote:
> Hello!
> I have some strange problem. I am trying to parse XML files and
> extract some information from it.
> I use library dxml for it by Jonathan M Davis. But I have a
> probleme that I hav
> definitive answer tomorrow. If I'm lucky, a full internal
> cleaning of the graphics card and some new thermal paste will
> solve it. I'm usually not that lucky, though :-)
Clearly, your computer is just sick of hearing about dconf and decided to go
on strike. ;)
- Jonathan M Davis
this video from dconf 2016 which discusses
floating point values:
https://www.youtube.com/watch?v=YEUAUnamQiA
- Jonathan M Davis
size of a type in bytes. In neither case does how it is
calculated have any impact on the performance of the program.
- Jonathan M Davis
you can only
declare your own if you replace the default one, which you might do in some
special situations, but it's not something that you would normally do, and
you can never have both the normal object module and your own in the same
program.
- Jonathan M Davis
ps://dlang.org/phobos/std_socket.html#.Socket.hostName
- Jonathan M Davis
ou're not in an
environment where everyone is expected to look at the code itself rather
than at documentation.
- Jonathan M Davis
t full right now)?
In general, system-specific bindings get added to druntime, because someone
who needed them took the time to add them to the right place in druntime
rather than there being an organized effort to add bindings to druntime.
- Jonathan M Davis
ort std.traits : EnumMembers;
enum Terminator
{
percent = '%',
colon = ':',
qmark = '?'
}
enum terminators = [EnumMembers!Terminator];
- Jonathan M Davis
rantees given by the
language.
So, while it does feel weird to allow pure functions to effectively mutate
global state via the GC, when you consider how the language treats the GC's
state and what the compiler actually does with pure, it should be pretty
clear that treating these functions as pure shouldn't be a problem.
- Jonathan M Davis
So,
while it may very well be possible to do something along the lines of what
you're looking for, I strongly suspect that it's simply not worth it.
- Jonathan M Davis
references escaping would be in the sections of code where you've cast away
shared after locking the relevant mutex. So, similar to what happens with
@safe and @trusted, using shared allows you to limit the code that you have
to examine to find the problem.
- Jonathan M Davis
you're using and whether the code in question is @safe. That will tell you
whether a RangeError should be being thrown or not when an array index is
out-of-bounds.
- Jonathan M Davis
hard to make predictions (especially about the
> >> future), but I'd be interesting in your opinion on the matter.
> >
> > I'd be very surprised if dub added support for pre-compiled
> > binaries - particularly since D isn't generally binary
> > compatible acros
On Friday, July 21, 2023 1:03:47 AM MDT Chris Piker via Digitalmars-d-learn
wrote:
> On Friday, 21 July 2023 at 06:15:10 UTC, Jonathan M Davis wrote:
> > On Thursday, July 20, 2023 10:57:22 PM MDT Chris Piker via
> > Digitalmars-d-learn wrote:
> >
> > Regardless though
ard library have largely replaced their
Makefiles with D scripts. It's definitely worse if you want to write a
script that needs to pull in dependencies that aren't part of the standard
library, but if Phobos has what you need, it works quite well - and of
course, you can always run other shell commands from within a D program.
- Jonathan M Davis
continues to work. And if they need to stick to an
older version of the compiler for some reason, they just use that version of
the compiler. But writing code that explicitly depends on a particular
version of the compiler is not something that many projects are likely to be
doing.
- Jonathan M Davis
1 - 100 of 12829 matches
Mail list logo