I have a class that I want to be able to register callbacks and
I'd like to be able to register any callable - functions,
delegates, lambdas, anything.
Is there another way to do it besides converting those
toDelegate, which states a bug with @safe functions?
Or better store each type in
On Friday, 4 May 2018 at 15:30:26 UTC, Vino wrote:
On Friday, 4 May 2018 at 15:16:23 UTC, wjoe wrote:
[...]
Hi Wjoe,
Thank you very much, but what i am expecting is something
like OS switch, based of OS type switch the funciton eg:
If OS is windows use the funciton timeCreated else if
On Friday, 4 May 2018 at 14:24:36 UTC, Vino wrote:
On Friday, 4 May 2018 at 14:02:24 UTC, Jonathan M Davis wrote:
On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn
wrote:
On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote:
> What are you actually trying to do with it? These
Thanks for replying.
On Friday, 4 May 2018 at 19:12:16 UTC, ag0aep6g wrote:
On 05/04/2018 06:33 PM, Neia Neutuladh wrote:
auto asDelegate(TFunc)(TFunc func) @trusted
{
import std.functional : toDelegate;
return toDelegate(func);
}
The "@trusted" means that you promise this thing is
Thanks for replying.
On Saturday, 5 May 2018 at 00:30:35 UTC, Neia Neutuladh wrote:
On Friday, 4 May 2018 at 19:12:16 UTC, ag0aep6g wrote:
[...] If it's a user-defined type with opCall, that's something
to pay attention to, but it's beyond the scope of the original
question.
Actually it's
On Monday, 7 May 2018 at 10:20:22 UTC, ag0aep6g wrote:
On 05/07/2018 04:41 AM, wjoe wrote:
Could you elaborate on the unsafe destructor please?
If TFunc has an unsafe destructor, asDelegate is also not safe
and can't be @trusted.
An example of how that can break safety:
auto
On Friday, 4 May 2018 at 15:42:56 UTC, wjoe wrote:
I think that's not possible. You can't query information that
hasn't been stored.
I stand corrected.
As Russel Winder points out there are file systems that store
this information and since Linux 4.11 you can query it via
statx(2).
On Saturday, 16 June 2018 at 21:25:01 UTC, Jonathan M Davis wrote:
On Saturday, June 16, 2018 18:45:53 wjoe via
Digitalmars-d-learn wrote:
What you said earlier:
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis
wrote:
> [...]
>
> 2. If the compiler knows that a function ca
On Tuesday, 12 June 2018 at 18:41:07 UTC, Jonathan M Davis wrote:
On Tuesday, June 12, 2018 17:38:07 wjoe via Digitalmars-d-learn
wrote:
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis
wrote:
> On Sunday, June 10, 2018 23:59:17 Bauss via
> Digitalmars-d-learn
> wrote:
On Wednesday, 13 June 2018 at 03:14:33 UTC, Jonathan M Davis
wrote:
Most programs do not handle the case where they run out of
memory and cannot continue at that point. For better or worse,
D's GC was designed with that in mind, and it treats failed
allocations as an Error. In the vast
On Wednesday, 13 June 2018 at 13:05:44 UTC, Kagamin wrote:
On Wednesday, 13 June 2018 at 10:56:41 UTC, wjoe wrote:
I understand the idea that an Error is not supposed to be
caught but why would such a 'feature' be desirable? Where's
the benefit if nothing can be relied upon ?
It's a
On Wednesday, 13 June 2018 at 12:59:27 UTC, Kagamin wrote:
On Wednesday, 13 June 2018 at 02:02:54 UTC, wjoe wrote:
it is possible to install a signal handler for almost every
signal on POSIX, including segfault. The only signal you can't
catch is signal 9 - sigkill if memory serves.
So I could
On Tuesday, 12 June 2018 at 15:48:58 UTC, Bauss wrote:
Ex.
int a = array[400];
Could yield a warning stating a possible a out of bounds error.
Where:
int a = array.length >= 401 ? array[400] : 0;
looks to me like a crash guard. Similar to something like this
void fn(Foo* foo)
{
if
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote:
On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn
wrote:
Errors are supposed to kill the program, not get caught. As
such, why does it matter if it can throw an Error?
Now, personally, I'm increasingly of the
On Wednesday, 13 June 2018 at 20:08:06 UTC, Jonathan M Davis
wrote:
On Wednesday, June 13, 2018 10:56:41 wjoe via
Digitalmars-d-learn wrote:
On Wednesday, 13 June 2018 at 03:14:33 UTC, Jonathan M Davis
> regardless of whether the decision to treat failed memory
> allocations as an
On Thursday, 14 June 2018 at 22:27:42 UTC, bauss wrote:
On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis
wrote:
So in case of a thrown Error, you can catch it and log it to a
database.
No, you can't. Once the Error was thrown the program is in
invalid state and you can't assume
On Friday, 15 June 2018 at 17:27:13 UTC, bauss wrote:
On Friday, 15 June 2018 at 17:25:18 UTC, wjoe wrote:
On Thursday, 14 June 2018 at 22:27:42 UTC, bauss wrote:
On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis
wrote:
So in case of a thrown Error, you can catch it and log it to
a
On Friday, 15 June 2018 at 08:13:44 UTC, Kagamin wrote:
On Wednesday, 13 June 2018 at 17:08:26 UTC, wjoe wrote:
My question was more like what's the benefit of having thrown
Errors corrupt your program state rendering it useless for
debugging ?
D allows various levels of performance and
On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote:
On Thursday, June 14, 2018 18:11:20 wjoe via
Digitalmars-d-learn wrote:
On Wednesday, 13 June 2018 at 20:08:06 UTC, Jonathan M Davis
wrote:
> On Wednesday, June 13, 2018 10:56:41 wjoe via
> The idea is that because your p
Hello,
I'm not sure if this belongs here, so, sorry if it doesn't.
The problem I have is this as follows:
given...
...a C library, let's call it libfoo, which implements an API
...a D library, libbar, which wraps the libfoo API and provides
some additional convenience functions; in the DUB
On Thursday, 21 June 2018 at 19:52:25 UTC, Jonathan M Davis wrote:
On Thursday, June 21, 2018 13:16:28 wjoe via
Digitalmars-d-learn wrote:
On Wednesday, 20 June 2018 at 12:22:33 UTC, Kagamin wrote:
> Do you know how to extract information from it on an
> unfamiliar OS? Reading stack
On Tuesday, 19 June 2018 at 12:26:15 UTC, Kagamin wrote:
On Friday, 15 June 2018 at 17:46:02 UTC, wjoe wrote:
D allows various levels of performance and safety. Though I'd
say Errors not working in debug mode is not intended, the
Intention matters not. By definition all program state is
On Wednesday, 20 June 2018 at 12:22:33 UTC, Kagamin wrote:
On Tuesday, 19 June 2018 at 15:03:49 UTC, wjoe wrote:
But maybe I missed something else and the only purpose of D is
to make console applications for *NIX like OSs and expect
users to be professional enough to save that stack trace
On Monday, 18 June 2018 at 20:23:48 UTC, Jonathan M Davis wrote:
On Monday, June 18, 2018 15:22:48 wjoe via Digitalmars-d-learn
wrote:
On Saturday, 16 June 2018 at 21:25:01 UTC, Jonathan M Davis
wrote:
> every feature that you can't use in betterC is considered a
> loss, and efforts are
I want to include subPackages depending either on the presence of
command line options, or the availability of dependencies; think
Gentoo USE flags.
As far as I can tell it's not possible to specify configurations
in a modular way, e.g.
dub --config=withGUI --config=supportGTK
On Monday, 8 April 2019 at 12:16:13 UTC, Adam D. Ruppe wrote:
On Monday, 8 April 2019 at 11:58:49 UTC, Ron Tarrant wrote:
And while I'm asking, does an underscore have special meaning
when used either at the beginning or end of a variable name?
Nothing special there, you are allowed to use
On Thursday, 16 May 2019 at 15:52:05 UTC, Steven Schveighoffer
wrote:
On 5/16/19 4:27 PM, Vladimir Panteleev wrote:
On Thursday, 16 May 2019 at 15:19:03 UTC, Alex wrote:
What's an hnsec anyways?
Hecto-nano-second, the smallest representable unit of time in
SysTime and Duration.
The
On Thursday, 9 May 2019 at 10:09:23 UTC, Cym13 wrote:
Hi,
this is likely not related to D itself but hopefully someone
can help me with this since I'm rather new to windows
programming, I mainly work on linux. I'm trying to bundle a DLL
in a binary, write it in a temp folder, use it and
On Thursday, 27 June 2019 at 17:05:05 UTC, Vaidas wrote:
Is it possible to set the default values for the Main
function's arguments?
It seems that I'm getting Range error.
import std.stdio : writeln;
void main(string[] args = ["asdsfasdf", "asdklfajsdk",
"asdfasdfasd"]){
writeln("",
On Saturday, 10 August 2019 at 08:20:46 UTC, John Colvin wrote:
On Friday, 9 August 2019 at 13:39:53 UTC, Simen Kjærås wrote:
Thanks for the extra detail.
Is there a solid reason to ever use an interface over an
abstract class? (Other than multiple inheritance).
I'm such a noob at
For example if the source tree looks like this:
source/
foo/
baz.d
bar/
baz.d
and generating the docs with something like this:
dmd -D -Dd=docs foo/baz.d bar/baz.d
the output looks like this:
docs/
baz.html
one baz overwrites the other.
I'd like to have something like
On Monday, 12 August 2019 at 10:41:57 UTC, GreatSam4sure wrote:
Pls I want to know if it is possible to build desktop app with
vibe.d just like nodejs. I am not satisfy with the GUI of Dlang
such as dlangui and gtkd. I don't think they have good styling
capabilities like HTML and CSS.
I will
On Monday, 19 August 2019 at 04:23:48 UTC, Jonathan M Davis wrote:
[...]
Thanks for the explanation. I'm in quite a dilemma now as I can't
decide on which to choose :)
On Tuesday, 25 February 2020 at 15:30:19 UTC, Ali Çehreli wrote:
On 2/25/20 3:02 AM, wjoe wrote:> Lets say I've got 3 overloads
of opIndexAssign:
>
> auto opIndexAssign(T t);
> an internet search which didn't find any useful
> information.
I have examples for non-templatized and templatized
Consider a Factory that creates instances of various different
resource object instances, all of which have a common interface,
and returns a handle to them.
class Factory
{
struct Handle{}
Handle create(R: Resource, ARGS...)(ARGS args)
{
auto r = new R(args);
//...
On Thursday, 5 March 2020 at 14:46:24 UTC, Steven Schveighoffer
wrote:
On 3/5/20 9:24 AM, wjoe wrote:
but how can I call fn in the context of an object instance?
You could do it with delegates. But it's ugly:
import std.stdio;
class C
{
void foo() { writeln("Yup");}
}
void main()
{
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:
Implement this for free functions i would do something like
this
void dispatch(alias fn, ARGS...)(Handle handle, ARGS args)
Why do you need an `alias fn` like that?
My
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 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 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?!
Lets say I've got 3 overloads of opIndexAssign:
auto opIndexAssign(T t);
auto opIndexAssign(T t, size_t i); and
auto opIndexAssign(T t, size_t[2] i);
I would assume to return what I would return with opIndex but I'd
rather not act upon assumptions.
But if yes is it supposed to be the newly
On Tuesday, 25 February 2020 at 11:49:50 UTC, Petar Kirov
[ZombineDev] wrote:
On Tuesday, 25 February 2020 at 11:02:40 UTC, wjoe wrote:
[...]
opIndexAssign is the operator used in the following code:
arr[1] = 8;
It returns the element at index 1 (so 8 in this case) by
reference.
This
On Tuesday, 18 February 2020 at 13:07:35 UTC, wjoe wrote:
I have a function add(index, data) which throws RangeError if
the index is invalid.
Never mind. For whatever reason RangeError is now caught. Sorry
for the noise.
I have a function add(index, data) which throws RangeError if the
index is invalid.
unittest { // is supposed to test that RangeError is thrown on a
range violation
assertThrown!RangeError(add(size_t.max, something)); //which
doesn't work, the test is killed with core.exception.RangeError:
On Tuesday, 11 February 2020 at 18:21:11 UTC, Adam D. Ruppe wrote:
On Tuesday, 11 February 2020 at 18:11:44 UTC, wjoe wrote:
In my mind, if something works with foreach, it should also
work with std.algorithm.each.
They are very different, the each thing only works for ranges
whereas foreach
Consider a function to format the parameters of a function call:
pure nothrow string fmtArgs(ARGS...)(ARGS args)
{
string result;
// 1)
foreach(a; args) {
result ~= a.to!string;
}
// 2)
args.each!(a => result ~= a.to!string);
return result;
}
In my mind, if
On Tuesday, 11 February 2020 at 19:04:17 UTC, Paul Backus wrote:
On Tuesday, 11 February 2020 at 18:55:45 UTC, wjoe wrote:
What's a compiler list... is that something like a tuple? or
more like a macro expansion?
Or is it only valid to use in a foreach to take advantage of
each item
On Tuesday, 11 February 2020 at 19:05:19 UTC, Adam D. Ruppe wrote:
On Tuesday, 11 February 2020 at 18:55:45 UTC, wjoe wrote:
What's a compiler list... is that something like a tuple?
Yea, they are frequently called tuples too. It is basically
just a list of arguments used for a function call
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 Friday, 13 March 2020 at 20:31:16 UTC, Steven Schveighoffer
wrote:
On 3/13/20 4:22 PM, wjoe wrote:
I would expect that something could be written to turn a
signature string into a mangling and also provide the correct
type upon return. Something like:
auto f = getFunction!(@safe void
I've got a plug-in which is a shared library. Like this
module plugin;
@safe int VersionOfAPI()
{
return 1;
}
this is builds to plugin.so
in main.d I'm loading the plugin and bind the those functions
like so:
module app;
@safe:
alias apiverfn = int function();
apiverfn apiVersion;
On Friday, 13 March 2020 at 16:04:06 UTC, Mike Parker wrote:
On Friday, 13 March 2020 at 15:16:06 UTC, wjoe wrote:
bindSymbol(, "VersionOfAPI");
}
Is it possible to convince the compiler to look the other way
while binding @safe functions from the plugin ?
It probably has nothing to
On Friday, 13 March 2020 at 18:30:51 UTC, H. S. Teoh wrote:
On Fri, Mar 13, 2020 at 06:11:01PM +, wjoe via
Digitalmars-d-learn wrote:
On Friday, 13 March 2020 at 17:05:32 UTC, Mike Parker wrote:
> On Friday, 13 March 2020 at 16:11:53 UTC, wjoe wrote:
> > On Friday, 13 March 2020 at
On Friday, 13 March 2020 at 17:05:32 UTC, Mike Parker wrote:
On Friday, 13 March 2020 at 16:11:53 UTC, wjoe wrote:
On Friday, 13 March 2020 at 16:04:06 UTC, Mike Parker wrote:
On Friday, 13 March 2020 at 15:16:06 UTC, wjoe wrote:
bindSymbol(, "VersionOfAPI");
}
Is it possible to
On Wednesday, 6 May 2020 at 16:01:37 UTC, Paul Backus wrote:
On Wednesday, 6 May 2020 at 09:40:47 UTC, wjoe wrote:
yes, I did read the spec. I read the language spec on traits
as well as std.traits docs as well as searching the internet
for a solution since day before yesterday. But I couldn't
On Friday, 15 May 2020 at 13:52:38 UTC, Paul Backus wrote:
On Friday, 15 May 2020 at 13:47:43 UTC, wjoe wrote:
struct Foo(A, B, C, size_t a, size_t b)
{
alias foo_t = Foo!(A, B, C, a, b); // is there a better way
to get foo_t ?
}
typeof(this)
Thanks :)
struct Foo(A, B, C, size_t a, size_t b)
{
alias foo_t = Foo!(A, B, C, a, b); // is there a better way to
get foo_t ?
}
On Friday, 15 May 2020 at 15:24:32 UTC, Ali Çehreli wrote:
On 5/15/20 8:04 AM, Paul Backus wrote:
[...]
Yes, that is a consistent way of explaining it. :)
As an off-topic trivia, the same feature is in C++ as well:
[...]
Ali
Awesome. Thank you Ali and Paul :)
On Tuesday, 19 May 2020 at 10:08:37 UTC, user1234 wrote:
On Tuesday, 19 May 2020 at 10:01:34 UTC, wjoe wrote:
[...]
It has no purpose. In D many attributes are allowed even if
they have no meaning.
D-Scanner checks this kind of stuff, to some extent, but not
the compiler.
Thank you.
As I was reading a few source files of a library I found dozens
of final struct declarations like this:
final struct Foo {
const pure final nothrow bar() { ... }
}
What's this supposed to express ?
A final class is a class that can't be subclassed - structs can't
be subclassed, so does
Is there an easy way to print an int in hexadecimal, octal or
binary representation ?
The documentation on pragma(msg, ...) and a quick web search
didn't provide an answer.
On Thursday, 14 May 2020 at 10:58:34 UTC, WebFreak001 wrote:
On Thursday, 14 May 2020 at 09:49:15 UTC, wjoe wrote:
Is there an easy way to print an int in hexadecimal, octal or
binary representation ?
The documentation on pragma(msg, ...) and a quick web search
didn't provide an answer.
On Friday, 8 May 2020 at 13:43:40 UTC, data pulverizer wrote:
[...] I also chose kernel matrix calculations, you can't always
call a library, sometimes you just need to write performant
code.
Aren't kernel function calls suffering a context switch though ?
On Monday, 11 May 2020 at 19:08:09 UTC, Q. Schroll wrote:
[...]
1. You can have variables ("data members") of reference type in
structs. (They work like head-const pointers; if D had
head-const or at least head-const pointers, those would be
practically the same, only that references cannot
I have a container which provides access to data via a handle.
For book keeping I calculate some bitmasks.
Previously, when the handle type as well as the constants were
uint, everything compiled fine.
Today I added a template parameter to be able to specify the
handle type and I ran into this
Hello,
I'm choking on a piece of C++ I have no idea about how to
translate to D.
template typename std::enable_if< std::is_const::value == true,
void>::type* = nullptr>
constexpr const char *modifier() const {
return "[in] ";
}
template typename
On Wednesday, 6 May 2020 at 09:19:10 UTC, drug wrote:
06.05.2020 12:07, wjoe пишет:
Hello,
I'm choking on a piece of C++ I have no idea about how to
translate to D.
template typename std::enable_if< std::is_const::value ==
true, void>::type* = nullptr>
constexpr const
It's easy to declare the entire module @safe and functions which
can't be can be declared @system.
However there is const, immutable, pure, @nogc and nothrow but no
mutable, impure, @gc and throws.
Why is that ?
On Monday, 7 September 2020 at 11:44:40 UTC, Paul Backus wrote:
On Monday, 7 September 2020 at 11:25:15 UTC, wjoe wrote:
It's easy to declare the entire module @safe and functions
which can't be can be declared @system.
However there is const, immutable, pure, @nogc and nothrow but
no mutable,
On Wednesday, 23 September 2020 at 18:50:28 UTC, H. S. Teoh wrote:
Try this:
interface I {}
class C : I {}
class D {}
struct S {}
pragma(msg, is(C : I)); // true
pragma(msg, is(D : I)); // false
pragma(msg, is(S : I)); // false
So
On Wednesday, 23 September 2020 at 18:49:28 UTC, data pulverizer
wrote:
On Wednesday, 23 September 2020 at 18:37:45 UTC, wjoe wrote:
[...]
A class at compile time is it's own static type, OOP
polymorphism is a runtime feature not compile time. You have to
write your own traits for specific
I have some similar functions:
void register(C: IFoo)()
{
_insert!C();
}
void register(C)() if (behavesLikeFoo!C)
{
_insert!C();
}
There are more overloads with parameters so I want to merge them
void register(C, ARGS...)(ARGS args) if (behavesLikeFoo!C ||
isInstanceOf!(C, IFoo))
{
On Wednesday, 23 September 2020 at 19:08:47 UTC, data pulverizer
wrote:
On Wednesday, 23 September 2020 at 18:56:33 UTC, wjoe wrote:
[...]
Didn't think that the compiler didn't know but wasn't aware
that you could use that information to statically dispatch. My
mistake, I'll shut up now!
On Thursday, 17 September 2020 at 19:27:41 UTC, Adam D. Ruppe
wrote:
fyi my baby was just born i'll come back to this but it might
be a day or two
congratulations! All the best for your family :)
On Friday, 18 September 2020 at 22:31:09 UTC, mw wrote:
On Friday, 18 September 2020 at 00:07:12 UTC, wjoe wrote:
Are there other frameworks besides vibe that can do what I
want?
Just FYI, there is also:
https://code.dlang.org/packages/hunt-framework
I never used myself, you need to
On Friday, 18 September 2020 at 22:21:52 UTC, Adam D. Ruppe wrote:
On Friday, 18 September 2020 at 22:02:07 UTC, aberba wrote:
[...]
I actually added *exactly* this to cgi.d in... 2010 if I
remember right. I even kinda documented it:
On Friday, 18 September 2020 at 22:02:07 UTC, aberba wrote:
[...]
That's what I was trying to answer. When Steve said meh, he
probably didn't get what I said. Probably its because of my
typos.
This sort of convenience and productivity benefit is part of
why I use Node.Js in the job when I
On Thursday, 17 September 2020 at 22:33:46 UTC, Steven
Schveighoffer wrote:
On 9/17/20 6:13 PM, aberba wrote:
On Thursday, 17 September 2020 at 21:57:37 UTC, Steven
Schveighoffer wrote:
On 9/17/20 1:08 PM, wjoe wrote:
[...]
the `files` property actually does the processing only when
you
I found this [1] but unfortunately the post this refers to is a
dead link and the content, unfortunately, didn't tell me anything
that I didn't already find in the docs.
What I can get from the form is the form fields with content, the
field name for the file upload and the file name. But the
On Thursday, 17 September 2020 at 16:32:55 UTC, WebFreak001 wrote:
On Thursday, 17 September 2020 at 16:00:33 UTC, wjoe wrote:
I found this [1] but unfortunately the post this refers to is
a dead link and the content, unfortunately, didn't tell me
anything that I didn't already find in the
On Wednesday, 27 May 2020 at 11:40:00 UTC, Mike Parker wrote:
On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote:
On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote:
Could you please elaborate why checked exceptions are more
annoying?
For me, it's because they require all
On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote:
On Wednesday, 27 May 2020 at 09:56:07 UTC, wjoe wrote:
The problem with catch(Exception) is that it's run time
whereas I'd like to know compile time which exception may
possibly be thrown.
So I take it the only way to find out
nothrow void foo()
{
bar(4);
}
void bar(int a)
{
if (a ==1)
throw new Exception1();
else if (a == 2)
throw new Exception2();
baz();
}
void baz()
{
if (whatever)
throw new Exception3();
}
The compiler will complain that bar(int) isn't nothrow.
What's the best way to
On Wednesday, 27 May 2020 at 09:44:56 UTC, Mike Parker wrote:
On Wednesday, 27 May 2020 at 09:42:58 UTC, Mike Parker wrote:
On Wednesday, 27 May 2020 at 09:40:08 UTC, wjoe wrote:
The compiler will complain that bar(int) isn't nothrow.
What's the best way to find out which Exceptions aren't
On Wednesday, 27 May 2020 at 09:44:56 UTC, Mike Parker wrote:
On Wednesday, 27 May 2020 at 09:42:58 UTC, Mike Parker wrote:
I should add that if you're only catching specific exceptions
in a `nothrow` function, then it isn't `nothrow`. You have to
catch Exception because D does not have
On Wednesday, 20 May 2020 at 04:40:33 UTC, user1234 wrote:
On Tuesday, 19 May 2020 at 10:29:51 UTC, wjoe wrote:
On Tuesday, 19 May 2020 at 10:08:37 UTC, user1234 wrote:
[...]
Thank you.
A little sample to show you more cases of attributes that have
no effect:
---
struct Foo
{
On Tuesday, 15 September 2020 at 01:49:13 UTC, James Blachly
wrote:
I wish to write a function including ∂x and ∂y (these are
trivial to type with appropriate keyboard shortcuts - alt+d on
Mac), but without a unicode byte order mark at the beginning of
the file, the lexer rejects the tokens.
On Saturday, 19 September 2020 at 19:27:40 UTC, Steven
Schveighoffer wrote:
[...]
This used to be the expected way to set up vibe (using module
constructors). And vibe would provide its own main function.
I *think* the idea was to allow registration of different
handlers in their respective
On Saturday, 19 September 2020 at 20:17:06 UTC, aberba wrote:
I personally (and many others in the industry... judging by
popularity of express (node.js) and the plentiful third-party
libraries,..do prefer the router.get() design. Also having
everything abstracted in a convenient and
On Sunday, 20 September 2020 at 00:36:30 UTC, Adam D. Ruppe wrote:
[...]
That's it - all the html and javascript are all auto-generated.
Amazing :)
Would even be more awesome if it provided a function which could
be called from a custom main on top of the FancyMain.
I find e.g. custom
On Friday, 18 September 2020 at 11:44:39 UTC, Atwork wrote:
On Friday, 18 September 2020 at 00:07:12 UTC, wjoe wrote:
And if not, how is data processed with a 10mb file upload
followed by a few number fields ?
It needs to read all of the file data to get to the other data
fields, doesn't it ?
Something like this:
configuration "lib" {
targetType "dynamicLibrary"
sourceDir "source/lib/"
}
configuration "app" {
targetType "executable"
sourceFiles "source/app.d"
linkWith "lib"
}
I found subConfiguration in the docs but that seems to be related
to external dependencies.
configuration "app" {
versions "CLI"
target "executable"
...
}
configuration "guiapp" : "app" {
versions "GUI"
sourceFiles "source/gui.d"
}
The guiapp should basically inherit the "app" configuration and
extend/override whatever else is needed/different.
On Friday, 18 September 2020 at 12:03:45 UTC, Mike Parker wrote:
On Friday, 18 September 2020 at 11:38:14 UTC, wjoe wrote:
Something like this:
configuration "lib" {
targetType "dynamicLibrary"
sourceDir "source/lib/"
}
configuration "app" {
targetType "executable"
sourceFiles
On Friday, 18 September 2020 at 14:15:27 UTC, Steven
Schveighoffer wrote:
On 9/18/20 7:38 AM, wjoe wrote:
[...]
There are other options.
for instance dub (the project) has a library and an
application. the config looks like this:
configuration "application" {
targetType
On Friday, 18 September 2020 at 12:58:29 UTC, Steven
Schveighoffer wrote:
On 9/18/20 8:39 AM, Steven Schveighoffer wrote:
But again, solved with an enhancement that allows you to
process the data in your code. I'll file the enhancement
request for you, as I think it's a nice addition.
On Friday, 18 September 2020 at 12:39:43 UTC, Steven
Schveighoffer wrote:
On 9/17/20 8:07 PM, wjoe wrote:
[...]
See the code here:
https://github.com/vibe-d/vibe.d/blob/ebebfa827f568cc9bced4bec2b66edc043a8adf7/inet/vibe/inet/webform.d#L311
[...]
No, not at the moment. Which is why I was
On Friday, 18 September 2020 at 14:01:55 UTC, Mike Parker wrote:
On Friday, 18 September 2020 at 12:28:30 UTC, wjoe wrote:
2 issues though.
- It doesn't build the library automatically, and
You'll have to invoke dub once for each config. Just slap both
commands in a script.
- Linking
On Sunday, 20 September 2020 at 00:36:30 UTC, Adam D. Ruppe wrote:
[...]
I browsed in your arsd docs a bit and I'll have a closer look at
the CGI module a bit later.
Your http2 module piqued my interest as it could come in handy
some time later :)
Looks like your modules cover everything I
On Tuesday, 21 July 2020 at 18:35:34 UTC, notna wrote:
well, I guess all your remarks are true... and irrelevant at
the same time.
please go back and read his first post starts with "I have
a project where I need to take and send UDP packets over the
Internet"...
... and continues
1 - 100 of 179 matches
Mail list logo