digitalmars.D.learn - function shadowed
- ddos (31/31) Apr 08 2015 i got two modules
- anonymous (3/22) Apr 08 2015 Add to openvg:
- ddos (22/48) Apr 08 2015 thx that works, but why is it even necessary?
- bearophile (4/5) Apr 08 2015 This is by design.
- anonymous (2/3) Apr 08 2015 It's to prevent "hijacking": http://dlang.org/hijack.html
- ddos (2/5) Apr 09 2015 thx for the article!
i got two modules
opengvg.d and vg.d
vg.d contains calls to external c functions
openvg.d should wrap and simplify some of those calls
in openvg.d i make public import of submodule vg.d
such that if openvg.d is imported the functions in vg.d can be 
called, this works as intended. but as soon as i overload a 
function from vg.d in openvg.d i can only call the function in 
openvg.d
example:
vg.d:
module vg;
extern (C) void  vgSetParameterfv(VGHandle object, VGint 
paramType, VGint count, VGfloat *values);
openvg.d
module openvg;
public import vg;
void vgSetParameterfv(VGHandle object, VGint paramType, 
const(VGfloat[]) values)
{
	vg.vgSetParameterfv(object, paramType, cast(int)values.length, 
cast(VGfloat*)values);
}
test.d
import openvg;
vgSetParameterfv(object, paramType, length, values); // call to 
fun in vg.d
how can i call both functions? i'd like to avoid using the module 
prefix vg.vgSetParameterfv if possible
source:
https://github.com/oggs91/OpenVG_D/blob/master/openvg/
 Apr 08 2015
On Wednesday, 8 April 2015 at 12:05:00 UTC, ddos wrote:
 vg.d:
 module vg;
 extern (C) void  vgSetParameterfv(VGHandle object, VGint 
 paramType, VGint count, VGfloat *values);
 openvg.d
 module openvg;
 public import vg;
 void vgSetParameterfv(VGHandle object, VGint paramType, 
 const(VGfloat[]) values)
 {
 	vg.vgSetParameterfv(object, paramType, cast(int)values.length, 
 cast(VGfloat*)values);
 }
 test.d
 import openvg;
 vgSetParameterfv(object, paramType, length, values); // call to 
 fun in vg.d
 how can i call both functions? i'd like to avoid using the 
 module prefix vg.vgSetParameterfv if possible
Add to openvg:
alias vgSetParameterfv = vg.vgSetParameterfv;
 Apr 08 2015
On Wednesday, 8 April 2015 at 17:48:36 UTC, anonymous wrote:On Wednesday, 8 April 2015 at 12:05:00 UTC, ddos wrote:thx that works, but why is it even necessary? same behavior when overriding methods of base classes class Matrix(T) { abstract const(T) opIndexAssign(const(T) val, int row, int col); Matrix!T opIndexAssign(T val, Tuple!(int,int) idx0, Tuple!(int,int) idx1) { ... } } class DenseMatrix(T) : Matrix!(T) { override const(T) opIndexAssign(const(T) val, int row, int col) { ... } alias opIndexAssign = Matrix!T.opIndexAssign; } why not just make it callable without the alias?vg.d: module vg; extern (C) void vgSetParameterfv(VGHandle object, VGint paramType, VGint count, VGfloat *values); openvg.d module openvg; public import vg; void vgSetParameterfv(VGHandle object, VGint paramType, const(VGfloat[]) values) { vg.vgSetParameterfv(object, paramType, cast(int)values.length, cast(VGfloat*)values); } test.d import openvg; vgSetParameterfv(object, paramType, length, values); // call to fun in vg.d how can i call both functions? i'd like to avoid using the module prefix vg.vgSetParameterfv if possibleAdd to openvg: alias vgSetParameterfv = vg.vgSetParameterfv;
 Apr 08 2015
ddos:same behavior when overriding methods of base classesThis is by design. Bye, bearophile
 Apr 08 2015
On Wednesday, 8 April 2015 at 22:53:39 UTC, ddos wrote:why not just make it callable without the alias?It's to prevent "hijacking": http://dlang.org/hijack.html
 Apr 08 2015
On Thursday, 9 April 2015 at 05:34:09 UTC, anonymous wrote:On Wednesday, 8 April 2015 at 22:53:39 UTC, ddos wrote:thx for the article!why not just make it callable without the alias?It's to prevent "hijacking": http://dlang.org/hijack.html
 Apr 09 2015








 
  
  
 
 "bearophile" <bearophileHUGS lycos.com>
 "bearophile" <bearophileHUGS lycos.com> 