On Saturday, 14 August 2021 at 04:09:34 UTC, Tejas wrote:
[...]
Oh right, the ```.``` operator will reference variable in the
_module_ scope, not just the _immediate outer scope_,
you can use the module name to disambiguate as well. To extend
Mike answer, the general rule is that if you can d
On Friday, 13 August 2021 at 23:33:05 UTC, Paul Backus wrote:
On Friday, 13 August 2021 at 23:23:55 UTC, Marcone wrote:
writeln("Hello World!"[x.indexOf("e")..x.indexOf("r")]);
indexOf()is just a simple example, not the goal. I want handle
literal inside [] like it bellow, but in literal:
s
Today I stumbled across three issues with partial initialization
of "static" arrays:
~~~i1.d
void main ()
{
char [7] b = [ 1: 'x' ]; // okay
char [7] a = [ 0: 'x' ]; // i1.d(4): Error: mismatched array
lengths, 7 and 1
}
~~~
~~~i2.d
import std.stdio;
void main ()
{
char [7] c7 = [ 1
On Saturday, 14 August 2021 at 08:23:20 UTC, user1234 wrote:
On Saturday, 14 August 2021 at 04:09:34 UTC, Tejas wrote:
[...]
Oh right, the ```.``` operator will reference variable in the
_module_ scope, not just the _immediate outer scope_,
you can use the module name to disambiguate as well.
What is the drawback of the following "simple" ```@nogc```
exception creation technique?
```d
import std;
void main()@nogc
{
try{
__gshared a = new Exception("help");
scope b = a;
throw b;
}
catch(Exception e){
printf("caught");
}
}
```
On Saturday, 14 August 2021 at 09:40:54 UTC, kdevel wrote:
Today I stumbled across three issues with partial
initialization of "static" arrays:
~~~i1.d
void main ()
{
char [7] b = [ 1: 'x' ]; // okay
char [7] a = [ 0: 'x' ]; // i1.d(4): Error: mismatched array
lengths, 7 and 1
}
~~~
~~
On Saturday, 14 August 2021 at 09:40:54 UTC, kdevel wrote:
Shall I file them to bugzilla?
I would say case 2 and 3 are not bugs. It's just the element type
conversion and mismatched lengths of the ranges.
Not sure about the first one.
On Saturday, 14 August 2021 at 13:01:13 UTC, frame wrote:
On Saturday, 14 August 2021 at 09:40:54 UTC, kdevel wrote:
Shall I file them to bugzilla?
I would say case 2 and 3 are not bugs. It's just the element
type conversion and mismatched lengths of the ranges.
Not sure about the first on
On Saturday, 14 August 2021 at 11:41:36 UTC, Tejas wrote:
What is the drawback of the following "simple" ```@nogc```
exception creation technique?
```d
import std;
void main()@nogc
{
try{
__gshared a = new Exception("help");
scope b = a;
throw b;
}
catch(Exce
On Saturday, 14 August 2021 at 13:01:13 UTC, frame wrote:
I would say case [...] 3 is not [a bug]. It's just the element
type conversion and mismatched lengths of the ranges.
~~~
char [7] d7 = "x"; // okay
string s = "x";
char [7] c7 = s; // throws RangeError
~~~
What justifies that
On Saturday, 14 August 2021 at 14:04:47 UTC, kdevel wrote:
On Saturday, 14 August 2021 at 13:01:13 UTC, frame wrote:
I would say case [...] 3 is not [a bug]. It's just the element
type conversion and mismatched lengths of the ranges.
~~~
char [7] d7 = "x"; // okay
string s = "x";
cha
On Saturday, 14 August 2021 at 14:18:57 UTC, Tejas wrote:
On Saturday, 14 August 2021 at 14:04:47 UTC, kdevel wrote:
On Saturday, 14 August 2021 at 13:01:13 UTC, frame wrote:
I would say case [...] 3 is not [a bug]. It's just the
element type conversion and mismatched lengths of the ranges.
~
On Saturday, 14 August 2021 at 14:33:42 UTC, kdevel wrote:
On Saturday, 14 August 2021 at 14:18:57 UTC, Tejas wrote:
On Saturday, 14 August 2021 at 14:04:47 UTC, kdevel wrote:
On Saturday, 14 August 2021 at 13:01:13 UTC, frame wrote:
I would say case [...] 3 is not [a bug]. It's just the
eleme
On Saturday, 14 August 2021 at 13:24:22 UTC, Tejas wrote:
...
I don't think there are any gotchas here. The problem with this
technique, is when your exceptions aren't just simple labels but
also carry some additional data, say for example specific error
type, and subject that, caused this.
On Saturday, 14 August 2021 at 08:24:41 UTC, user1234 wrote:
On Friday, 13 August 2021 at 23:33:05 UTC, Paul Backus wrote:
On Friday, 13 August 2021 at 23:23:55 UTC, Marcone wrote:
writeln("Hello World!"[x.indexOf("e")..x.indexOf("r")]);
indexOf()is just a simple example, not the goal. I want
On Saturday, 14 August 2021 at 15:28:36 UTC, Alexandru Ermicioi
wrote:
On Saturday, 14 August 2021 at 13:24:22 UTC, Tejas wrote:
...
I don't think there are any gotchas here. The problem with this
technique, is when your exceptions aren't just simple labels
but also carry some additional dat
On Saturday, 14 August 2021 at 14:04:47 UTC, kdevel wrote:
On Saturday, 14 August 2021 at 13:01:13 UTC, frame wrote:
I would say case [...] 3 is not [a bug]. It's just the element
type conversion and mismatched lengths of the ranges.
~~~
char [7] d7 = "x"; // okay
string s = "x";
cha
Good Evening/Day,
Suppose I have a number of function templates that each take
two types, say S and T.
I would like to exercise my routines over the combinations
of types:
set of all S: ( double[], float[], Complex!double[],
Complex!float[])
set of all T: ( double, float)
Is something alon
On Saturday, 14 August 2021 at 20:07:21 UTC, james.p.leblanc
wrote:
Good Evening/Day,
Suppose I have a number of function templates that each take
two types, say S and T.
I would like to exercise my routines over the combinations
of types:
set of all S: ( double[], float[], Complex!double[],
On Saturday, 14 August 2021 at 20:20:01 UTC, Stefan Koch wrote:
On Saturday, 14 August 2021 at 20:07:21 UTC, james.p.leblanc
wrote:
mes
it is possible
look for `AliasSeq`
in `std.meta`
foreach(T; AliasSeq!(float, double))
{
...
}
Stefan,
Thanks very much for your help here ... I had no
```
struct S {
int x = 1234;
}
void main() {
import std.stdio;
S s;
//construction of a using &(s.x)
auto a = Ref!(int)(&s.x);
writeln(a); //displays 1234
s.x += 1;
writeln(a); //displays 1235
a += 1;
writeln(s.x); //displays 1236
}
struct Ref(T) {
T* ptr;
this(T*
On Saturday, 14 August 2021 at 14:04:47 UTC, kdevel wrote:
~~~
char [7] d7 = "x"; // okay
string s = "x";
char [7] c7 = s; // throws RangeError
~~~
What justifies that the compiler behaves differently on two
terms ('s', '"x"') which are of equal size, type, length and
value?
Litera
On Saturday, 14 August 2021 at 15:58:17 UTC, Tejas wrote:
If you're willing to help further, would you please tell me why
there is a GC allocation in the code below that uses
```emplace```? Will such code truly work if GC is never linked
in the program?
https://run.dlang.io/is/XEc2WJ
```
onl
On 8/14/21 4:41 AM, Tejas wrote:
> What is the drawback of the following "simple" ```@nogc``` exception
> creation technique?
>
> ```d
> import std;
> void main()@nogc
> {
> try{
> __gshared a = new Exception("help");
> scope b = a;
> throw b;
> }
> catch
On Saturday, 14 August 2021 at 23:14:51 UTC, Paul Backus wrote:
On Saturday, 14 August 2021 at 15:58:17 UTC, Tejas wrote:
If you're willing to help further, would you please tell me
why there is a GC allocation in the code below that uses
```emplace```? Will such code truly work if GC is never
On Sunday, 15 August 2021 at 00:15:32 UTC, Ali Çehreli wrote:
On 8/14/21 4:41 AM, Tejas wrote:
> [...]
exception
> [...]
So, there would be many exception objects one for each place
that an exception can be thrown. Functions like enforce() would
have to take a reference to the exception objec
On Sunday, 15 August 2021 at 02:09:08 UTC, Tejas wrote:
On Sunday, 15 August 2021 at 00:15:32 UTC, Ali Çehreli wrote:
On 8/14/21 4:41 AM, Tejas wrote:
> [...]
exception
> [...]
So, there would be many exception objects one for each place
that an exception can be thrown. Functions like enforce
On Sunday, 15 August 2021 at 02:09:08 UTC, Tejas wrote:
On Sunday, 15 August 2021 at 00:15:32 UTC, Ali Çehreli wrote:
On 8/14/21 4:41 AM, Tejas wrote:
> [...]
exception
> [...]
So, there would be many exception objects one for each place
that an exception can be thrown. Functions like enforce
On Sunday, 15 August 2021 at 03:45:07 UTC, Mathias LANG wrote:
On Sunday, 15 August 2021 at 02:09:08 UTC, Tejas wrote:
[...]
You can't really have `@nogc` allocated Exception without
circumventing the type system. Personally I gave up on `@nogc`
just because of how inconvenient it is.
[...
So when I'm doing something like the following: `string name =
"John";`
Then what's the actual type of the literal `"John"`?
In the chapter [Calling C
functions](https://dlang.org/spec/interfaceToC.html#calling_c_functions) in the "Interfacing with C" page, the following is said:
Strings are not
30 matches
Mail list logo