On Fri, Jan 20, 2023 at 01:32:22PM -0800, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 1/20/23 07:01, torhu wrote:
>
> > But why not have drawLine just be a free function?
>
> Exactly.
>
> If I'm not mistaken, and please teach me if I am wrong, they are
> practically free functions in Java
On 1/20/23 07:01, torhu wrote:
> But why not have drawLine just be a free function?
Exactly.
If I'm not mistaken, and please teach me if I am wrong, they are
practically free functions in Java as well. That Java class is working
as a namespace. So, the function above is the same as the
On Friday, 20 January 2023 at 18:58:16 UTC, seany wrote:
Hi I am googling to find some vibe.d and mongoDB tutorial. Are
their some available? Thank you
There is a nice book, titled D Web Development, that despite
being 6 years old, is still mostly applicable to using vibe.d.
The only
On Friday, 20 January 2023 at 18:58:16 UTC, seany wrote:
Hi I am googling to find some vibe.d and mongoDB tutorial. Are
their some available? Thank you
There's a couple of examples like this one in main vibe repo in
the examples directory:
Hi I am googling to find some vibe.d and mongoDB tutorial. Are
their some available? Thank you
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.
On 1/20/23 12:15 PM, Quirin Schroll wrote:
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; //
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 Fri, Jan 20, 2023 at 12:49:54PM +, Ruby The Roobster via
Digitalmars-d-learn wrote:
[...]
> Thank you. I didn't know that there was such a property `.array`.
It's not a property, it's a Phobos function from std.array.
T
--
INTEL = Only half of "intelligence".
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear
wrote:
Hi,
In Java/C# you can create purely static classes.
These are classes whose methods are all static, the classes
cannot be derived from or instantiated:
```
static class Algo {
void drawLine(Canvas c, Pos from, Pos to)
On 1/20/23 6:28 AM, thebluepandabear wrote:
This type of semantics is not possible in D, which sucks.
Well, static methods do exactly this.
If you want to disable class creation, then use `@disable this();`, if
you want to make all methods static, put `static:` at the top of the class.
On Friday, 20 January 2023 at 13:38:52 UTC, Hipreme wrote:
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear
wrote:
...
[snip]
With a single file, you can do:
```d
final class Algo
{
@disable this();
static:
void drawLine(...){}
}
```
This also works, but it
On Friday, 20 January 2023 at 13:38:47 UTC, evilrat wrote:
On Friday, 20 January 2023 at 13:17:05 UTC, Ruby The Roobster
...
[snip]
Also there is various import options such as renamed import or
static import(doesn't add module to a scope thus requiring to
fully qualify it)
static import,
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear
wrote:
Hi,
In Java/C# you can create purely static classes.
These are classes whose methods are all static, the classes
cannot be derived from or instantiated:
```
static class Algo {
void drawLine(Canvas c, Pos from, Pos to)
On Friday, 20 January 2023 at 13:17:05 UTC, Ruby The Roobster
wrote:
On Friday, 20 January 2023 at 13:03:18 UTC, thebluepandabear
wrote:
ll
a function without instantiating said class, as functions act
on the class object.
Ok, thanks.
I think D should implement something similar to `static
On Friday, 20 January 2023 at 13:03:18 UTC, thebluepandabear
wrote:
ll
a function without instantiating said class, as functions act
on the class object.
Ok, thanks.
I think D should implement something similar to `static class`
but I doubt it will happen.
D isn't Java, and never will be.
ll
a function without instantiating said class, as functions act
on the class object.
Ok, thanks.
I think D should implement something similar to `static class`
but I doubt it will happen.
On Friday, 20 January 2023 at 12:55:37 UTC, Ruby The Roobster
wrote:
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear ...
There is no way to implement that functionality in D. `final`
means that the class cannot be extended, and `abstract`
requires that only an extension of said
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear
wrote:
Hi,
In Java/C# you can create purely static classes.
These are classes whose methods are all static, the classes
cannot be derived from or instantiated:
```
static class Algo {
void drawLine(Canvas c, Pos from, Pos to)
On Friday, 20 January 2023 at 03:39:48 UTC, H. S. Teoh wrote:
On Fri, Jan 20, 2023 at 03:34:43AM +, Ruby The Roobster via
Digitalmars-d-learn wrote:
On Friday, 20 January 2023 at 03:30:56 UTC, Steven
Schveighoffer wrote:
> On 1/19/23 10:11 PM, Ruby The Roobster wrote:
> ...
>
> The point
On Friday, 20 January 2023 at 04:46:07 UTC, Ali Çehreli wrote:
Different instantiations of templates are distinct types. For
example, if I called 'alternate' with two 'long' values, both
alternate!int (as instantiated by the code above) and
alternate!long would have different MyResult struct
Hi,
In Java/C# you can create purely static classes.
These are classes whose methods are all static, the classes
cannot be derived from or instantiated:
```
static class Algo {
void drawLine(Canvas c, Pos from, Pos to) { .. };
}
```
Class in use:
```
Algo.drawLine(new Canvas(), new
23 matches
Mail list logo