The following expression:
import std.math : sqrt;
sqrt(400);
produces the following compiler error:
std.math.sqrt called with argument types (int) matches both:
/usr/include/dmd/phobos/std/math.d(1592,7):
std.math.sqrt(float x)
and:
/usr/include/dmd/phobos/std/math.d(1598,6):
std.mat
On Friday, 22 December 2017 at 00:09:31 UTC, Mike Franklin wrote:
What condition(s) would cause a destructor for an object that
is managed by the GC to potentially not be called?
Good question. It's true that barring an Error, they should be
called by the GC at runtime termination.
On Friday, 22 December 2017 at 23:34:55 UTC, Mengu wrote:
i really wonder how Objective-C and Swift is pulling this off.
It isn't a fundamental problem, D just can't express it in the
existing language (heck, even D, as defined, could do it, the
implementation just isn't there.)
On Thursday, 21 December 2017 at 21:11:58 UTC, Steven
Schveighoffer wrote:
On 12/21/17 4:00 PM, kerdemdemir wrote:
I have a case like :
http://rextester.com/NFS28102
I have a factory method, I am creating some instances given
some enums.
My question is about :
void PushIntoVector( BaseEnum
On Thursday, 21 December 2017 at 18:45:27 UTC, Adam D. Ruppe
wrote:
On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote:
When the scoped destruction of structs isn't an option,
RefCounted!T seems to be a less evil alternative than an
unreliable class dtor. :-/
Alas, RefCounted doe
On Friday, 22 December 2017 at 22:09:05 UTC, H. S. Teoh wrote:
On Fri, Dec 22, 2017 at 09:13:31PM +, kerdemdemir via
Digitalmars-d-learn wrote:
I want to make a logging function for member variables by
using reflection.
[...]
class B
{
void Log()
{
auto a = [__traits(derive
On Friday, 22 December 2017 at 17:53:34 UTC, Marc wrote:
How can I create a alias to a struct method?
struct S {
string doSomething(int n) { return ""; }
}
I'd like to do something like this (imaginary code):
alias doSomething = S.doSomething;
then call it by doSomething(3)
I got the foll
I can compile the derelict-fmod example with
dub.json
...
"dependencies": {
"derelict-util": ">=1.9.1"
...
and dub.selections.json
...
"versions": {
"derelict-util": "2.1.0"
...
dub run
Fetching derelict-util 2.
On Fri, Dec 22, 2017 at 09:13:31PM +, kerdemdemir via Digitalmars-d-learn
wrote:
> I want to make a logging function for member variables by using reflection.
[...]
> class B
> {
> void Log()
> {
> auto a = [__traits(derivedMembers, D)];
> foreach(memberName; a) {
>
On Friday, 22 December 2017 at 21:36:20 UTC, Ryan David Sheasby
wrote:
Hi. Struggling to figure this out. At the bottom of this page:
https://dlang.org/library/std/conv/octal.html is a vague
reference to using parse. However, when I use what I would
assume to be correct based on this:
https://
Hi. Struggling to figure this out. At the bottom of this page:
https://dlang.org/library/std/conv/octal.html is a vague
reference to using parse. However, when I use what I would assume
to be correct based on this:
https://dlang.org/phobos/std_conv.html#.parse.3 and the fact that
in the octal
I want to make a logging function for member variables by using
reflection.
import std.stdio;
class D : B
{
override void foo() {
a = 4.0;
b = 3.0;
}
double a;
double b;
}
class B
{
void Log()
{
auto a = [__traits(derivedMembers, D)];
f
On 12/22/2017 09:53 AM, Marc wrote:
> How can I create a alias to a struct method?
>
>> struct S {
>> string doSomething(int n) { return ""; }
>> }
>
> I'd like to do something like this (imaginary code):
>
> alias doSomething = S.doSomething;
>
> then call it by doSomething(3)
That can't work b
On Friday, 22 December 2017 at 09:52:26 UTC, Chris Katko wrote:
DMD can use -profile and -profile=gc. But I tried for HOURS to
find the equivalent for LDC and came up with only
profile-guided optimization--which I don't believe I want. Yet,
if we can get PGO... where's the PROFILE itself it's u
See also how dplug is implemented
https://forum.dlang.org/post/hbmbztydvyfwemfne...@forum.dlang.org
How can I create a alias to a struct method?
struct S {
string doSomething(int n) { return ""; }
}
I'd like to do something like this (imaginary code):
alias doSomething = S.doSomething;
then call it by doSomething(3)
I got the following error from this code:
Error: need 'this' for 'gen'
On Friday, 22 December 2017 at 03:24:15 UTC, rikki cattermole
wrote:
You are not using a Cygwin build.
It doesn't matter who calls a process, it doesn't change the
version's by itself.
As far as I know, nobody supports Cygwin like this.
I see, thank you.
On Friday, 22 December 2017 at 10:14:48 UTC, crimaniak wrote:
My code:
alias MemSize = ushort;
struct MemRegion
{
MemSize start;
MemSize length;
@property MemSize end() const { return start+length; }
}
Error: cannot implicitly convert expression
`cast(int)this.start +
On Thursday, 21 December 2017 at 15:59:44 UTC, Steven
Schveighoffer wrote:
Here's a similar solution with an actual range:
https://run.dlang.io/is/gR3CjF
Note, all done lazily. However, the indices must be
sorted/unique.
-Steve
Noice! :D
On Friday, 22 December 2017 at 10:42:28 UTC, crimaniak wrote:
Hm, really. ok, I will use the explicit cast, but I don't like
it.
It's because the C programming language has similar integer
promotion rules. That doesn't make it any more convenient if you
weren't expecting it but that is the re
On Friday, 22 December 2017 at 10:18:52 UTC, ketmar wrote:
crimaniak wrote:
Both operands are the same type, so as I understand casting to
longest type is not needed at all, and longest type here is
ushort in any case. What am I doing wrong?
it is hidden in specs: all types shorter than int
crimaniak wrote:
Both operands are the same type, so as I understand casting to longest
type is not needed at all, and longest type here is ushort in any case.
What am I doing wrong?
it is hidden in specs: all types shorter than int are promoted to int
before doing any math.
My code:
alias MemSize = ushort;
struct MemRegion
{
MemSize start;
MemSize length;
@property MemSize end() const { return start+length; }
}
Error: cannot implicitly convert expression `cast(int)this.start
+ cast(int)this.length` of type `int` to `ushort`
Both operands
DMD can use -profile and -profile=gc. But I tried for HOURS to
find the equivalent for LDC and came up with only profile-guided
optimization--which I don't believe I want. Yet, if we can get
PGO... where's the PROFILE itself it's using to make those
decisions! :)
Thanks.
24 matches
Mail list logo