On 7/15/21 5:46 PM, Ali Çehreli wrote:
> On 7/15/21 11:24 AM, Tejas wrote:
> > package(qualifiedIdentifier)
> Just don't do it
Ok, I said all that before realizing what you needed with transpiling
C++ to D and the solution of package(qualifiedIdentifier). (And
package(qualifiedIdentifier)
On 7/15/21 11:24 AM, Tejas wrote:
> it seems like seperating chunks of C++ code into seperate modules
> and using the
> ```d
> package(qualifiedIdentifier)
> ```
> access specifier seems to be the way to go.
That would be necessary if one agreed with C++'s 'private' to begin
with. In other
On Thursday, 15 July 2021 at 21:23:58 UTC, H. S. Teoh wrote:
My personal favorite approach to D template functions is to not
think of them as templates in the first place, but rather as
functions with *compile-time* parameters (in addition to the
usual runtime parameters).
Thanks - that
On Thu, Jul 15, 2021 at 08:24:57PM +, Scotpip via Digitalmars-d-learn wrote:
[...]
> For starters, it's now clear to me that a strong understanding of
> Templates is essential to make much headway - that's why I got stuck
> here. They are dealt with towards the back of the books, but you
>
Outstanding answers, folks. This is a great community!
If I ever manage to get on top of this cussed language, I hope to
reciprocate by posting some material aimed at newbies coming from
areas like line-of-business with scripting languages, which is
where I've done most of my coding. This is
On Thursday, 15 July 2021 at 18:08:45 UTC, Scotpip wrote:
The relevant function appears to be
[std.stdio.File.byLine](https://dlang.org/library/std/stdio/file.by_line.html).
The default isn't breaking the lines properly, so I have to
pass in the line ending. But the signature has me baffled:
On Thu, Jul 15, 2021 at 06:08:45PM +, Scotpip via Digitalmars-d-learn wrote:
[...]
> ```
> auto byLine(Terminator, Char) (
> KeepTerminator keepTerminator = No.keepTerminator,
> Terminator terminator = '\x0a'
> )
> if (isScalarType!Terminator);
>
> auto byLine(Terminator, Char) (
>
On Thursday, 15 July 2021 at 18:36:30 UTC, Tejas wrote:
Sorry I'm on mobile right now so can't help much, but if you're
a beginner, please read the book "programming in D" by Ali
Cehreli.
http://ddili.org/ders/d.en/
If you just want to learn about files for now, visit this link,
it
On Thursday, 15 July 2021 at 18:08:45 UTC, Scotpip wrote:
Hi folks
Settling down to write my first app but have come to a grinding
halt. This is my first system-level language so I'm afraid I'll
be asking some naïve questions.
All I'm trying to do is read a text file with Windows line
On Thursday, 15 July 2021 at 18:06:26 UTC, Steven Schveighoffer
wrote:
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
On Thursday, 15 July 2021 at 18:11:30 UTC, evilrat wrote:
On Thursday, 15 July 2021 at 17:49:06 UTC, Tejas wrote:
I'm sorry, I should've explicitly mentioned I'm interested in
learning how to do friend injection in D.
I know that access specifiers operate at module scope, seen a
few posts
On Thursday, 15 July 2021 at 17:49:06 UTC, Tejas wrote:
I'm sorry, I should've explicitly mentioned I'm interested in
learning how to do friend injection in D.
I know that access specifiers operate at module scope, seen a
few posts about that here already.
Thank you for answering though.
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
Hi folks
Settling down to write my first app but have come to a grinding
halt. This is my first system-level language so I'm afraid I'll
be asking some naïve questions.
All I'm trying to do is read a text file with Windows line
endings into an array for line-by-line processing.
The
On Thursday, 15 July 2021 at 17:30:05 UTC, jfondren wrote:
On Thursday, 15 July 2021 at 17:21:45 UTC, Tejas wrote:
I can do it like this in C++:
```
template
class def
{
friend typename abc;
}
```
I am just hopelessly confused on how to achieve the same in D.
Uncharitably: D is a
If, however, you're trying to inject friend access to something
outside def's module, then you might want to reconsider what
you're trying to accomplish and whether it can be done
differently.
Was just dreaming of how to transpile C++ code to D :(
Curiously enough, friend injection
On Thursday, 15 July 2021 at 17:26:41 UTC, Adam D Ruppe wrote:
On Thursday, 15 July 2021 at 17:21:45 UTC, Tejas wrote:
I can do it like this in C++:
You don't just put class def and class abc in the same module
and you get the same effect though.
I really should've just posted the whole
On Thursday, 15 July 2021 at 17:21:45 UTC, Tejas wrote:
I can do it like this in C++:
```
template
class def
{
friend typename abc;
}
```
I am just hopelessly confused on how to achieve the same in D.
Uncharitably: D is a friendless language. Charitably: D is so
much more friendly that
On Thu, Jul 15, 2021 at 05:21:45PM +, Tejas via Digitalmars-d-learn wrote:
> I can do it like this in C++:
> ```
> template
> class def
> {
> friend typename abc;
> }
> ```
>
> I am just hopelessly confused on how to achieve the same in D.
D does not have `friend` declarations.
On Thursday, 15 July 2021 at 17:21:45 UTC, Tejas wrote:
I can do it like this in C++:
You don't just put class def and class abc in the same module and
you get the same effect though.
I can do it like this in C++:
```
template
class def
{
friend typename abc;
}
```
I am just hopelessly confused on how to achieve the same in D.
On Thursday, 15 July 2021 at 13:28:19 UTC, wjoe wrote:
On Thursday, 15 July 2021 at 12:09:20 UTC, Tejas wrote:
[...]
The only way, for me, to explain the error message ```opIndex
isn't an lvalue and can't be modified.``` for ```i[1]++``` is
that the compiler rewrites to
```D
(auto e =
On Thursday, 15 July 2021 at 12:09:20 UTC, Tejas wrote:
[...]
Oh yes, that is what happens. I was trying to be a little
concise.
You are correct, this is what the code will look in the gory
details (I believe) :
```d
auto x = (auto e = i.opIndex(1), i.opIndexUnary("++")(1)/*this
may or may
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
On Thursday, 15 July 2021 at 11:08:25 UTC, Per Nordlöw wrote:
The adding of copy construtors to `Service` defined as
```d
@safe struct Service {
this(ref return scope typeof(this) rhs) {}
this(const ref return scope typeof(this) rhs) const {}
}
@safe struct Session {
void
On Thursday, 15 July 2021 at 11:02:17 UTC, wjoe wrote:
On Thursday, 15 July 2021 at 04:07:49 UTC, Tejas wrote:
Your code
```d
auto x = i[1]++;
```
Expands to:
```d
auto x = (auto e = i[1]/*notice opIndex*/, ++i[1]/* notice
opIndexUnary*/, return e;);
```
This doesn't happen with pre
On Thursday, 15 July 2021 at 11:08:25 UTC, Per Nordlöw wrote:
The adding of copy construtors to `Service` defined as
```d
@safe struct Service {
this(ref return scope typeof(this) rhs) {}
this(const ref return scope typeof(this) rhs) const {}
}
Using `inout` as
```d
@safe struct
On Wednesday, 14 July 2021 at 17:29:04 UTC, Ali Çehreli wrote:
On 7/14/21 2:44 AM, wjoe wrote:
>> x = (x ^^ y).to!(typeof(x));
>> }
>>
>> For example, run-time error if y == 7.
> I was planning on adding support for over-/underflow bits but
this is
> much better. Thanks!
If so, then there
On Thursday, 15 July 2021 at 11:08:25 UTC, Per Nordlöw wrote:
fails in the same way. What's wrong?
```d
@safe struct Service {
this(ref typeof(this) rhs) {}
this(const ref typeof(this) rhs) const {}
}
```
also fails. On the other hand, using a postblit as
```
@safe struct Service {
The adding of copy construtors to `Service` defined as
```d
@safe struct Service {
this(ref return scope typeof(this) rhs) {}
this(const ref return scope typeof(this) rhs) const {}
}
@safe struct Session {
void openAndGetService(in string key) scope {
import
Different doc generators, same source.
DDOC (phobos) and DDOX (library).
There is also adrdox[0] whose site does dub libraries also.
[0] https://dpldocs.info/
On Thursday, 15 July 2021 at 04:07:49 UTC, Tejas wrote:
Your code
```d
auto x = i[1]++;
```
Expands to:
```d
auto x = (auto e = i[1]/*notice opIndex*/, ++i[1]/* notice
opIndexUnary*/, return e;);
```
This doesn't happen with pre increment. No compiler shenanigans.
Interesting to see it
On Thursday, 15 July 2021 at 04:01:15 UTC, Tejas wrote:
I'm so sorry all this was basically useless for you.
I can't spend more time on this, so as a last resort I leave
you this:
https://dlang.org/phobos/std_bitmanip.html
This is the official bit manipulation standard library, maybe
it
What is the relationship between
https://dlang.org/library/
and
https://dlang.org/phobos/index.html
34 matches
Mail list logo