Re: Type value

2012-12-10 Thread js.mdnq
On Tuesday, 11 December 2012 at 07:15:38 UTC, Zhenya wrote: I'm sorry for my english. I know that D != Python and my example don't need any RTTI. D has alias this feature.My example shows that we can use alias this with types. And I just want use this: struct Type(T) { alias T m_type; a

Re: Type value

2012-12-10 Thread Zhenya
I'm sorry for my english. I know that D != Python and my example don't need any RTTI. D has alias this feature.My example shows that we can use alias this with types. And I just want use this: struct Type(T) { alias T m_type; alias m_type this; } int main() { Type!int Int; Int i;/

Re: static code generation

2012-12-10 Thread js.mdnq
On Monday, 10 December 2012 at 22:01:37 UTC, Ali Çehreli wrote: On 12/10/2012 01:52 PM, js.mdnq wrote: > I want to avoid having to wrap the code with " > " as it disables highlighting and possibly other features(intellisense, > etc...)) The q{} syntax is supposed to help with that issue. Emacs

Re: Type value

2012-12-10 Thread js.mdnq
On Monday, 10 December 2012 at 19:54:51 UTC, Zhenya wrote: Hi! In some previous post I asked about possibility of declar opIndex,that return type. I thoght about it,and I understood that code like this is legal: struct Type(T) { alias T m_type; alias m_type this; } void main()

"overlapping" structs

2012-12-10 Thread js.mdnq
This gets back to my question about nested structs(since I'm trying to find a way to make it work). Take the following working example: class A { struct B { A* a; } B b1; B b2; } Wastes a lot of space as we store a ptr to A for each field we use. If there were 100 B

Re: alias this private?

2012-12-10 Thread Ali Çehreli
On 12/10/2012 01:56 PM, js.mdnq wrote: > I guess the opGet, > which I'm still not familiar with, behaves a bit different when aliased. > Possibly because we are aliasing a operator(or method?) I may have been too subtle before but opGet() is not an operator function. Although its name starts wi

Re: static code generation

2012-12-10 Thread Ali Çehreli
On 12/10/2012 01:52 PM, js.mdnq wrote: > I want to avoid having to wrap the code with " > " as it disables highlighting and possibly other features(intellisense, > etc...)) The q{} syntax is supposed to help with that issue. Emacs manages syntax highlighting correctly for the q{} strings: imp

Re: alias this private?

2012-12-10 Thread js.mdnq
On Monday, 10 December 2012 at 07:48:37 UTC, Ali Çehreli wrote: On 12/09/2012 10:43 PM, js.mdnq wrote: > I thought `alias this` essentially treats the object as the alias. > > struct A { > alias value this; > int value; > void func(); > } > > A a; > > then a is essentially the same as a.value?

Re: static code generation

2012-12-10 Thread js.mdnq
On Monday, 10 December 2012 at 20:17:41 UTC, Philippe Sigaud wrote: If I'm not mistaken isn't the "code" I'm trying to generate still in a string? Well, yes, but not when you mix it in. It's a string mixin in this case, not a template mixin. My whole point is not to use strings to insert

Re: std.algorithm Map using a external variable

2012-12-10 Thread Zardoz
Well. I just try it again and I noticed this things : -Changind the lambda function from : auto caca2 = map!((a) {return a * iDeltaT;})(caca); to : auto caca2 = map!((a) {return a + iDeltaT;})(caca); Avoid the segmentation fault -Using dmd 2.60 avoid the segmentation fault. The source code

Re: Why the lack of networky bits in the standard library

2012-12-10 Thread Alex Rønne Petersen
On 10-12-2012 21:22, Matthew Caron wrote: In C, if I want to parse a UDP packet, I need to build my own offsets into data based off constants in: net/ethernet.h netinet/udp.h Things like: #define PACKET_DATA_OFFSET_DEFAULT ( ETHER_HDR_LEN + sizeof(struct iphdr) + \ sizeof(struct udp

Why the lack of networky bits in the standard library

2012-12-10 Thread Matthew Caron
In C, if I want to parse a UDP packet, I need to build my own offsets into data based off constants in: net/ethernet.h netinet/udp.h Things like: #define PACKET_DATA_OFFSET_DEFAULT ( ETHER_HDR_LEN + sizeof(struct iphdr) + \ sizeof(struct udphdr)) That would be easy to port to D, if I

Re: static code generation

2012-12-10 Thread Philippe Sigaud
> If I'm not mistaken isn't the "code" I'm trying to generate still in a > string? > Well, yes, but not when you mix it in. It's a string mixin in this case, not a template mixin. > > (you've unfortunately left out the most important part at `//build your > code here`) > Because it's just simp

Type value

2012-12-10 Thread Zhenya
Hi! In some previous post I asked about possibility of declar opIndex,that return type. I thoght about it,and I understood that code like this is legal: struct Type(T) { alias T m_type; alias m_type this; } void main() { Type!int Int; // Int a; } Is it hard to imp

Re: Template return values?

2012-12-10 Thread Jesse Phillips
On Thursday, 6 December 2012 at 00:31:53 UTC, Jonathan M Davis wrote: Pretty much the only kind of situation that I remember running into where I would consider Variant to be a good solution is one where you literally have to return a type from a function where you can't know that type at com

Re: Hide console of gui program coded by gtkD

2012-12-10 Thread Ali Çehreli
On 12/10/2012 06:30 AM, December Flower wrote: > Anyway, what I'm trying to say > is that is there any good start points to make experiences with D > language to build a real-world application using GUI? I think D is in need of documentation of that sort. Books like "D for FooLang programmers"

Re: std.algorithm Map using a external variable

2012-12-10 Thread Maxim Fomin
On Monday, 10 December 2012 at 18:21:48 UTC, Zardoz wrote: I'm trying to use Map with a code like this : ... immutable int m = 10; int[] caca = [1,2,3,4]; auto caca2 = map!( (a) {return a * m;})(caca); writeln(caca2); ... I get a Segmentation fault some times: The most interesting poi

Re: std.algorithm Map using a external variable

2012-12-10 Thread H. S. Teoh
On Mon, Dec 10, 2012 at 07:21:47PM +0100, Zardoz wrote: > I'm trying to use Map with a code like this : > > ... > immutable int m = 10; > int[] caca = [1,2,3,4]; > > auto caca2 = map!( (a) {return a * m;})(caca); > > writeln(caca2); > ... > > I get a Segmentation fault some times: > The

Re: std.algorithm Map using a external variable

2012-12-10 Thread Jacob Carlborg
On 2012-12-10 19:21, Zardoz wrote: I'm trying to use Map with a code like this : ... immutable int m = 10; int[] caca = [1,2,3,4]; auto caca2 = map!( (a) {return a * m;})(caca); writeln(caca2); ... I get a Segmentation fault some times: The most interesting point it's that depends

std.algorithm Map using a external variable

2012-12-10 Thread Zardoz
I'm trying to use Map with a code like this : ... immutable int m = 10; int[] caca = [1,2,3,4]; auto caca2 = map!( (a) {return a * m;})(caca); writeln(caca2); ... I get a Segmentation fault some times: The most interesting point it's that depends of the code around of it ins the same

Re: MS ODBC encoding issue

2012-12-10 Thread Regan Heath
On Fri, 07 Dec 2012 00:27:57 -, Sam Hu wrote: On Thursday, 6 December 2012 at 16:44:01 UTC, Regan Heath wrote: On Thu, 06 Dec 2012 01:26:32 -, Sam Hu wrote: Known issues: Under console reading Access table recordsets works fine ,inserting a new record which contains only English

Re: Hide console of gui program coded by gtkD

2012-12-10 Thread December Flower
On Monday, 10 December 2012 at 13:42:12 UTC, Adam D. Ruppe wrote: On Monday, 10 December 2012 at 13:34:51 UTC, December Flower wrote: I have a question about how to hide a console window. Make a .def file and include it on your dmd command line. The file only needs these two lines: EXETYPE N

Re: constructor is not callable using argument types ()

2012-12-10 Thread bearophile
Suliman: But if I have a lot of property like^ string name int age it's not good to specify all of them in paranceses: auto file = new FileName("test.txt", 21, ETC); How can I specify them in another way? There are several ways to help that. A simple way is to use default arguments:

Re: Hide console of gui program coded by gtkD

2012-12-10 Thread Jordi Sayol
Al 10/12/12 14:34, En/na December Flower ha escrit: > Hello. > > I have a question about how to hide a console window. > > http://pds23.egloos.com/pds/201212/10/80/e0088180_50c5e3b1bb789.png > > This simple application is made by using gtkD and glade3. As you can see from > picture above, conso

Re: Hide console of gui program coded by gtkD

2012-12-10 Thread Maxim Fomin
On Monday, 10 December 2012 at 13:34:51 UTC, December Flower wrote: Hello. I have a question about how to hide a console window. http://pds23.egloos.com/pds/201212/10/80/e0088180_50c5e3b1bb789.png This simple application is made by using gtkD and glade3. As you can see from picture above, con

Re: Hide console of gui program coded by gtkD

2012-12-10 Thread Adam D. Ruppe
If you want to learn more about def files: http://www.digitalmars.com/ctg/ctgDefFiles.html But those two lines I gave are all you need for the console problem.

Re: Hide console of gui program coded by gtkD

2012-12-10 Thread Adam D. Ruppe
On Monday, 10 December 2012 at 13:34:51 UTC, December Flower wrote: I have a question about how to hide a console window. Make a .def file and include it on your dmd command line. The file only needs these two lines: EXETYPE NT SUBSYSTEM WINDOWS Call it foo.def, recompile with it on the dmd

Hide console of gui program coded by gtkD

2012-12-10 Thread December Flower
Hello. I have a question about how to hide a console window. http://pds23.egloos.com/pds/201212/10/80/e0088180_50c5e3b1bb789.png This simple application is made by using gtkD and glade3. As you can see from picture above, console window pops up and doesn't disappear. When I close the console

Re: constructor is not callable using argument types ()

2012-12-10 Thread Suliman
Thanks! But if I have a lot of property like^ string name int age it's not good to specify all of them in paranceses: auto file = new FileName("test.txt", 21, ETC); How can I specify them in another way?