On 2018-05-22 18:33:06 +, Jacob Carlborg said:
You can always create a function that takes a delegate or lambda and
handles the exception in the function. Here are three versions of the
same thing, depending on how you want the call site to look like.
Hi, great! Thanks for the
Is this a bug or am I missing something?
https://run.dlang.io/is/OGHJYX
Andrea
Some C and C++ projects I am working on use pointers and
references extensively: to pass as function arguments, and to
return from a function. For function argument I would use `ref`,
but for return types, I can't use `ref` and can't return a
pointer. What should be the proper way to handle
Hi All,
Request your help on how to delete a file which has the
extension .fifo (.javast.fifo) in Windows.
From,
Vino.B
On Thursday, 24 May 2018 at 07:47:54 UTC, Andrea Fontana wrote:
Is this a bug or am I missing something?
https://run.dlang.io/is/OGHJYX
Andrea
This line:
mixin("alias tmp = " ~ s ~ ";");
There's no mention of Symbol in there. If you change it to this:
mixin("alias tmp =
On Thursday, 24 May 2018 at 08:48:30 UTC, Andrea Fontana wrote:
This line:
mixin("alias tmp = " ~ s ~ ";");
There's no mention of Symbol in there. If you change it to
this:
mixin("alias tmp = Symbol" ~ s ~ ";");
then suddenly things work.
--
Simen
What?
a dot is
On Thursday, 24 May 2018 at 07:59:08 UTC, Simen Kjærås wrote:
On Thursday, 24 May 2018 at 07:47:54 UTC, Andrea Fontana wrote:
Is this a bug or am I missing something?
https://run.dlang.io/is/OGHJYX
Andrea
This line:
mixin("alias tmp = " ~ s ~ ";");
There's no mention of Symbol in
On Wednesday, 23 May 2018 at 03:12:52 UTC, IntegratedDimensions
wrote:
On Wednesday, 23 May 2018 at 03:00:17 UTC, Nicholas Wilson
wrote:
[...]
I knew someone was going to say that and I forgot to say DON'T!
Saying to profile when I clearly said these ARE cases where
they are slow is just
On Thursday, 24 May 2018 at 08:16:30 UTC, biocyberman wrote:
Some C and C++ projects I am working on use pointers and
references extensively: to pass as function arguments, and to
return from a function. For function argument I would use
`ref`, but for return types, I can't use `ref` and can't
On Thursday, 24 May 2018 at 08:58:02 UTC, Nicholas Wilson wrote:
On Thursday, 24 May 2018 at 08:16:30 UTC, biocyberman wrote:
[...]
it looks like Read is a D class? in which case it already
returns by reference.
If you make Read a struct then all you need do is change the
function signature
On Thursday, 24 May 2018 at 10:23:41 UTC, Andrea Fontana wrote:
On Thursday, 24 May 2018 at 09:17:10 UTC, Alex wrote:
On Thursday, 24 May 2018 at 08:48:30 UTC, Andrea Fontana wrote:
This line:
mixin("alias tmp = " ~ s ~ ";");
There's no mention of Symbol in there. If you change it to
On Thursday, 24 May 2018 at 09:17:10 UTC, Alex wrote:
On Thursday, 24 May 2018 at 08:48:30 UTC, Andrea Fontana wrote:
This line:
mixin("alias tmp = " ~ s ~ ";");
There's no mention of Symbol in there. If you change it to
this:
mixin("alias tmp = Symbol" ~ s ~ ";");
then
I am testing with DMD 2.078.2 locally. This tiny snippet works on
dlang's online editor: https://run.dlang.io/is/nb4IV4
But it does not work on my local dmd.
import std.algorithm.mutation;
import std.stdio;
char[] arr = "hello\U00010143\u0100\U00010143".dup;
writeln(arr.reverse);
Error:
On Thursday, 24 May 2018 at 12:34:38 UTC, Steven Schveighoffer
wrote:
On 5/24/18 8:08 AM, rikki cattermole wrote:
On 25/05/2018 12:06 AM, biocyberman wrote:
I am testing with DMD 2.078.2 locally. This tiny snippet
works on dlang's online editor: https://run.dlang.io/is/nb4IV4
But it does not
On 25/05/2018 12:06 AM, biocyberman wrote:
I am testing with DMD 2.078.2 locally. This tiny snippet works on
dlang's online editor: https://run.dlang.io/is/nb4IV4
But it does not work on my local dmd.
import std.algorithm.mutation;
import std.stdio;
char[] arr =
On 5/24/18 8:08 AM, rikki cattermole wrote:
On 25/05/2018 12:06 AM, biocyberman wrote:
I am testing with DMD 2.078.2 locally. This tiny snippet works on
dlang's online editor: https://run.dlang.io/is/nb4IV4
But it does not work on my local dmd.
import std.algorithm.mutation;
import
On 5/24/18 2:51 PM, Mike Franklin wrote:
Given that the PR above is for object.d, I can't turn the entire
object.d source file into a string and conditionally mix that in. Does
anyone have a solution to this?
My recommendation would have been the last one, but if that doesn't
work, I don't
I'm trying to find a way to declare a block of code `nothrow:`
when compiling with -betterC, but not `nothrow` when not
compiling with -betterC.
The solution is needed for this PR:
https://github.com/dlang/druntime/pull/2184/files#r188627707
Attempt #1
--
void test() { }
On 2018-05-24 08:05, Robert M. Münch wrote:
Hi, great! Thanks for the examples... BTW: Is there a place where such
generic and fundamental examples are collected?
Not as far as I know.
void handleException1(alias dg)()
{
try dg();
catch (Exception e) { /* handle exception */ }
}
On 2018-05-24 11:10, biocyberman wrote:
Thanks for the hints. `Read` in C++ and D are both classes. And the
function is inside the class definition itself.
In that case specifying the type as `Read` is the correct thing to do.
Note that `new` always allocates on the heap and returns a
On Friday, 25 May 2018 at 00:15:39 UTC, IntegratedDimensions
wrote:
On Thursday, 24 May 2018 at 23:31:50 UTC, Alex wrote:
On Thursday, 24 May 2018 at 20:24:32 UTC, IntegratedDimensions
wrote:
class T;
class TT : T;
interface I
{
@property T t();
}
abstract class A
{
T _t;
@property
On Friday, 25 May 2018 at 01:02:00 UTC, Basile B. wrote:
On Friday, 25 May 2018 at 00:15:39 UTC, IntegratedDimensions
wrote:
On Thursday, 24 May 2018 at 23:31:50 UTC, Alex wrote:
On Thursday, 24 May 2018 at 20:24:32 UTC,
IntegratedDimensions wrote:
class T;
class TT : T;
interface I
{
On Thursday, May 24, 2018 19:39:07 Jacob Carlborg via Digitalmars-d-learn
wrote:
> On 2018-05-24 08:05, Robert M. Münch wrote:
> > Hi, great! Thanks for the examples... BTW: Is there a place where such
> > generic and fundamental examples are collected?
>
> Not as far as I know.
>
> >> void
class T;
class TT : T;
interface I
{
@property T t();
}
abstract class A
{
T _t;
@property T t() { return _t; }
}
class C : A
{
// Stuff below uses t as TT but compiler, of course, treats t
as T
...
}
The issue is that I programmed the class C with a variable that
On Friday, 25 May 2018 at 01:17:45 UTC, IntegratedDimensions
wrote:
On Friday, 25 May 2018 at 01:02:00 UTC, Basile B. wrote:
On Friday, 25 May 2018 at 00:15:39 UTC, IntegratedDimensions
wrote:
On Thursday, 24 May 2018 at 23:31:50 UTC, Alex wrote:
On Thursday, 24 May 2018 at 20:24:32 UTC,
On Friday, 25 May 2018 at 01:42:48 UTC, Basile B. wrote:
On Friday, 25 May 2018 at 01:17:45 UTC, IntegratedDimensions
wrote:
On Friday, 25 May 2018 at 01:02:00 UTC, Basile B. wrote:
On Friday, 25 May 2018 at 00:15:39 UTC, IntegratedDimensions
wrote:
On Thursday, 24 May 2018 at 23:31:50 UTC,
On Tuesday, 22 May 2018 at 13:59:16 UTC, Steven Schveighoffer
wrote:
The derailed plan was to leave alone the ability to call no-arg
functions without parentheses, but to REQUIRE @property to call
an argument-taking function with the assignment style.
See the DIP here:
I want to call some of my D code from Python. I'm annotating the
pertinent functions with extern(C) export, as in
module foo;
extern(C) export int initialize() {
return 42;
}
I compile with:
dmd -fPIC -shared ./foo.d
From the Python end, I can load the library using ctypes and the
call
On Thursday, 24 May 2018 at 23:08:29 UTC, Basile B. wrote:
On Thursday, 24 May 2018 at 23:03:21 UTC, aliak wrote:
Hi,
I was essentially trying to do this:
struct S {
void f() {}
}
auto f = S.f; // f becomes void function(S) ??
S s;
f(s);
Is something like that possible?
Cheers,
- Ali
On Thursday, 24 May 2018 at 20:24:32 UTC, IntegratedDimensions
wrote:
class T;
class TT : T;
interface I
{
@property T t();
}
abstract class A
{
T _t;
@property T t() { return _t; }
}
class C : A
{
// Stuff below uses t as TT but compiler, of course, treats
t as T
...
}
int[] a;
int[] b;
()@nogc {
foreach(v ; chain( a,b ) ) printf("%d\n", v);
}();
//Ok, everything fine;
char[] a;
char[] b;
()@nogc {
foreach(v ; chain( a,b ) ) printf("%c\n", v);
}();
//Error: @nogc delegate onlineapp.main.__lambda1 cannot call
non-@nogc function
On Thursday, 24 May 2018 at 23:55:24 UTC, SrMordred wrote:
//Error: @nogc delegate onlineapp.main.__lambda1 cannot call
non-@nogc function std.range.chain!(char[],
char[]).chain.Result.front
Why?
phobos automatically decodes utf8 into dchars. This can throw a
new utf exception.
On Friday, 25 May 2018 at 00:04:10 UTC, Adam D. Ruppe wrote:
On Thursday, 24 May 2018 at 23:55:24 UTC, SrMordred wrote:
//Error: @nogc delegate onlineapp.main.__lambda1 cannot call
non-@nogc function std.range.chain!(char[],
char[]).chain.Result.front
Why?
phobos automatically decodes utf8
On Thursday, 24 May 2018 at 23:31:50 UTC, Alex wrote:
On Thursday, 24 May 2018 at 20:24:32 UTC, IntegratedDimensions
wrote:
class T;
class TT : T;
interface I
{
@property T t();
}
abstract class A
{
T _t;
@property T t() { return _t; }
}
class C : A
{
// Stuff below uses t as
On Friday, May 25, 2018 00:09:28 SrMordred via Digitalmars-d-learn wrote:
> On Friday, 25 May 2018 at 00:04:10 UTC, Adam D. Ruppe wrote:
> > On Thursday, 24 May 2018 at 23:55:24 UTC, SrMordred wrote:
> >> //Error: @nogc delegate onlineapp.main.__lambda1 cannot call
> >> non-@nogc function
On Tuesday, 22 May 2018 at 14:33:20 UTC, Jonathan M Davis wrote:
A free function with a single argument works just fine as a
setter property. e.g. you could do something like
void env(Tuple!(string, string)[] str)
{
// set environment variables
}
env = [tuple("foo", "bar")];
is perfectly
On Thursday, 24 May 2018 at 22:03:38 UTC, aliak wrote:
It feels like the only difference between a no-arg function
that is @property and one that is not is that the former could
be invoked with optional parentheses and the latter should be
illegal with parentheses.
Edit: err... other way
Hi,
I was essentially trying to do this:
struct S {
void f() {}
}
auto f = S.f; // f becomes void function(S) ??
S s;
f(s);
Is something like that possible?
Cheers,
- Ali
On Thursday, 24 May 2018 at 23:03:21 UTC, aliak wrote:
Hi,
I was essentially trying to do this:
struct S {
void f() {}
}
auto f = S.f; // f becomes void function(S) ??
S s;
f(s);
Is something like that possible?
Cheers,
- Ali
Sure:
```
import std.stdio;
void main(string[] args)
{
On Thursday, May 24, 2018 23:55:24 SrMordred via Digitalmars-d-learn wrote:
> int[] a;
> int[] b;
>
> ()@nogc {
> foreach(v ; chain( a,b ) ) printf("%d\n", v);
> }();
>
> //Ok, everything fine;
>
> char[] a;
> char[] b;
>
> ()@nogc {
> foreach(v ; chain( a,b ) ) printf("%c\n", v);
> }();
>
Because arrays of char and wchar are treated as ranges of dchar.
That part that I didnt know, thanks! :)
On Thursday, 24 May 2018 at 10:42:26 UTC, Andrea Fontana wrote:
On Thursday, 24 May 2018 at 10:23:41 UTC, Andrea Fontana wrote:
On Thursday, 24 May 2018 at 09:17:10 UTC, Alex wrote:
On Thursday, 24 May 2018 at 08:48:30 UTC, Andrea Fontana
wrote:
This line:
mixin("alias tmp = " ~ s ~
On Thursday, 24 May 2018 at 06:59:47 UTC, Vino wrote:
Hi All,
Request your help on how to delete a file which has the
extension .fifo (.javast.fifo) in Windows.
From,
Vino.B
What exactly is your issue with it?
43 matches
Mail list logo