On Friday, 12 April 2024 at 18:36:13 UTC, Chris Piker wrote:
On Saturday, 30 March 2024 at 07:11:49 UTC, Mike Parker wrote:
Though I appreciate the sentiment, it's much more effective
and efficient for people actually using the feature, and who
appreciate it, to write up a blog post about it
On Friday, 12 April 2024 at 18:45:21 UTC, Chris Piker wrote:
Even though DMD can't compile some C code, that's pretty much a
non-issue for me anyway. In my environment the servers are all
Linux so "apt-get" (or equivalent) typically provides a
pre-compiled dependency. Being able to list a
On Monday, 1 April 2024 at 02:08:20 UTC, Lance Bachmeier wrote:
On Saturday, 30 March 2024 at 05:01:32 UTC, harakim wrote:
It works well if you only need to work with a header. There are
still a few rough edges that get in the way if you're compiling
the full C sources (I filed bugs for all
On Saturday, 30 March 2024 at 07:11:49 UTC, Mike Parker wrote:
Though I appreciate the sentiment, it's much more effective and
efficient for people actually using the feature, and who
appreciate it, to write up a blog post about it somewhere and
share that on Twitter/Reddit/HN, etc.
I would,
sing C
from C and I think you should advertise that better!
It works well if you only need to work with a header. There are
still a few rough edges that get in the way if you're compiling
the full C sources (I filed bugs for all of them):
- Can't handle va_arg
- Can't cast to a pointer of a st
On Saturday, 30 March 2024 at 05:01:32 UTC, harakim wrote:
@D Language Foundation - This is a HUGE selling point. I had to
use cups the other day and I just copied some code from a d
file and linked the library. It was so easy I was suspicious
but it worked. Using C from D is pretty much as
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote:
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:
Should be able to just use it, as described here:
https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote:
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:
Should be able to just use it, as described here:
https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:
Should be able to just use it, as described here:
https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and then call the functions you need.
Wow. **That just worked the
against pre-compiled code.
What is the best way, as of 2024 to use this library with D, in
particular dmd? ImportC doesn't seem like the go-to option
since the C source does not need to be complied. I've seen
some forum post indicating that manually generated D wrappers
are no longer needed
Hi D
I have a C library I use for work, it's maintained by an external
organization that puts it through a very through test framework.
Though source code is supplied, the intended use is to include
the header files and link against pre-compiled code.
What is the best way, as of 2024
On Saturday, 16 March 2024 at 20:34:57 UTC, Inkrementator wrote:
Nice. Btw I vaguely remember you also wrote about how and why
to reduce the usage string mixins, with some real example of
alternative techniques you used
go to the main page: http://dpldocs.info/this-week-in-d/Blog.html
and
On Saturday, 16 March 2024 at 13:09:13 UTC, Adam D Ruppe wrote:
On Thursday, 14 March 2024 at 23:19:37 UTC, Inkrementator wrote:
@(__traits(getAttributes, thingYouWantToForward))
void yourNewThing() {}
Thanks, that should solve my problem.
On Friday, 15 March 2024 at 19:13:38 UTC, cc wrote:
This is trivially easy if your types are visible at module
level, and mixin is a fine tool for the job. It doesn't work
quite so well with [Voldemort
types](https://wiki.dlang.org/Voldemort_types).
I used the following lines to make it work
On Thursday, 14 March 2024 at 23:19:37 UTC, Inkrementator wrote:
* Is UDA propagation possible without string mixins?
@(__traits(getAttributes, thingYouWantToForward))
void yourNewThing() {}
* Are template mixins vulnerable to name collisions?
On Thursday, 14 March 2024 at 23:19:37 UTC, Inkrementator wrote:
I am trying to derive a struct from another. I want to modify
each field such that type of it goes from some T to Nullable!T,
preserving all fieldnames and UDAs.
This is trivially easy if your types are visible at module level,
are
involved, I can't simply take an alias anymore.
The one workaround I found is to make my introspective struct
part of a template mixin, this way it can access all symbols of
the callsite and can use all the symbols. Is this the recommended
way to do it? Generating a string mixin directly would
On Monday, 12 March 2018 at 10:20:20 UTC, Seb wrote:
On Sunday, 4 March 2018 at 16:46:56 UTC, Marc wrote:
then copy it to sources folder?
let's say I have a small library folder at C:\mylibrary\D
where I want to use dir.d from it. How do I add that file
dependence to dub? But I do not want
On Wednesday, 6 December 2023 at 11:53:09 UTC, realhet wrote:
Hello,
I've found another trick:
- prepend "version(none):" in front of the source.
- ignore the optional "Error: declaration expected, not `module`"
message
- Take seriously all the other errors, those are only syntax
errors,
inied__`
I know it started to do the semantic analysis, but I wonder if
there is a prettier way to do this...
```
__undefinied__ _;void removeCard(Card card)
{
if(card.shortName !in cardMap) return;
/+More code here, also the syntax could be broken. I
wan't to detect exactly that.+/
}
```
On Tuesday, 14 November 2023 at 13:43:03 UTC, Hipreme wrote:
Right now, I've been implementing classes separately, and I
need a dummy symbol. The best world is not even having a symbol
but having only its implementation, for example, I would like
being able to do that:
```d
void
On Saturday, 7 October 2023 at 19:30:23 UTC, mw wrote:
On Saturday, 7 October 2023 at 19:25:51 UTC, mw wrote:
Or how can I get the `tag` and `storage` myself?
https://github.com/dlang/phobos/blob/a3f22129dd2a134338ca02b79ff0de242d7f016e/std/sumtype.d#L310
If I add this line to the above
On Saturday, 7 October 2023 at 19:25:51 UTC, mw wrote:
Or how can I get the `tag` and `storage` myself?
https://github.com/dlang/phobos/blob/a3f22129dd2a134338ca02b79ff0de242d7f016e/std/sumtype.d#L310
If I add this line to the above func `isF`:
```
writeln(t.tag);
```
it won't compile:
https://dlang.org/library/std/sumtype.html
seems right now the `match!(...)` template only generate a
delegate, e.g. suppose the following (silly) code:
```
bool isF(Temperature t) {
while (true) {
t.match!(
(Fahrenheit f) {return true;},
(_) {return false;} // I want to
Recently I wanted to wrap a small d program around an external
process and stream its stdout/stderr to the original
stdout/stderr of the d program (no other output while the
external process is running).
I first tried to implement this with vibe's fibers, but after
failing first try, I
Hi,
I'm using LDC2 64bit on Windows. If I ask it to generate a .map
file, I can locate the function. But how can I access the
Line-code information? Do I need to generate a huge .pdb file
with lots of other information (and also I have to understand it
and extract the lines), or is there a
On Monday, 22 May 2023 at 22:22:50 UTC, Theo wrote:
On Friday, 19 May 2023 at 18:31:45 UTC, Maximilian Naderer
wrote:
..
I’m hope somebody could give me some insights. Thank you !
Kind regards from Austria
Max
DConf Online '22 - Translating C to D (Dennis Korpel)
On Tuesday, 23 May 2023 at 02:58:21 UTC, John Xu wrote:
What is the best way to convert a GBK/GB18030 file contents,
i.e. read via: std.stdio.read(gbkFile).to!string ,
to utf8 encoding ?
https://github.com/lytsing/gbk-utf8/blob/master/utf8.c
Here, it is C, but porting this to D is easy
On Tuesday, 23 May 2023 at 02:58:21 UTC, John Xu wrote:
What is the best way to convert a GBK/GB18030 file contents,
i.e. read via: std.stdio.read(gbkFile).to!string ,
to utf8 encoding ?
I don't think we have any implementation of that encoding yet. If
you decide to make your own, don't
What is the best way to convert a GBK/GB18030 file contents,
i.e. read via: std.stdio.read(gbkFile).to!string ,
to utf8 encoding ?
On Friday, 19 May 2023 at 18:31:45 UTC, Maximilian Naderer wrote:
..
I’m hope somebody could give me some insights. Thank you !
Kind regards from Austria
Max
DConf Online '22 - Translating C to D (Dennis Korpel)
https://www.youtube.com/watch?v=654rSPaIA0o
On Friday, 19 May 2023 at 18:31:45 UTC, Maximilian Naderer wrote:
Hello guys,
So what’s currently the best way to use a big C library?
Let’s assume something like
cglm
assimp
glfw
- Some big libraries are translated, for example
https://code.dlang.org/packages/glfw-d was created with both
On Friday, 19 May 2023 at 18:31:45 UTC, Maximilian Naderer wrote:
Hello guys,
So what’s currently the best way to use a big C library?
Let’s assume something like
cglm
assimp
glfw
ImportC doesn’t really work for such huge libraries, I’ll
investigate further. Deimos is outdated
On Friday, 19 May 2023 at 18:31:45 UTC, Maximilian Naderer wrote:
Hello guys,
So what’s currently the best way to use a big C library?
Let’s assume something like
cglm
assimp
glfw
ImportC doesn’t really work for such huge libraries, I’ll
investigate further. Deimos is outdated
Hello guys,
So what’s currently the best way to use a big C library?
Let’s assume something like
cglm
assimp
glfw
ImportC doesn’t really work for such huge libraries, I’ll
investigate further. Deimos is outdated or there are no bindings.
I know that there is a dub package for glfw which
On Wednesday, 17 May 2023 at 08:00:17 UTC, Dom DiSc wrote:
If you want auto-conversion, you should be more explicit:
```d
float opCast() { }
```
because if you return "auto" it is not the highest-prio fit and
therefore not chosen.
If you have multiple choices, you still don't need to use
On Friday, 12 May 2023 at 15:00:48 UTC, Salih Dincer wrote:
```d
struct Fraction {
int num, den;
this(int n, int d)
{
num = n;
den = d;
}
// Cast Expression : convert float value of fraction
auto opCast(T :
On Sunday, 7 May 2023 at 21:04:05 UTC, Inkrementator wrote:
Open question to everybody: What you're opinion on using opCast
for this? Since it's a type conversion, it seems fitting to me.
Can't converting without explicitly specifying in D is a big
shortcoming in my opinion. There is such a
ality we gloss over
low-level details that will make a big difference in the outcome of the
computation in the corner cases. The whole rvalue/lvalue business is
really more a way of conveying to the compiler what exactly must happen,
rather than directly corresponding to any actual feature in the
under
On Wednesday, 10 May 2023 at 20:25:48 UTC, H. S. Teoh wrote:
On Wed, May 10, 2023 at 07:56:10PM +, Chris Piker via
Digitalmars-d-learn wrote: [...]
I also suffer from left/right confusion, and always have to
pause to think about which is the right(!) word before uttering
it.
Oh, I though
. "Right" in my head
> always means "correct".
>
> My daughter hates it when I'm telling her which way to turn the car
> since I've said the wrong direction so many times. :)
I also suffer from left/right confusion, and always have to pause to
think about which is
with the terms lvalue and rvalue is much more basic,
and is just a personal one that only affects probably 0.1% of
people. I just can't keep left vs. right straight in real life.
"Right" in my head always means "correct".
My daughter hates it when I'm telling her which way to turn
On Wed, May 10, 2023 at 03:24:48PM +, Chris Piker via Digitalmars-d-learn
wrote:
[...]
> It's off topic, but I forget why managing memory for rvalues* was
> pushed onto the programmer and not handled by the compiler. I'm sure
> there is a good reason but it does seem like a symmetry breaking
On Wednesday, 10 May 2023 at 14:42:50 UTC, Inkrementator wrote:
On Sunday, 7 May 2023 at 21:12:22 UTC, Chris Piker wrote:
https://gist.github.com/run-dlang/9b7aec72710b1108fc8277789776962a
Thanks for posting that. Reading over the code I'm reminded that
I never cared whether something was
On Sunday, 7 May 2023 at 21:12:22 UTC, Chris Piker wrote:
On the other hand, your first suggestion of using opCast() does
seem like a reasonable choice to me. Can you provide a short
code snippet using opCast to achieve the same result?
I've never used it, and particularly I know that I
On 5/7/23 13:44, Chris Piker wrote:
> to fix the problem I
> just delete the alias this line from dpq2, see what unit tests and app
> code it breaks, then fix each of those.
Yes but I neglected the lvalue/rvalue issue. In some cases the code
won't compile if the return type of the newly
On Sunday, 7 May 2023 at 21:04:05 UTC, Inkrementator wrote:
On Sunday, 7 May 2023 at 18:19:04 UTC, Ali Çehreli wrote:
alias this is for implicit type conversions, which can be
achieved explicitly as well.
Open question to everybody: What you're opinion on using opCast
for this? Since it's a
On Sunday, 7 May 2023 at 18:19:04 UTC, Ali Çehreli wrote:
alias this is for implicit type conversions, which can be
achieved explicitly as well.
Open question to everybody: What you're opinion on using opCast
for this? Since it's a type conversion, it seems fitting to me.
And another
On Sunday, 7 May 2023 at 18:19:04 UTC, Ali Çehreli wrote:
auto main() {
auto c = new C();
// The same type conversion is now explicit:
foo(c.asIntPtr);
}
Hi Ali
Ah, very clear explanation, thanks! So basically to fix the
problem I just delete the alias this line from dpq2, see
On 5/7/23 10:55, Chris Piker wrote:
> According to dmd 2.103, alias this is
> deprecated for classes, so I'd like to correct the problem.
alias this is for implicit type conversions, which can be achieved
explicitly as well. Given the following old code:
class C {
int* result;
alias
Hi D
One of the dependencies for my project has a class that makes use
of the `alias x this` construct. According to dmd 2.103, alias
this is deprecated for classes, so I'd like to correct the
problem.
Is there a specific paragraph or two that I can read to find out
what is the
On Wednesday, 22 March 2023 at 15:23:42 UTC, Kagamin wrote:
https://dlang.org/phobos/std_stdio.html#rawWrite
It's really amazing, it succeeded. Thank you!
```cpp
auto b="test.txt";//gbk
void[]d=read(b);
stdout.rawWrite(d);
```
https://dlang.org/phobos/std_stdio.html#rawWrite
On Wednesday, 15 March 2023 at 19:22:32 UTC, Paul Backus wrote:
On Tuesday, 14 March 2023 at 10:19:24 UTC, Elfstone wrote:
[...]
Currently the best workaround for this is to define `Vector` as
a `struct` with `alias this` instead of as an `alias`:
```d
struct Matrix(S, size_t M, size_t N)
the param to be
`Vector`?
But that's simply the current state: it looks like DIP1023
isn't going anywhere, and I'm not a compiler expert.
Note that I had to repeat `Matrix!(S, N, 1)` to for both
`Vector` and `isVector`.
Is there a way around this?!
Currently the best workaround
isVectorCorrect(V) = is(V == Matrix!(U, N, 1), U, size_t
N); // the "correct" way and how much I like to REPEAT myself!
void foo(U)(Vector!(U, 3) a)
{
}
void bar(U)(U a) if (isVector!U)
{
}
void main()
{
import std.stdio;
Vector!(float, 3) v;
foo(v); // Error: none of the
); // the "correct" way and how much I like to REPEAT myself!
void foo(U)(Vector!(U, 3) a)
{
}
void bar(U)(U a) if (isVector!U)
{
}
void main()
{
import std.stdio;
Vector!(float, 3) v;
foo(v); // Error: none of the overloads of template
`app.doSomething` are callable usin
On Tuesday, 14 March 2023 at 09:20:54 UTC, Kagamin wrote:
I guess if your console is in gbk encoding, you can just write
bytes with stdout.write.
Thank you for your reply, but only display bytes, not gbk text.
```D
struct Matrix(S, size_t M, size_t N)
{
}
alias Vector(S, size_t N) = Matrix!(S, N, 1);
enum isVector(V) = is(V == Vector!(S, N), S, size_t N); // it
doesn't work
enum isVectorCorrect(V) = is(V == Matrix!(U, N, 1), U, size_t N);
// the "correct" way and how much I like to REP
On Monday, 13 March 2023 at 00:32:07 UTC, zjh wrote:
Thank you for your reply, but is there any way to output `gbk`
code to the console?
I guess if your console is in gbk encoding, you can just write
bytes with stdout.write.
Hello,
I am playing a little bit with DMD to get familiar with it (just
to get a basic overview of it)
I'm trying to come up with a proof of concept for
https://github.com/dlang/DIPs/blob/master/DIPs/DIP1044.md
```D
enum Tester
{
KNOWN = 1,
WITHAUTO = 2
}
void func(Tester a,
On Monday, 13 March 2023 at 15:50:37 UTC, Steven Schveighoffer
wrote:
What is required is an addition to the `std.encoding` module,
to allow such an encoding.
Thank you for your information.
On 3/12/23 8:32 PM, zjh wrote:
On Sunday, 12 March 2023 at 20:03:23 UTC, 0xEAB wrote:
...
Thank you for your reply, but is there any way to output `gbk` code to
the console?
What is required is an addition to the `std.encoding` module, to allow
such an encoding.
Encodings are simply
On Sunday, 12 March 2023 at 20:03:23 UTC, 0xEAB wrote:
...
Thank you for your reply, but is there any way to output `gbk`
code to the console?
On Sunday, 12 March 2023 at 00:54:53 UTC, zjh wrote:
On Saturday, 11 March 2023 at 19:56:09 UTC, 0xEAB wrote:
If you desire to use other encodings, how about using ubyte +
ubyte[]?
There is no example.
To read binary data from a file and dump it into another, you do:
```d
import std.file
On Saturday, 11 March 2023 at 19:56:09 UTC, 0xEAB wrote:
If you desire to use other encodings, how about using ubyte +
ubyte[]?
There is no example. An example should be added in an obvious
position.
I tried for a long time, but couldn't output `gbk`, and I finally
gave up.
On Friday, 10 March 2023 at 07:16:32 UTC, zjh wrote:
`D language` is too unfriendly for Chinese users!
You can't even write `gbk` files.
D’s char + string types are Unicode.
To quote the tour, “In D, *all* strings are Unicode strings”.
If you desire to use other encodings, how about using
On Friday, 10 March 2023 at 06:19:38 UTC, zjh wrote:
`D language` is too unfriendly for Chinese users!
You can't even write `gbk` files.
On Friday, 10 March 2023 at 02:48:43 UTC, John Xu wrote:
```d
module chinese;
import std.stdio : writeln;
import std.conv;
import std.windows.charset;
int main(string[] argv)
{
auto s1 = "中文";//utf8 字符串
writeln("word:"~ s1); //乱的
writeln("word:" ~
I found this:
https://github.com/meatatt/exCode/blob/master/source/excode/package.d
There is mention of unicode/GBK conversion, maybe it could be
helpful
Thanks for quick answers. Now I found I can read both UTF8 and
UTF-16LE
chinese file:
string txt =
On Tuesday, 7 March 2023 at 22:28:41 UTC, ryuukk_ wrote:
```
import std.stdio;
void main()
{
writeln("file:", __FILE__);
writeln("function is: ", __FUNCTION__);
writeln("function is: ", __PRETTY_FUNCTION__ );
}
$ dmd -run tester.d
file:tester.d
function is:
On Tuesday, 7 March 2023 at 22:19:22 UTC, JG wrote:
Yes, see here:
https://dlang.org/spec/expression.html#specialkeywords
OMG, so that's when they are located! I was trying to search the
spec and find them in different pages but had no luck! Thanks a
lot for the help, have a great day!
On Tuesday, 7 March 2023 at 22:11:49 UTC, rempas wrote:
For example, in the given code:
```d
void my_function() {
import std.stdio;
writeln("The name of the function is: ",
);
}
```
Is there something to put in the place of
`` to get the name of the function?
```
import std.stdio;
On Tuesday, 7 March 2023 at 22:11:49 UTC, rempas wrote:
For example, in the given code:
```d
void my_function() {
import std.stdio;
writeln("The name of the function is: ",
);
}
```
Is there something to put in the place of
`` to get the name of the function?
Yes, see here:
For example, in the given code:
```d
void my_function() {
import std.stdio;
writeln("The name of the function is: ",
);
}
```
Is there something to put in the place of
`` to get the name of the function?
(also known as LATIN-1), ISO-8859-2
(LATIN-2), WINDOWS-1250, WINDOWS-1251 and WINDOWS-1252."
Then what is best way to read GBK/GB18030 contents ? Even
GBK/GB18030 file names ?
I found this:
https://github.com/meatatt/exCode/blob/master/source/excode/package.d
There is mention of u
, ISO-8859-2 (LATIN-2), WINDOWS-1250,
WINDOWS-1251 and WINDOWS-1252."
It appears that encoding is not supported.
There is a scant mention of it, in the BOM detection. But I don't think
there's any mechanism to encode/decode it.
Then what is best way to read GBK/GB18030 contents ? Even G
-1250, WINDOWS-1251 and WINDOWS-1252."
Then what is best way to read GBK/GB18030 contents ? Even
GBK/GB18030 file names ?
On Monday, 13 February 2023 at 18:04:40 UTC, Matt wrote:
Obviously, there is no "set" object in D, but I was wondering
what the quickest way to remove duplicates from an array would
be...
Where did you find out that there is no set() in the D
programming language?
**Simple exampl
On Monday, 13 February 2023 at 18:04:40 UTC, Matt wrote:
Obviously, there is no "set" object in D, but I was wondering
what the quickest way to remove duplicates from an array would
be. I was convinced I'd seen a "unique" method somewhere, but
I've looked throu
ng nicer (see below).
> but I was wondering what the quickest way to remove duplicates from an
> array would be. I was convinced I'd seen a "unique" method somewhere,
> but I've looked through the documentation for std.array, std.algorithm
> AND std.range, and I've either missed i
On 13.02.23 19:04, Matt wrote:
Obviously, there is no "set" object in D, but I was wondering what the
quickest way to remove duplicates from an array would be. I was
convinced I'd seen a "unique" method somewhere, but I've looked through
the documentation for std.
On 2/13/23 1:04 PM, Matt wrote:
Obviously, there is no "set" object in D, but I was wondering what the
quickest way to remove duplicates from an array would be. I was
convinced I'd seen a "unique" method somewhere, but I've looked through
the documentation for std.
Obviously, there is no "set" object in D, but I was wondering
what the quickest way to remove duplicates from an array would
be. I was convinced I'd seen a "unique" method somewhere, but
I've looked through the documentation for std.array,
std.algorithm AND std.range, an
On Friday, 20 January 2023 at 17:15:31 UTC, Quirin Schroll wrote:
Is there a trait (or a combination of traits) that gives me the
constraints of a template?
Apologies, I missed the key part of your question. But I think
the above can be adapted if you were so inclined.
There is a way but it's horrible. You can take the `.stringof`
and parse the result. I knocked this up for something but it's
not well tested and there are probably templates that it handles
incorrectly. I'm not claiming this is any good, I just happened
to have it.
```d
enum
On Friday, 20 January 2023 at 17:15:31 UTC, Quirin Schroll wrote:
For what I want, `constraintsOf` may expect every template
parameter to be a type and to have a constraint.
If I'm not mistaken, the following will help:
https://dlang.org/phobos/std_range_primitives.html
SDB@79=
On Friday, 20 January 2023 at 17:15:31 UTC, Quirin Schroll wrote:
Is there a trait (or a combination of traits) that gives me the
constraints of a template?
No, reflection over templates is very limited.
For what I want, `constraintsOf` may expect every template parameter to
be a type and to have a constraint.
No, there is no way to introspect anything about a template's details
until its instantiated.
-Steve
Is there a trait (or a combination of traits) that gives me the
constraints of a template?
Example:
```D
void f(T1 : long, T2 : const(char)[])(T x) { }
template constraintsOf(alias templ) { /*Magic here*/ }
alias constraints = constraintsOf!f; // tuple(long, const(char)[])
```
At the moment, I
On Friday, 6 January 2023 at 15:31:09 UTC, Salih Dincer wrote:
If you don't want to get the above output you should use the
previous example. But don't forget to connect alias and opCall.
For example, you can use @property in version 2.0.83 without
all the fanfare.
I forgot one thing: if
On Thursday, 5 January 2023 at 23:05:17 UTC, thebluepandabear
wrote:
them or remove them.
I agree, forbidding function call syntax would be a great
usecase for `@property`.
It will probably never get implemented though.
In older versions, it worked when printing values with writeln.
them or remove them.
I agree, forbidding function call syntax would be a great usecase
for `@property`.
It will probably never get implemented though.
push it through the
deprecation process...
... OR come up with a DIP that implements @property in a sane, fully
worked out way, not the half-hearted, incomplete, leaky implementation
that it is today.
//
In my own code, I've stopped bothering with @property for the most part.
Parenthes
On Wednesday, 4 January 2023 at 14:21:46 UTC, bauss wrote:
```d
class Foo {
int bar;
void setBar(Foo foo, int value) {
foo.bar = value;
}
}
void main() {
foo.setBar(100); // Not UFCS - just method call to the class
foo.setBar = 100; // Not UFCS - simply a setter function call
On Wednesday, 4 January 2023 at 14:21:46 UTC, bauss wrote:
On Wednesday, 4 January 2023 at 03:42:28 UTC, thebluepandabear
wrote:
...
My question is: is there a way to enforce UFCS-syntax?
None of your code actually uses UFCS.
This is UFCS:
```
class Foo {
int bar;
}
void setBar(Foo foo
On Wednesday, 4 January 2023 at 03:42:28 UTC, thebluepandabear
wrote:
...
My question is: is there a way to enforce UFCS-syntax?
None of your code actually uses UFCS.
This is UFCS:
```
class Foo {
int bar;
}
void setBar(Foo foo, int value) {
foo.bar = value;
}
void main
> d.name("poodle");
I don't see a problem with that. :)
> I am disappointed that `@property` does not
Many people are disappointed that @property is pretty much useless.
> is there a way to enforce
D gives us the tools to do that but it's not trivial. The function can
retu
ve that it would add to its usefulness. Sometimes throughout
my codebase I get confused and write properties in non-UFCS
syntax, which bugs me a bit.
My question is: is there a way to enforce UFCS-syntax?
for development purposes. is there are correct way to somehow
(partially or complete) override druntime and phobos? or, maybe,
some code injection/patching mechanisms during compilation of own
code.
1 - 100 of 2289 matches
Mail list logo