What are you stuck at? What was the most difficult features to
understand? etc.
To make it more meaningful, what is your experience with other languages?
Ali
On Wednesday, 11 May 2022 at 05:11:10 UTC, Alexander Zhirov wrote:
dub.settings.json
It's written about it [here](https://dub.pm/settings)
On Tuesday, 10 May 2022 at 22:12:52 UTC, Dennis wrote:
It depends on whether your DMD or LDC installation comes first
in your PATH environment variable. Both ship with a `dub`
executable that uses their compiler as default.
I came across something else like this. Created a
`dub.settings.json`
On Tuesday, 10 May 2022 at 20:50:12 UTC, Alexander Zhirov wrote:
And if there are two compilers in the system - `dmd` and `ldc`,
which compiler chooses `dub.json`?
It depends on whether your DMD or LDC installation comes first in
your PATH environment variable. Both ship with a `dub` executabl
On Tuesday, 10 May 2022 at 20:50:12 UTC, Alexander Zhirov wrote:
On Tuesday, 10 May 2022 at 19:13:21 UTC, Dennis wrote:
It has an example directory:
https://github.com/dlang/dub/tree/master/examples
And if there are two compilers in the system - `dmd` and `ldc`,
which compiler chooses `dub.js
On Tuesday, 10 May 2022 at 19:13:21 UTC, Dennis wrote:
It has an example directory:
https://github.com/dlang/dub/tree/master/examples
And if there are two compilers in the system - `dmd` and `ldc`,
which compiler chooses `dub.json`? And how do I specify the
specific compiler I want?
On Tuesday, 10 May 2022 at 19:13:21 UTC, Dennis wrote:
[snip]
It has an example directory:
https://github.com/dlang/dub/tree/master/examples
If your configuration is missing, you could make a Pull Request
to add it.
So it does. Thanks.
We might also link to that on the dub.pm website.
On Tuesday, 10 May 2022 at 17:19:23 UTC, jmh530 wrote:
It would be nice if dub included a directory of example
configurations for common issues like this.
It has an example directory:
https://github.com/dlang/dub/tree/master/examples
If your configuration is missing, you could make a Pull Re
On Monday, 9 May 2022 at 09:17:06 UTC, Alexander Zhirov wrote:
[snip]
It would be nice if dub included a directory of example
configurations for common issues like this.
On Tue, May 10, 2022 at 04:10:26PM +, Ben Jones via Digitalmars-d-learn
wrote:
> On Tuesday, 10 May 2022 at 16:05:15 UTC, H. S. Teoh wrote:
> > Using wrapper structs, etc., for this is IMO total overkill. Just
> > use an enum for your token types. Something like this would
> > suffice:
>
> T
On Tuesday, 10 May 2022 at 16:05:15 UTC, H. S. Teoh wrote:
Using wrapper structs, etc., for this is IMO total overkill.
Just use an enum for your token types. Something like this
would suffice:
That's basically what sumtype is going to do for me, but
(hopefully) more safely. Also, the token
On Tue, May 10, 2022 at 03:26:28PM +, Ben Jones via Digitalmars-d-learn
wrote:
[...]
> I'm writing a lexer and I'm using sumtype to store any of the token types.
> Some have values associated with them (like brackets and parens which are
> defined as `enum lparen = '('` or whatever) and some a
On 5/10/22 08:40, Salih Dincer wrote:
> void inclusiveRange(T)(T Args...) if(is(T == bool)) {
>assert(0, "\nBoolean type cannot be used!");
> }
Of course, 'static assert' is better there because it will catch the
issue at compile time.
static assert(0, "\nBoolean type cannot be used!"
On Tuesday, 10 May 2022 at 14:42:31 UTC, Ali Çehreli wrote:
What would you like to see instead? [...]
Here that is:
```d
void inclusiveRange(T)(T Args...) if(is(T == bool)) {
assert(0, "\nBoolean type cannot be used!");
}/*
core.exception.AssertError@InclusiveRangev2.d(79):
Boolean type cann
On Tuesday, 10 May 2022 at 05:45:25 UTC, ag0aep6g wrote:
`x` is a type, period.
You can use void initialization to declare values of types that
don't have an `init` value: `x value = void;`
As for an alternative to the brute force `__traits(compiles,
...)`, you can check if `T.init` is a th
On Tuesday, 10 May 2022 at 13:14:20 UTC, Salih Dincer wrote:
must satisfy the following constraint:
That is your type protection here, a constraint.
Alternatively you can put the constraint in a function and make
it more verbose:
```d
bool isAllowedType(T)()
{
static assert(!is(T == bo
On 5/10/22 06:14, Salih Dincer wrote:
> Not compiled, the compiler returns:
What would you like to see instead? The compiler can reject code only by
"not compiling". :)
>> InclusiveRange.d(48): Error: template instance
>> `InclusiveRange.ir!bool` does not match > template declaration
>> `incl
On Tuesday, 10 May 2022 at 12:12:13 UTC, Tejas wrote:
Using aliases as parameters doesn't work(and the DIP that
wanted to have this behaviour was de facto rejected)
https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1023.md
No, it wasn't rejected. The author decided it needed reworkin
On Tuesday, 10 May 2022 at 12:56:50 UTC, frame wrote:
On Tuesday, 10 May 2022 at 09:26:46 UTC, Salih Dincer wrote:
However, the compiler catches other errors! How can I solve
this problem?
Thanks...
SDB@79
What about something like this?
```d
auto inclusiveRange(T = int)(T f = T(0), T l =
On Tuesday, 10 May 2022 at 12:12:13 UTC, Tejas wrote:
Using aliases as parameters doesn't work(and the DIP that
wanted to have this behaviour was de facto rejected)
https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1023.md
But considering you're passing it as an argument, not a formal
On Tuesday, 10 May 2022 at 09:26:46 UTC, Salih Dincer wrote:
However, the compiler catches other errors! How can I solve
this problem?
Thanks...
SDB@79
What about something like this?
```d
auto inclusiveRange(T = int)(T f = T(0), T l = T(0), T s = T(1))
if(!is(T == bool))
{
//...
}
```
On Tuesday, 10 May 2022 at 11:33:24 UTC, frame wrote:
On Tuesday, 10 May 2022 at 11:26:44 UTC, frame wrote:
On Tuesday, 10 May 2022 at 03:18:14 UTC, Tejas wrote:
Can you try
Makes no difference.
OK, I tried it in separate test and works. Weird, I already
tried that before, there must be s
On Tuesday, 10 May 2022 at 11:26:44 UTC, frame wrote:
On Tuesday, 10 May 2022 at 03:18:14 UTC, Tejas wrote:
Can you try
Makes no difference.
OK, I tried it in separate test and works. Weird, I already tried
that before, there must be something wrong with my other template.
Thanks
On Tuesday, 10 May 2022 at 03:18:14 UTC, Tejas wrote:
Can you try
Makes no difference.
Hi All,
The problem is that I want to disable the use of boolean type.
But this is not possible with contract programming or otherwise.
Actually, it's possible to fix it with contract programming or
otherwise throwing errors.
```d
alias ir = inclusiveRange;
auto inclusiveRange(T = int)(T f =
On Tuesday, 10 May 2022 at 07:18:53 UTC, Salih Dincer wrote:
But I still have a little more patience :)
It gives an error when the exclamation mark is removed, I have no
objections. But typing long instead of char also gives an error!
```d
void main()
{
alias T = char;
import std.traits
On Tuesday, 10 May 2022 at 04:30:28 UTC, Ali Çehreli wrote:
I just found something that looked like a workaround. I don't
know whether it is by design or by accident or whether this
exercise exposes a compiler or language bug. Sorry... :)
I can't exactly use the is(T == char) or is(T : char) c
27 matches
Mail list logo