On 10/19/2012 06:38 AM, Oleg wrote:
> Problem solved partially.
>
> http://dpaste.dzfl.pl/e7871a01
>
> in structs I use fix length arrays declarations, and alias its to
> structs, but not allowed casting to fix length arrays.
> I want check array length in compile time
>
> auto opBinary(string op,
Problem solved partially.
http://dpaste.dzfl.pl/e7871a01
in structs I use fix length arrays declarations, and alias its to
structs, but not allowed casting to fix length arrays.
I want check array length in compile time
auto opBinary(string op,E)( E[DLen] b ) // fix length array
i
On Thursday, 18 October 2012 at 23:51:44 UTC, Timon Gehr wrote:
If the issue _is_ with the signature, then the compiler should
tell you. That is the (secondary) job of the compiler.
But not everything is parsed/compiled if it doesn't match the
constraints, especially template functions. Somet
On 10/19/2012 02:12 AM, bearophile wrote:
Timon Gehr:
What situations?
This thread has already shown two possible cases worth discussing about.
This report shows two more cases:
http://d.puremagic.com/issues/show_bug.cgi?id=8844
How is that bug-prone? Are there keyboards where : and = are
Timon Gehr:
What situations?
This thread has already shown two possible cases worth discussing
about.
This report shows two more cases:
http://d.puremagic.com/issues/show_bug.cgi?id=8844
Two more cases:
Foo opBinary(string op="/\")(Foo f) {}
Foo opBinary(string op)(Foo f) if (op == "@") {
On 10/19/2012 01:23 AM, bearophile wrote:
Era Scarecrow:
Maybe.. A general warning when something starts with 'op(Op)?[A-Z]'
but doesn't actually qualify as any of the override-able operators?
That seems sensible...
Regarding operator overloading there are several situations worth
warning th
On 10/19/2012 01:05 AM, Era Scarecrow wrote:
On Thursday, 18 October 2012 at 22:07:55 UTC, Timon Gehr wrote:
On 10/18/2012 11:45 PM, bearophile wrote:
There are other cases. Generally the D compiler should add some
warnings that help against operator overloading mistakes.
I don't think that o
Era Scarecrow:
Maybe.. A general warning when something starts with
'op(Op)?[A-Z]' but doesn't actually qualify as any of the
override-able operators? That seems sensible...
Regarding operator overloading there are several situations worth
warning the programmer of. The D compilers should b
On Thursday, 18 October 2012 at 22:07:55 UTC, Timon Gehr wrote:
On 10/18/2012 11:45 PM, bearophile wrote:
There are other cases. Generally the D compiler should add
some warnings that help against operator overloading mistakes.
I don't think that operator overloading gives rise to distinct
mi
On 10/18/2012 11:45 PM, bearophile wrote:
Era Scarecrow:
It's an easy mistake to make. Maybe the compiler should issue a
warning when opAssign attempts and fails and opOpBinary is defined.
This would have to be implemented very carefully. There are enough
hard to reproduce symbol resolution
Era Scarecrow:
It's an easy mistake to make. Maybe the compiler should issue a
warning when opAssign attempts and fails and opOpBinary is
defined.
If you have strong feelings about this, then add a Bugzilla entry.
There are other cases. Generally the D compiler should add some
warnings that
On Thursday, 18 October 2012 at 18:12:49 UTC, Simen Kjaeraas
wrote:
I see you have opOpBinary there - should those be opOpAssign?
Probably. It's an easy mistake to make. Maybe the compiler
should issue a warning when opAssign attempts and fails and
opOpBinary is defined.
On 2012-10-18, 17:45, Oleg wrote:
Sorry. My problem more complex and my simplification is not correct.
I want use mixin for math operations.
mixin template vectOp( string DataName, int DataLen, T, vecType )
{
mixin( "alias " ~ DataName ~ " this;" );
auto opBinary(string op,E)( E[
Sorry. My problem more complex and my simplification is not
correct.
I want use mixin for math operations.
mixin template vectOp( string DataName, int DataLen, T, vecType )
{
mixin( "alias " ~ DataName ~ " this;" );
auto opBinary(string op,E)( E[DataLen] b )
auto opBinary(s
On 2012-10-18, 16:54, Oleg wrote:
Hello. How to cast template struct to itself?
struct vec(string S,T=double)
{
T[S.length] data;
auto opCast(string K,E)()
if( S.length == K.length &&
is( T : E ) )
{
vec!(K,E) ret;
foreach( i, ref m; ret.d
Hello. How to cast template struct to itself?
struct vec(string S,T=double)
{
T[S.length] data;
auto opCast(string K,E)()
if( S.length == K.length &&
is( T : E ) )
{
vec!(K,E) ret;
foreach( i, ref m; ret.data )
m = data[i];
retu
16 matches
Mail list logo