On Thursday, 5 March 2020 at 18:33:41 UTC, Adam D. Ruppe wrote:
On Thursday, 5 March 2020 at 14:24:33 UTC, wjoe wrote:
[...]
template opDispatch(string name) {
auto opDispatch(T, Args...)(Args args) {
...
}
}
[...]
NOTE: opDispatch suppresses internal compile errors, it will
On Thursday, 5 March 2020 at 07:01:27 UTC, Виталий Фадеев wrote:
On Thursday, 5 March 2020 at 06:48:53 UTC, Виталий Фадеев wrote:
Searching for beauty code implementation.
Goal is: Create new object with "custom initializer".
"custom initializer" - is function, executed in _ctor, in
object
On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote:
Is it possible change compile time errors to runtime errors in
Dlang?
no
If yes, how can I make it?
if you deactivate all the errors emitted during the semantic then
there are very good chance that the compiler crashes while
On Friday, 6 March 2020 at 12:35:29 UTC, Виталий Фадеев wrote:
Searching info for object casting with checking class type at
runtime.
Like this:
class A
{
//
}
class B
{
int bVar;
}
unittest
{
A a = new A();
A x = cast( A )a; // ok
A x = cast( B )a; // ok, but
On Friday, 6 March 2020 at 11:51:54 UTC, wjoe wrote:
I don't understand this error message. Which type can't be
resolved?
I don't know. It works if you rename the inner one but it
doesn't like eponymous templates like this. I suspect either the
spec subtly doesn't allow it or a compiler
Searching info for object casting with checking class type at
runtime.
Like this:
class A
{
//
}
class B
{
int bVar;
}
unittest
{
A a = new A();
A x = cast( A )a; // ok
A x = cast( B )a; // ok, but unsafe
A x = safeCast( B )a; // throw exception
A x =
On Friday, 6 March 2020 at 05:31:57 UTC, Mathias Lang wrote:
On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote:
Is it possible change compile time errors to runtime errors in
Dlang?
If yes, how can I make it?
No it's not possible, D is a statically typed language.
Why would you want
It's too complex
On 3/6/20 3:45 PM, Виталий Фадеев wrote:
On Friday, 6 March 2020 at 12:35:29 UTC, Виталий Фадеев wrote:
Searching info for object casting with checking class type at runtime.
Like this:
class A
{
//
}
class B
{
int bVar;
}
unittest
{
A a = new A();
A x =
On Friday, 6 March 2020 at 13:03:22 UTC, drug wrote:
Here x will be null. You can use `enforce(x !is null);` if you
want exception.
or since enforce returns it thing, just do
B b = enforce(cast(B) x);
you can also check easily in if statements:
if(auto b = cast(B) x) {
// x was a b, use
On 3/6/20 6:51 AM, wjoe wrote:
On Thursday, 5 March 2020 at 18:33:41 UTC, Adam D. Ruppe wrote:
On Thursday, 5 March 2020 at 14:24:33 UTC, wjoe wrote:
[...]
template opDispatch(string name) {
auto opDispatch(T, Args...)(Args args) {
...
}
}
[...]
NOTE: opDispatch suppresses
On 3/6/20 8:59 AM, Marcone wrote:
On Friday, 6 March 2020 at 05:31:57 UTC, Mathias Lang wrote:
On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote:
Is it possible change compile time errors to runtime errors in Dlang?
If yes, how can I make it?
No it's not possible, D is a statically
On 3/6/20 8:55 AM, Steven Schveighoffer wrote:
Instantiate!(f.opDispatch!fname, Bitmap)("path/to/wallpaper.png")
I realized, this doesn't work. Because f.opDispatch is a `this` call,
but is not called that way in this case.
Adam's way doesn't work either, because the call doesn't use the
On Friday, 6 March 2020 at 14:05:55 UTC, Steven Schveighoffer
wrote:
Adam's way doesn't work either, because the call doesn't use
the alias, but just instantiates opDispatch with the new name!'
oh yikes, how did I not notice that?!
so yeah just kinda screwed. I'd probably suggest at tis point
On Friday, 6 March 2020 at 15:05:56 UTC, wjoe wrote:
But didn't like the string part and that's when I introduced
the alias fn because I figured maybe it's possible to do
something like:
factory.dispatch!(Bitmap.load)(handle, path);
and get the Bitmap part from that alias and hence save the
On Friday, 6 March 2020 at 13:55:25 UTC, Steven Schveighoffer
wrote:
On 3/6/20 6:51 AM, wjoe wrote:
On Thursday, 5 March 2020 at 18:33:41 UTC, Adam D. Ruppe wrote:
On Thursday, 5 March 2020 at 14:24:33 UTC, wjoe wrote:
[...]
template opDispatch(string name) {
auto opDispatch(T,
On 3/6/20 9:42 AM, Steven Schveighoffer wrote:
alias opdispatch(T) = other_name!(name, T);
And obviously, this should be opDispatch with a capital D !
-Steve
On 3/6/20 9:14 AM, Adam D. Ruppe wrote:
On Friday, 6 March 2020 at 14:05:55 UTC, Steven Schveighoffer wrote:
Adam's way doesn't work either, because the call doesn't use the
alias, but just instantiates opDispatch with the new name!'
oh yikes, how did I not notice that?!
so yeah just kinda
On Friday, 6 March 2020 at 14:14:04 UTC, Adam D. Ruppe wrote:
On Friday, 6 March 2020 at 14:05:55 UTC, Steven Schveighoffer
wrote:
Adam's way doesn't work either, because the call doesn't use
the alias, but just instantiates opDispatch with the new name!'
oh yikes, how did I not notice that?!
On Friday, 6 March 2020 at 15:19:39 UTC, Adam D. Ruppe wrote:
On Friday, 6 March 2020 at 15:05:56 UTC, wjoe wrote:
But didn't like the string part and that's when I introduced
the alias fn because I figured maybe it's possible to do
something like:
factory.dispatch!(Bitmap.load)(handle,
On 3/6/20 5:59 AM, Marcone wrote:> On Friday, 6 March 2020 at 05:31:57
UTC, Mathias Lang wrote:
> I'm coming from Python
The fact that errors are delayed until run time is a Python deficiency.
We accept that deficiency because we also accept claimed benefits that
Python brings.
If you want
On Thursday, 5 March 2020 at 16:54:35 UTC, AB wrote:
I am only guessing, but I think the problem is line 87.
Arrays and slices in D contain a length field and thus do not
need to be null terminated.
The foreach at line 96 iterates on all valid indices and thus
in the last iteration you call
21 matches
Mail list logo