What on earth are you talking about.
ImportC is highly experimental and was announced far too soon.
If you look at the last release a very large number of the bug fixes
were for ImportC specifically.
https://dlang.org/changelog/2.099.0.html#bugfix-list
immutable isn't tied to lifetime semantics.
It only says that this memory will never be modified by anyone during
its lifetime.
Anyway, the real problem is with const. Both mutable and immutable
become it automatically.
Storage classes like immutable/const/shared are not tied to any memory
management strategy. Nor does it dictate memory lifetime.
It only dictates how it can be interacted with when you have a reference
to it.
One way you can do it:
import std.range : chunks;
import std.algorithm : map;
import std.array : array;
import std.conv : text;
string[] split = "Hello D".chunks(2).map!(v => v.text).array;
writeln(split);
foreach(val; "Hello D".chunks(2)) {
writeln(val.text);
}
On 21/04/2022 2:15 AM, rempas wrote:
Unfortunately, this will not work for me as it uses "TypeInfo" and it is
not available with "-betterC". Thank you for trying to help regardless!
You can't use AA's in -betterC.
The implementation is not templated and is in druntime.
noreturn is the bottom type which can implicitly convert to any type,
including void. A value of type noreturn will never be produced and the
compiler can optimize such code accordingly.
https://dlang.org/spec/type.html#noreturn
Could we add a check for this in DScanner?
Otherwise I'm not sure how else we are going to find all of these
instances and fix them.
To get the commands dub used, use -v.
$ dub build -v
No args added there.
https://github.com/AuburnSounds/Dplug/blob/master/graphics/dplug/graphics/pngload.d#L1972
Yup that code certainly looks wrong.
Note the casts above it in around:
https://github.com/AuburnSounds/Dplug/blob/master/graphics/dplug/graphics/pngload.d#L1956
So yeah upstream issu
On 27/04/2022 9:39 AM, Guillaume Piolat wrote:
On Tuesday, 26 April 2022 at 21:13:38 UTC, Alexander Zhirov wrote:
more build errors
If you "dub upgrade" it should work a bit better.
No success in reproducing the bug here.
It definitely on your end.
void main() {
int scale;
int* in
On 27/04/2022 9:55 AM, Guillaume Piolat wrote:
On Tuesday, 26 April 2022 at 21:44:56 UTC, rikki cattermole wrote:
On 27/04/2022 9:39 AM, Guillaume Piolat wrote:
On Tuesday, 26 April 2022 at 21:13:38 UTC, Alexander Zhirov wrote:
more build errors
If you "dub upgrade" it should work a bit b
On 27/04/2022 10:05 AM, Guillaume Piolat wrote:
On Tuesday, 26 April 2022 at 21:59:39 UTC, rikki cattermole wrote:
Putting an int into a ubyte absolutely should error, that is a lossy
conversion and should not be automatic.
It's just VRP, here it works in 2.094
https://d.godbolt.org/z/vjq7
This works:
```d
struct Data
{
int[] digits;
}
int parseDigit(char c) pure
{
return c - '0';
}
Data parse(string str) pure
{
Data data;
if (__ctfe) {
size_t used;
data.digits.length = str.length;
while (str.length != 0)
{
// Skip spa
If I am understanding the problem correctly, this is a super expensive
method for doing something pretty simple. Even if it is a bit more code,
this won't require memory allocation which in this case wouldn't be
cheap (given how big DNA tends to be).
string s = "ACGTACGT";
uint[4] counts;
fo
Compiler optimizations should not be defined by a programming language
specification.
This will be on LLVM.
On 13/05/2022 5:18 PM, MichaelBi wrote:
i have code here:
auto uri = environment.get("MONGODB_URI");
MongoClient conn = connectMongoDB(uri);
MongoDatabase eqpdb = conn.getDatabase("MbEqpHeroku");
the "MONGODB_URI" showed above already put into heroku's app config
On 13/05/2022 5:52 PM, MichaelBi wrote:
struct Camera{
@name("_id") BsonObjectID id; // represented as "_id" in the database
string brand;
string model;
}
the structure is mapping of database field structure. how to resolve?
That code isn't the cause of your issue (its fine, n
Okay that is fine, now we need to see where showData is being called.
On 13/05/2022 6:23 PM, MichaelBi wrote:
render!("index.dt", showData());
There ya go, template arguments are run at compile time.
On 13/05/2022 7:03 PM, MichaelBi wrote:
On Friday, 13 May 2022 at 06:43:30 UTC, rikki cattermole wrote:
On 13/05/2022 6:23 PM, MichaelBi wrote:
render!("index.dt", showData());
There ya go, template arguments are run at compile time.
Unh, then how to dynamically generate pages b
Phobos curl wrapper may be an option:
https://dlang.org/phobos/std_net_curl.html#.FTP
On 15/05/2022 2:51 AM, eugene wrote:
On Wednesday, 11 May 2022 at 05:41:35 UTC, Ali Çehreli wrote:
What are you stuck at? What was the most difficult features to
understand? etc.
Garbage collection.
I am not programming languages theorist at at, but my imression is:
* GC came from purely f
On 15/05/2022 4:00 AM, eugene wrote:
The more I have studied memory allocators & management strategies
memory allocators and GC are different things
i've had at some point 'free list' based allocator
and it worked ~3 times faster than malloc/free
when used for classical linked list implementa
As far as I know, no D compiler guarantees compatibility between objects
built on different version of itself.
The change would have been[0].
[0]
https://github.com/dlang/druntime/commit/c6762914682d4fa894e2b746bf4bd9ce3ec9f7cb
Snap package source: https://github.com/dlang-snaps/dmd.snap/
Hasn't been updated in 3 years.
On 22/05/2022 10:44 AM, Alain De Vos wrote:
I want to install the DCD language server on Raspberry PI4.
But the dub build for DCD requires rdmd which is not available.
Can I compile rdmd from source ? Or install a binary ?
[PS: I have ldc 1:1.24.0-2 installed ]
I grabbed a copy of ldc2-1.24.0
On 23/05/2022 6:06 AM, Chris Piker wrote:
1. Supporting gdc development and distribution.
Iain's workload should be decreasing now that it is using the up to date
frontend. Rather than the older C++ version with backports that he has
been maintaining.
My understanding is that he is fin
On 23/05/2022 7:24 AM, Chris Piker wrote:
2. Testing common packages against gdc
Why?
Mostly because I've put in about 15 hours effort so far trying to get a
vibe.d based project to build using gdc, with no success. I'm about to
give up and declare either gdc or vibe.d unsuitable for u
On 23/05/2022 8:05 AM, Chris Piker wrote:
Vibe.d is well tested against the frontend.
Its part of dmd's test suite.
See: https://buildkite.com/dlang/dmd/builds/26775
Thanks, that's handy. Do you know where the equivalent test suite is
for gdc?
No idea.
I've pinged Iain, because you are c
On 23/05/2022 8:22 AM, Chris Piker wrote:
Hey thanks! I bet LDC is pretty cool, have to look into it sometime.
For now at my site just introducing D is a bit radical, don't want to
capsize the boat by leaving the gcc toolchain altogether. I'm willing
to help out with GDC work were I can, a
Bitmap is a class, not a namespace.
The function you want is actually a constructor.
https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/include/gdiplus/gdiplusheaders.h#L179
registeredClass.style = 32_769;
Don't use an integer like that, stick with bit wise ors.
LPCWSTR classname = toUTF16z(name);
GC owned memory, that could result in surprises.
const LPWSTR windowname = toUTF16z(title);
Ditto
I'm not sure your window callback procedure is right.
For inst
A white content area, means that you didn't draw something.
As long as the border ext. is showing up, you're ok.
A bit more d-ified and uses foreach + foreach_reverse without allocating
an array.
```d
import std.stdio;
void main()
{
doRepetition(4, 3);
writeln("==");
doRepetitionReversed(4, 3);
}
void doRepetition(const int n, const int m)
{
// combination total number is m, elem
The version of readln you are using is[0]. This works by taking in a
buffer of memory to write out, and returns how many codepoints were stored.
Because you are not reusing memory, not using this form you can of
course use string[1] instead, rather than ``char[]``.
```d
string s = readln()
I don't know of a D version, although it should be pretty easy to write
up yourself.
But you can always use strtok itself.
https://github.com/dlang/dmd/blob/09d04945bdbc0cba36f7bb1e19d5bd009d4b0ff2/druntime/src/core/stdc/string.d#L97
Very similar to example given on the docs:
```d
void main()
It is a pretty straight forward.
You tried to access memory out of bounds of the slice.
https://github.com/pascal111-fra/D/blob/main/dcollect.d#L34
That for loop is problematic in a number of ways.
You should not use int, or uint to index into memory, only size_t should
be used. It is an alia
Its working for me.
[alpha@DESKTOP-RB97SA4
[/cygdrive/p/ProjectSidero/basic_memory/source/sidero/base/text/unicode$
rdmd --eval=$'import std; writeln(dirEntries(`.`, `*.d`,
SpanMode.shallow));'
[".\\casefold.d", ".\\casing.d", ".\\comparison.d",
".\\composing.d", ".\\defs.d", ".\\norm
On 11/08/2022 12:36 AM, pascal111 wrote:
2) I used "goto", I heard from someone before that using "goto" isn't
good programming feature.
This is mostly a historical debate at this point.
Back 40 years ago, goto wasn't typically limited within a procedure and
doesn't have any checks in place
On 19/08/2022 4:56 AM, IGotD- wrote:
BetterC means no arrays or strings library and usually in terminal tools
you need to process text. Full D is wonderful for such task but betterC
would be limited unless you want to write your own array and string
functionality.
Unicode support in Full D
For dmd you use build.d that is in the repository.
For phobos win64.mak (used for 32bit by default as well):
"# Makefile to build D runtime library phobos{64,32mscoff}.lib for
Windows MSVC"
So MSVC make.
Beyond that idk, but its starting point (oh and druntime is now in dmd
repo, so ugh...
After a bunch of playing around I managed to determine that it is as
simple as the mode.
exists(dbFileName) ? "r+" : "w+"
Will fix it.
Of course you shouldn't delete the file like that method is doing. It
should probably reinitialize the FILE* descriptor.
On 30/08/2022 8:16 AM, Gavin Ray wrote:
It must have been the "writing at end of file" bit?
I don't know.
It read like it should work.
The offsets were correct, it just didn't work *shrug*.
I think you are wanting opAssign not opBinary.
Also you made a mistake, since its a struct you don't want to new it
when you construct and return it.
```d
return new Time(secos / 3600, (secos % 3600) / 60, secos % 60);
```
Would be a ``Time*`` not ``Time`` which is what you returned.
This slightly smells, single module dub packages.
What does each module do?
Yeah you're over thinking this.
It is a single dub package with a namespacing package directory.
I cannot recommend looking at how Adam has done it.
I've been trying to get him to change it since he originally did it.
It has known issues and yes it will still pull in all modules thanks to
-I behavior except you get fun things like linker errors.
Keep in mind, you are trying to optimize
I've been reading up fairly recently on RPATH for *nix which does what
you want. Unfortunately as far as I've found there is no way to do this
on Windows without an extra executable.
You have probably forgotten to link against user32.
On 07/09/2022 10:14 PM, Injeckt wrote:
On Wednesday, 7 September 2022 at 10:01:11 UTC, rikki cattermole wrote:
You have probably forgotten to link against user32.
I guess you right. But I don't know how i gonna link libs when I'm using
"dmd main.d". Tell me please.
I think it is as simpl
Text in buffer: "123\n"
Read: "123"
Text in buffer: "\n"
Read: exception, expecting number for "\n"
Changing your readf format specifier to include the new line should work.
https://dlang.org/phobos/std_stdio.html#.File.readf
On 08/09/2022 11:24 AM, Synopsis wrote:
On Wednesday, 7 September 2022 at 23:06:44 UTC, rikki cattermole wrote:
Text in buffer: "123\n"
Read: "123"
Text in buffer: "\n"
Read: exception, expecting number for "\n"
Changing your readf format specifier to include the new line should work.
https:
Apart from not linking against OpenXR, I'm not seeing anything obviously
wrong in that binding.
https://github.com/dlang/dub/issues/2483
```d
version(all) {
__gshared:
uint test2;
}
uint test;
```
Output with -vtls:
```
Up to 2.079.1: Success with output: onlineapp.d(9): test is thread
local
Since 2.080.1: Success with output: onlineapp.d(9): `test` is
thread local
```
Looks fine to me.
Currently in D you would be forced to create a vtable struct manually.
But if we had something like signatures you could do this:
```d
struct Foo {
//...
}
struct Bar {
InputRange input;
}
void doIt() {
Bar bar;
Foo* foo = new Foo;
bar.input = foo;
}
```
Alternatively we could just extend platforms to work in places other
than configurations.
https://dub.pm/package-format-json.html#configuration-settings
On 28/09/2022 7:18 AM, Alain De Vos wrote:
Don't forget there is also BSD
Should already be supported.
Platform specific settings are supported through the use of field name
suffixes. Suffixes are dash separated list of operating
system/architecture/compiler identifiers, as defined in the D
Visual Studio with its c++ components can debug D code, it should not
require Visual D to do so.
Open executable as project.
If this does not work, you have a serious issue in your system/VS install.
This may help to narrow down what is going on.
On 13/10/2022 9:27 PM, bauss wrote:
This doesn't actually work properly in all languages. It will probably
work in most, but it's not entirely correct.
Ex. Turkish will not work with it properly.
Very interesting article:
http://www.moserware.com/2008/02/does-your-code-pass-turkey-test.html
On 13/10/2022 9:42 PM, bauss wrote:
Oh and to add onto this, IFF you have to do it the hacky way, then
converting to uppercase instead of lowercase should be preferred,
because not all lowercase characters can perform round trip, although a
small group of characters, then using uppercase fixes
On 13/10/2022 9:55 PM, bauss wrote:
Yeah, text isn't easy :D
Indeed!
It has me a bit concerned actually, I'm wondering if my string stuff
will even work correctly for UI's due to performance issues.
My string builder for instance allocates like crazy just to do slicing.
But hey, at least I
On 17/10/2022 12:09 AM, Decabytes wrote:
I'm trying to set up Visual Studio 2022 with Visual D, and I'm running
into issues trying to get my project to build correctly. It's a double
whammy because I've never used Visual Studio before (Just an Emacs Guy),
but I need to debug my D programming an
There is: D_Optimized
https://dlang.org/spec/version.html#predefined-versions
But nothing for debug info.
I'm afraid I think you'll just have to use a version (unless you want to
add it).
On 18/10/2022 9:37 AM, mw wrote:
Maybe Mir should add static check for supported complier versions,
rather than let user try and error.
Dub has dependency checks for compiler/dub in it.
It doesn't need to be in code.
Well its not a type system issue.
Making u = n, that'll returns true.
So the problem almost certainly lies with IEEE-754.
They are horrible to compare (float/double).
Unfortunately you are stuck calling functions like isClose to compare.
https://dlang.org/phobos/std_math_operations.html#.isClo
https://github.com/dlang/dmd/blob/master/druntime/src/core/attribute.d#L292
On 19/10/2022 2:30 PM, H. S. Teoh wrote:
On Wed, Oct 19, 2022 at 01:15:37AM +, Adam D Ruppe via Digitalmars-d-learn
wrote:
On Wednesday, 19 October 2022 at 00:57:31 UTC, H. S. Teoh wrote:
Has it really been implemented? I tested the latest git master, the
following code doesn't compile:
If you only have one compiler available, dub will use it (doesn't matter
if its dmd/ldc/gdc).
rdmd is a tool that wraps dmd/ldc/gdc.
https://github.com/dlang/tools/blob/master/rdmd.d
If you only have ldc in your PATH variable, rdmd just "just work".
From there down:
https://dlang.org/spec/statement.html#foreach_over_struct_and_classes
On 25/10/2022 5:17 PM, Siarhei Siamashka wrote:
Wow, I didn't expect anything like this and just thought that the
nightmares of handling 8-bit codepages for non-English languages ceased
to exist nowadays. Too bad. What are the best practices to deal with
Turkish text in D language?
std.uni do
On 26/10/2022 6:06 PM, Siarhei Siamashka wrote:
Should we ignore the `"D should strive to be correct, rather than fast"`
comment from bauss for now? Or some actions can be taken to improve the
current situation?
Bauss is correct.
It should be implemented but it does not need to be fast.
But
On 26/10/2022 6:49 PM, Siarhei Siamashka wrote:
On Wednesday, 26 October 2022 at 05:17:06 UTC, rikki cattermole wrote:
if you are able to ignore that Unicode is a thing, I'd recommend it.
It is complicated, as we humans are very complicated ;)
I can't ignore Unicode, because I frequently have
On 28/10/2022 5:40 AM, DLearner wrote:
Maybe fewer people use it under Windows, so Windows constructs don't get
exercised so much.
I have actively contributed to dub specifically for Windows in the last
year :)
There is enough of us.
Also UNC paths (those with drives and then the slash) are
On 29/10/2022 4:15 AM, DLearner wrote:
However, going forward, I don't want copies of OM anywhere other than UD.
If you want your own private library on your system (that will get used
a lot), you can create a package and use ``$ dub add-local .`` to add it
to the available packages for looku
On 29/10/2022 11:05 AM, Siarhei Siamashka wrote:
And as for the D language and Phobos, should "ß" still uppercase to
"SS"? Or can we change it to uppercase "ẞ" and remove German from the
list of tricky languages at
https://dlang.org/library/std/uni/to_upper.html ? Should Turkish be
listed ther
Something to consider:
dub can be used as a library.
You can add your own logic in main to allow using your build
specification to generate a dub file (either in memory or in file system).
You could redirect stdout to a file of your choosing and test against that.
Although ideally you would instead take as an argument to print some
sort of output range or Appender. Then you could test against that instead.
We have a few build formats that dub can generate for you automatically:
```
visuald - VisualD project files
sublimetext - SublimeText project file
cmake - CMake build scripts
build - Builds the package directly
```
Unfortunately none of them are make, it would be nice to have that if
you are l
On 06/11/2022 1:16 AM, Imperatorn wrote:
On Saturday, 5 November 2022 at 11:38:09 UTC, rikki cattermole wrote:
We have a few build formats that dub can generate for you automatically:
```
visuald - VisualD project files
sublimetext - SublimeText project file
cmake - CMake build scripts
build -
Try ldc, if that works then its just a missing library that needs to be
linked against regarding MS CRT.
I've looked up three of those names, they are all deprecated.
I'm wondering if Microsoft have removed them.
On 07/11/2022 5:48 AM, Joel wrote:
The algorithm is too hard for me to work out and dg2d doesn't help
either. I want my code fixed up so that works from any two points.
Its not as complex as that page initially looks.
```
plotLine(x0, y0, x1, y1)
dx = abs(x1 - x0)
sx = x0 < x1 ? 1 : -1
On 07/11/2022 10:29 PM, Joel wrote:
Ok, this is working:
I'm glad to hear it!
Pathing algorithms can be quite fun to mess around with.
On 15/11/2022 5:10 PM, Elfstone wrote:
I just checked the DIP list and #1000 is marked superseded. Any idea
what supersedes it?
The implementation.
I wouldn't bother.
They are const, they can't change.
Nothing to protect, nothing to synchronize.
Okay you have misunderstand a lot here.
We have two types of arrays:
- Static, fixed sized stored on stack.
- Dynamic, variable sized, stored on the heap.
However dynamic arrays are not actually a distinct type in the type
system, its a language extension to use runtime hooks using the GC.
W
The output will be bad because of Windows specific behavior related to
not outputting as UTF-16.
This will print all the characters in the block "Superscripts and
Subscripts".
The Unicode database is very out of date (just waiting for merge for
update), but should be ok for this example.
`
char is always UTF-8 codepoint and therefore exactly 1 byte.
wchar is always UTF-16 codepoint and therefore exactly 2 bytes.
dchar is always UTF-32 codepoint and therefore exactly 4 bytes;
'Ğ' has the value U+011E which is a lot larger than what 1 byte can
hold. You need 2 chars or 1 wchar/dch
On 03/12/2022 10:35 AM, Adam D Ruppe wrote:
On Friday, 2 December 2022 at 21:26:40 UTC, rikki cattermole wrote:
char is always UTF-8 codepoint and therefore exactly 1 byte.
wchar is always UTF-16 codepoint and therefore exactly 2 bytes.
dchar is always UTF-32 codepoint and therefore exactly 4 by
On 03/12/2022 11:32 AM, Ali Çehreli wrote:
On 12/2/22 13:44, rikki cattermole wrote:
> Yeah you're right, its code unit not code point.
This proves yet again how badly chosen those names are. I must look it
up every time before using one or the other.
So they are both "code"? One is a "unit
ALl it means is certain memory patterns (such as writes), will tell the
GC about it.
Its required for pretty much all advanced GC designs, as a result we are
pretty much maxing out what we can do.
Worth reading:
https://www.amazon.com/Garbage-Collection-Handbook-Management-Algorithms/dp/1420
Which ldc did you install?
Was it: ldc2-1.30.0-osx-arm64.tar.xz
stringImportPaths
On 21/07/2019 5:44 PM, Kagamin wrote:
On Tuesday, 16 July 2019 at 01:38:49 UTC, evilrat wrote:
Also from what I see MS done this intentionally, means they either no
longer loves COM or there was some other good reason.
Primary consumer of COM interfaces is Visual Basic. It was really only
Bil
On 23/07/2019 12:49 AM, drug wrote:
I have almost identical (I believe it at least) implementation (D and
C++) of the same algorithm that uses Kalman filtering. These
implementations though show different results (least significant
digits). Before I start investigating I would like to ask if th
On 23/07/2019 12:58 AM, drug wrote:
22.07.2019 15:53, rikki cattermole пишет:
https://godbolt.org/z/EtZLG0
hmm, in short - this is my local problem?
That is not how I would describe it.
I would describe it as IEEE-754 doing what IEEE-754 is good at.
But my point is, you can get the results
On 23/07/2019 9:34 AM, solidstate1991 wrote:
It seems that I've to write my own function that searches in the given
object's classinfo.interfaces since I couldn't find anything related in
Phobos.
if (Foo foo = cast(Bar)bar) {
}
On 26/07/2019 12:30 AM, Oleg B wrote:
On Thursday, 25 July 2019 at 12:20:04 UTC, Mike Franklin wrote:
If you read the documentation for betterC
(https://dlang.org/spec/betterc.html#consequences) you'll see that
there are features of the D language which are not supported.
Therefore, librarie
On 29/07/2019 2:42 AM, Robert M. Münch wrote:
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
1 - 100 of 1056 matches
Mail list logo