I'm a bit confused with the behavior of function type stringification:
int main(string[]args){
auto foo=&main;
pragma(msg,typeid(typeof(foo)));
pragma(msg,typeid(typeof(foo)).stringof);
//pragma(msg,typeid(typeof(foo)));
import std.stdio;
writeln(typeid(typeof(foo)).stringof);
On Monday, July 08, 2013 16:58:03 H. S. Teoh wrote:
> On Mon, Jul 08, 2013 at 04:48:05PM -0700, Jonathan M Davis wrote:
> > On Monday, July 08, 2013 16:38:16 H. S. Teoh wrote:
> [...]
>
> > > Basically, when you write x==y, the compiler looks for opEquals and
> > > opCmp. If opEquals is found, the
On 07/09/13 00:43, Artur Skawina wrote:
> On 07/08/13 23:45, monarch_dodra wrote:
>> But, the "context pointer" *should* be defined as whatever the owner of the
>> indexing/slicing object is, no? In this case, it's simply _input. It has
>> nothing to do with the "this" pointer being available...
On Mon, Jul 08, 2013 at 04:48:05PM -0700, Jonathan M Davis wrote:
> On Monday, July 08, 2013 16:38:16 H. S. Teoh wrote:
[...]
> > Basically, when you write x==y, the compiler looks for opEquals and
> > opCmp. If opEquals is found, then it's rewritten as x.opEquals(y);
> > otherwise, if opCmp is fou
On Monday, July 08, 2013 16:48:05 Jonathan M Davis wrote:
> On Monday, July 08, 2013 16:38:16 H. S. Teoh wrote:
> > On Tue, Jul 09, 2013 at 12:35:32AM +0200, Ugbar Ikenaki wrote:
> > > Here's one more question:
> > >
> > > Before I knew that opEquals existed, I tried overloading the
> > > equality
On Monday, July 08, 2013 16:38:16 H. S. Teoh wrote:
> On Tue, Jul 09, 2013 at 12:35:32AM +0200, Ugbar Ikenaki wrote:
> > Here's one more question:
> >
> > Before I knew that opEquals existed, I tried overloading the
> > equality expressions (== and !=) in opBinary using the code below.
> > It work
On Tue, Jul 09, 2013 at 12:35:32AM +0200, Ugbar Ikenaki wrote:
> Here's one more question:
>
> Before I knew that opEquals existed, I tried overloading the
> equality expressions (== and !=) in opBinary using the code below.
> It worked. Why would the overloaded opBinary version get called if
> th
On Tuesday, July 09, 2013 00:35:32 Ugbar Ikenaki wrote:
> Here's one more question:
>
> Before I knew that opEquals existed, I tried overloading the
> equality expressions (== and !=) in opBinary using the code
> below. It worked. Why would the overloaded opBinary version get
> called if the equal
On 07/08/13 23:45, monarch_dodra wrote:
> On Monday, 8 July 2013 at 18:55:30 UTC, Artur Skawina wrote:
>> On 07/08/13 19:54, monarch_dodra wrote:
>>> struct S(R)
>>> {
>>> R _input;
>>> void foo()
>>> {
>>> static assert(is(typeof(_input[size_t.max .. size_t.max]))); //ok
>>>
Here's one more question:
Before I knew that opEquals existed, I tried overloading the
equality expressions (== and !=) in opBinary using the code
below. It worked. Why would the overloaded opBinary version get
called if the equality expressions are held in opEquals? I'm just
interested in kn
And thanks for that pointer, too, H.S.
Wow! You guys are fast and helpful! Thank you Jonathan and Ali! I
already got it to work, and Ali, your book is great! I've read
about the first 150 pages. I'll check out those operator
overloading chapters for sure.
-U
On Mon, Jul 08, 2013 at 02:42:30PM -0700, Jonathan M Davis wrote:
> On Monday, July 08, 2013 23:31:14 Ugbar Ikenaki wrote:
> > Also…Rat is a struct, not a class. Herein might lie the problem.
>
> So, this is Rat's opCmp, correct? If it's a struct, it makes no sense
> for it to take an Object. Obje
On Monday, 8 July 2013 at 18:55:30 UTC, Artur Skawina wrote:
On 07/08/13 19:54, monarch_dodra wrote:
struct S(R)
{
R _input;
void foo()
{
static assert(is(typeof(_input[size_t.max ..
size_t.max]))); //ok
static assert(is(typeof(_input[size_t.max .. $])));
//ok
On 07/08/2013 02:21 PM, Ugbar Ikenaki wrote:
I'm trying to implement rational numbers with fully functioning
comparison operators, but I can't seem to figure out why I'm getting
this error and any help would be appreciated:
Error: cannot cast from object.Object to Rat
The code I have is as foll
On Monday, July 08, 2013 23:31:14 Ugbar Ikenaki wrote:
> Also…Rat is a struct, not a class. Herein might lie the problem.
So, this is Rat's opCmp, correct? If it's a struct, it makes no sense for it
to take an Object. Object is the base class for all classes and has nothing to
do with structs. o
Thanks for the quick response!
Here is the initialization code for my Rat struct. I created a
GCD function that I've tested to work fine:
import std.stdio, std.exception;
struct Rat {
private long n; //Numerator
private long d; //Denominator
Also…Rat is a struct, not a class. Herein might lie the problem.
On Monday, July 08, 2013 23:21:59 Ugbar Ikenaki wrote:
> I'm trying to implement rational numbers with fully functioning
> comparison operators, but I can't seem to figure out why I'm
> getting this error and any help would be appreciated:
>
> Error: cannot cast from object.Object to Rat
>
> The
I'm trying to implement rational numbers with fully functioning
comparison operators, but I can't seem to figure out why I'm
getting this error and any help would be appreciated:
Error: cannot cast from object.Object to Rat
The code I have is as follows:
int opCmp( Object o ) {
Rat ot
On Monday, 8 July 2013 at 19:37:08 UTC, JohnnyK wrote:
Another thing about GitHub's Download Zip button and this process
as a whole. While the Download Zip button does allow you to
download the master folders with recursive directories I do find
it somewhat cumbersome or should I say awkward s
On Monday, 8 July 2013 at 18:34:33 UTC, Jesse Phillips wrote:
On Monday, 8 July 2013 at 16:24:53 UTC, JohnnyK wrote:
It would be nice if GitHUB would change their Downlaod Zip
button such that it does a recursive zip to include all the
subfolders.
Ehhh, well that is useless. Sorry I couldn't
On Monday, 8 July 2013 at 18:09:44 UTC, monarch_dodra wrote:
On Monday, 8 July 2013 at 16:49:05 UTC, John Colvin wrote:
On Monday, 8 July 2013 at 16:24:53 UTC, JohnnyK wrote:
On Monday, 8 July 2013 at 03:35:03 UTC, Jesse Phillips wrote:
On Monday, 8 July 2013 at 02:42:50 UTC, JohnnyK wrote:
H
On 07/08/13 19:54, monarch_dodra wrote:
> struct S(R)
> {
> R _input;
> void foo()
> {
> static assert(is(typeof(_input[size_t.max .. size_t.max]))); //ok
> static assert(is(typeof(_input[size_t.max .. $]))); //ok
> }
> static assert(is(typeof(_input[size_t.max .
On Monday, 8 July 2013 at 16:24:53 UTC, JohnnyK wrote:
It would be nice if GitHUB would change their Downlaod Zip
button such that it does a recursive zip to include all the
subfolders.
Ehhh, well that is useless. Sorry I couldn't hook you up with a
solution.
On Monday, 8 July 2013 at 03:35:03 UTC, Jesse Phillips wrote:
On Monday, 8 July 2013 at 02:42:50 UTC, JohnnyK wrote:
Hi all,
I have searched everywhere over the Internet and I have yet
to find a way to clone a project using git when my workstation
is behind a company proxy. Can you guys clon
On Monday, 8 July 2013 at 16:49:05 UTC, John Colvin wrote:
On Monday, 8 July 2013 at 16:24:53 UTC, JohnnyK wrote:
On Monday, 8 July 2013 at 03:35:03 UTC, Jesse Phillips wrote:
On Monday, 8 July 2013 at 02:42:50 UTC, JohnnyK wrote:
Hi all,
I have searched everywhere over the Internet and I have
Yeah, not very exiting, but I just spent an hour tracking down
the fix, but now I'd like to track down *what* was making it
break (my fix was "luck"). This should help Kenji (or others)
have an easier time fixing it :)
Also, I'm only repro'ing this on linux...
I think there are two things inv
On Monday, 8 July 2013 at 16:24:53 UTC, JohnnyK wrote:
On Monday, 8 July 2013 at 03:35:03 UTC, Jesse Phillips wrote:
On Monday, 8 July 2013 at 02:42:50 UTC, JohnnyK wrote:
Hi all,
I have searched everywhere over the Internet and I have yet
to find a way to clone a project using git when my
wo
On Monday, 8 July 2013 at 02:42:50 UTC, JohnnyK wrote:
Hi all,
I have searched everywhere over the Internet and I have yet
to find a way to clone a project using git when my workstation
is behind a company proxy. Can you guys clone your projects to
a single zip file that I can download? Th
On Monday, 8 July 2013 at 03:35:03 UTC, Jesse Phillips wrote:
On Monday, 8 July 2013 at 02:42:50 UTC, JohnnyK wrote:
Hi all,
I have searched everywhere over the Internet and I have yet
to find a way to clone a project using git when my workstation
is behind a company proxy. Can you guys clon
Am Mon, 08 Jul 2013 10:59:14 +0200
schrieb "JS" :
> I have an interface that I would like to make sure that any
> classes derived from it will use alias this, else it can
> potentially break code.
>
> interface A(T)
> {
> @property T Value();
> @property T Value(T value);
> // ne
On Monday, 8 July 2013 at 15:43:21 UTC, Marco Leise wrote:
Am Thu, 04 Jul 2013 15:54:48 +0200
schrieb "monarch_dodra" :
> This should work:
>
> int[] *pSlice = (new int[][1]).ptr;
>
> -Steve
Hum... That would allocate a dynamic array of slices though
right? There'd be the Appendable overhead
Am Thu, 04 Jul 2013 15:54:48 +0200
schrieb "monarch_dodra" :
> > This should work:
> >
> > int[] *pSlice = (new int[][1]).ptr;
> >
> > -Steve
>
> Hum... That would allocate a dynamic array of slices though
> right? There'd be the Appendable overhead for just one element...
No, it allocates a st
On Monday, 8 July 2013 at 14:25:17 UTC, Artur Skawina wrote:
On 07/08/13 16:12, John Colvin wrote:
On Monday, 8 July 2013 at 13:42:36 UTC, Artur Skawina wrote:
On 07/08/13 15:12, John Colvin wrote:
On Monday, 8 July 2013 at 13:01:32 UTC, Artur Skawina wrote:
It won't work if one of the types i
On 07/08/13 16:12, John Colvin wrote:
> On Monday, 8 July 2013 at 13:42:36 UTC, Artur Skawina wrote:
>> On 07/08/13 15:12, John Colvin wrote:
>>> On Monday, 8 July 2013 at 13:01:32 UTC, Artur Skawina wrote:
It won't work if one of the types isn't already available inside the
template - th
On Monday, 8 July 2013 at 13:42:36 UTC, Artur Skawina wrote:
On 07/08/13 15:12, John Colvin wrote:
On Monday, 8 July 2013 at 13:01:32 UTC, Artur Skawina wrote:
It won't work if one of the types isn't already available
inside the
template - the .stringof will give you the name, but the mixin
wi
On 07/08/13 15:12, John Colvin wrote:
> On Monday, 8 July 2013 at 13:01:32 UTC, Artur Skawina wrote:
>> It won't work if one of the types isn't already available inside the
>> template - the .stringof will give you the name, but the mixin
>> will fail;
>
> When would the type not be available?
>
On Monday, 8 July 2013 at 11:37:31 UTC, JS wrote:
On Monday, 8 July 2013 at 09:55:29 UTC, John Colvin wrote:
On Monday, 8 July 2013 at 09:52:44 UTC, John Colvin wrote:
Most other solutions I tried failed because the compiler
evaluates the check (e.g. out contracts) in the interface,
which make
On Monday, 8 July 2013 at 13:01:32 UTC, Artur Skawina wrote:
It won't work if one of the types isn't already available
inside the
template - the .stringof will give you the name, but the mixin
will fail;
When would the type not be available?
On 07/08/13 13:25, JS wrote:
> mixin template a(T...)
> {
> template b(TT...)
> {
> static string eval()
> {
> string s;
> int i = 0;
> foreach(t; TT)
> s = "@property "~(t).stringof~" Name"~to!string(i++)~"();\n";
>
On 2013-07-08, 11:03, bearophile wrote:
Simen Kjaeraas:
However, you can amend std.traits.EnumMembers to work
with larger enums by using this version:
Worth putting in Phobos?
Filed:
http://d.puremagic.com/issues/show_bug.cgi?id=10569
And created a pull request:
https://github.com/D-Pro
On Monday, 8 July 2013 at 09:55:29 UTC, John Colvin wrote:
On Monday, 8 July 2013 at 09:52:44 UTC, John Colvin wrote:
Most other solutions I tried failed because the compiler
evaluates the check (e.g. out contracts) in the interface,
which makes the check either semantically wrong, or staticall
On Monday, 8 July 2013 at 10:16:22 UTC, John Colvin wrote:
On Monday, 8 July 2013 at 09:34:46 UTC, JS wrote:
this may seem a bit nonsensical but it is just an example:
interface A(T, S...)
{
... Generate a getter for each type in S...
// e.g., @property S[0] property1();
// @proper
On Monday, 8 July 2013 at 09:34:46 UTC, JS wrote:
this may seem a bit nonsensical but it is just an example:
interface A(T, S...)
{
... Generate a getter for each type in S...
// e.g., @property S[0] property1();
// @property S[1] property2();
//
}
I imagine I have to us
On Monday, 8 July 2013 at 09:03:24 UTC, bearophile wrote:
Simen Kjaeraas:
However, you can amend std.traits.EnumMembers to work
with larger enums by using this version:
Worth putting in Phobos?
Bye,
bearophile
I reckon so. It's rare to have such huge structs or classes that
this sort of t
On Monday, 8 July 2013 at 09:52:44 UTC, John Colvin wrote:
Most other solutions I tried failed because the compiler
evaluates the check (e.g. out contracts) in the interface,
which makes the check either semantically wrong, or statically
false/failed.
Woops, should be "the contract exists in
On Monday, 8 July 2013 at 08:59:16 UTC, JS wrote:
I have an interface that I would like to make sure that any
classes derived from it will use alias this, else it can
potentially break code.
interface A(T)
{
@property T Value();
@property T Value(T value);
// need to enforce alias
this may seem a bit nonsensical but it is just an example:
interface A(T, S...)
{
... Generate a getter for each type in S...
// e.g., @property S[0] property1();
// @property S[1] property2();
//
}
I imagine I have to use a mixin template but I'm unsure how to
create a
interface A(T)
{
@property T Value();
@property T Value(T value);
// need to enforce alias Value this somehow
}
class B(T) : A!T
{
private T _value;
@property T Value() { return _value; }
@property T Value(T value) { return value = _value; }
alias Value this;
Simen Kjaeraas:
However, you can amend std.traits.EnumMembers to work
with larger enums by using this version:
Worth putting in Phobos?
Bye,
bearophile
JS:
I think when the code is compiled a "report" can be generated
listing the priorities along with the locations in the file
would be beneficial...
It looks like a useful thing, on the other hand I think most
people solve this with their IDEs instead of modifying the source
code.
Anyth
Please show a complete very little program, and maybe someone
will try to help you.
I've seen there is code in another (broken) thread, so please
ignore this request.
Bye,
bearophile
I have an interface that I would like to make sure that any
classes derived from it will use alias this, else it can
potentially break code.
interface A(T)
{
@property T Value();
@property T Value(T value);
// need to enforce alias _value this somehow
}
class B(T) : A!T
{
priva
Charles Hixson:
Is this the way things are supposed to happen? (Changing the
struct to a class is an OK patch, but I don't understand why it
should either work or be necessary.)
Please show a complete very little program, and maybe someone
will try to help you.
(Eventually it's a good ide
55 matches
Mail list logo