Re: Range documentation

2013-03-24 Thread bls

That's why I think concepts are a good thing.
Container == vTable less Interfaces.
secure + documentation for free

On Sunday, 24 March 2013 at 03:55:35 UTC, Manu wrote:

I'd like to clarify some conflicts I've encountered.

TDPL talks about ranges, it mentions random access ranges 
requiring these

functions:

  T at(int i)
  Range slice(int x, int y)

But most code I encounter rather implements:

  T opIndex(size_t i)
  Range opSlice(size_t x, size_t y)

Which is it? Is there a distinction? One approach is deprecated?


Also, forward ranges require:

  Range save()

But there is also this function:

  Range opSlice()

With no args, handles the syntax 'range[]'. save() and 
opSlice() with no

args would appear to be identical.
Why have both? Which will be used in which cases?



On 24 March 2013 13:03, Manu turkey...@gmail.com wrote:

I'm trying to write some ranges with strictly controlled sets 
of features,
but the docs on ranges are either very poor, or illusive (I 
can't find any).


Suggest: Add a category under Language - Language Reference 
about ranges,
and all the stuff that defines their use/limitations. With 
some examples.


I'm just copying from the std libs and hope I catch all the 
details.




Re: Range documentation

2013-03-24 Thread bls

Sorry meant Concept == vTable less Interface
On Sunday, 24 March 2013 at 06:20:14 UTC, bls wrote:

That's why I think concepts are a good thing.
Container == vTable less Interfaces.
secure + documentation for free

On Sunday, 24 March 2013 at 03:55:35 UTC, Manu wrote:

I'd like to clarify some conflicts I've encountered.

TDPL talks about ranges, it mentions random access ranges 
requiring these

functions:

 T at(int i)
 Range slice(int x, int y)

But most code I encounter rather implements:

 T opIndex(size_t i)
 Range opSlice(size_t x, size_t y)

Which is it? Is there a distinction? One approach is 
deprecated?



Also, forward ranges require:

 Range save()

But there is also this function:

 Range opSlice()

With no args, handles the syntax 'range[]'. save() and 
opSlice() with no

args would appear to be identical.
Why have both? Which will be used in which cases?



On 24 March 2013 13:03, Manu turkey...@gmail.com wrote:

I'm trying to write some ranges with strictly controlled sets 
of features,
but the docs on ranges are either very poor, or illusive (I 
can't find any).


Suggest: Add a category under Language - Language Reference 
about ranges,
and all the stuff that defines their use/limitations. With 
some examples.


I'm just copying from the std libs and hope I catch all the 
details.




Re: Linq and the like

2013-03-18 Thread bls



Can anyone else think of a better alternative?


Compile-time Pegged  (once the CTFE mem issues are solved)

https://github.com/PhilippeSigaud/Pegged


Re: Linq and the like

2013-03-18 Thread bls

On Monday, 18 March 2013 at 10:47:35 UTC, bls wrote:



Can anyone else think of a better alternative?


Compile-time Pegged  (once the CTFE mem issues are solved)

https://github.com/PhilippeSigaud/Pegged


I have to add that in Nemerle Linq is implemented using PEG 
Macros. Same is valid for DBC etc..


wxWidget s/ wxD reloaded, stand still, stalled, dead ?

2012-05-04 Thread bls

Hi Andrej,
what is the status quo regarding your automated wxWidgets bindings 
generation ? Your last message sounds pretty optimistic, so what's the 
matter ?


Is the wxc (C++ to C) part working, but you still can work around the 
Multiple Inheritance problem to generated wxD ?


Then it seems that /mixin templates + Interfaces/ as well as /alias 
this/ completely fail to mimic MI.


Or are you waiting for 2.9.4 ?

well, frankly,  I am only guessing. Would be nice if you can tell a bit 
about show stoppers, unsolvable problems, etc.


However in case that the C++ to C doxygen based generator is working... 
why not sharing ?

TIA Bjoern


Re: Introducing vibe.d! SOAP .. REST?

2012-05-03 Thread bls

Am 30.04.2012 08:38, schrieb Sönke Ludwig:

If you mean automatic generation of a REST interface for an existing D
interface, then it's definitely planned. I can imagine a sloppy version
where the HTTP method is always POST or can be POST/GET as desired by
the client. But I would also like to have a more expressive version,
where the HTTP method is inferred from the D method somehow and maybe it
would also be possible to specify a sub path for each method.

Sönke


Yes, this is what I am asking for. I think POST/GET is not enough.

Should be POST GET PUT DELETE

I would be fantastic if vibe.d can implement a REST SERVER following 
this guideline :


The JsonRestStore follows
RFC 2616 (http://www.ietf.org/rfc/rfc2616.txt) whenever possible to 
define to interaction with server. JsonRestStore uses an HTTP GET 
request to retrieve data, a PUT request to change items, a DELETE 
request to delete items, and a POST request to create new items. It is 
recommended that the server follow a URL structure for resources:


/{Table}/{id}

This URL will be used to retrieve items by identity and make 
modifications (PUT and DELETE). It is also recommended that a /{Table}/ 
URL is used to represent the collection of items for the store. When a 
query is performed, any query string is appended to the target URL to 
retrieve the results of the query. The JsonRestStore expects the results 
to be returned in an array (not in an object with an items property like 
some stores). The store will also POST to that URL to create new items.


When creating new items, the JsonRestStore will POST to the target URL 
for the store. If your server wants to assign the URL/location for the 
newly created item, it can do so by including a Location header in the 
response:


Location: http://mysite.com/Table/newid

The server can also assign or change properties of the object (such an 
id or default values) in the response to a POST (or any other request), 
by simply returning the updated JSON representation of the item in the 
body of the response.


Note that in PHP, sometimes setting the Location will erroneously 
trigger a 302 status code which will cause JsonRestStore to fail. Per 
RFC 2616, the correct response to a POST that creates a new resource is 
to return a 201 status code with the Location header. In PHP, you must 
set the status code as well as the Location header if you want to avoid 
a 302 response.


Re: Introducing vibe.d! SOAP .. REST?

2012-05-03 Thread bls

Am 03.05.2012 11:22, schrieb bls:

Should be POST GET PUT DELETE

I would be fantastic if vibe.d can implement a REST SERVER following
this guideline :


A very interesting read regarding implementing a rest server (PHP)

http://www.gen-x-design.com/archives/create-a-rest-api-with-php/

Bjoern


Re: Introducing vibe.d!

2012-05-02 Thread bls

Am 01.05.2012 23:46, schrieb Sönke Ludwig:

I made a post with Steve Teale's MySQL driver as an example:
http://vibed.org/blog/posts/writing-native-db-drivers

There were some hidden gotchas, but I hope the current port doesn't
break anything from the original code.


Looks good. Unfortunately I spend some time with MongoDB and I have to 
say : Amazing db. I thought key/value databases are just toys. At least 
regarding MongoDB is was completely wrong.



I have a problem with diet templates.
In order to use dojo dijit I need :

div class=mainlayout id=appLayout
   data-dojo-props=region: 'center', tabPosition: 'bottom'
   data-dojo-type=dijit.layout.TabContainer
/div

Is this doable in diet templates ?




Re: Introducing vibe.d!

2012-04-29 Thread bls

Great job. Thanks Soenke et al;


 - Built-in support for MongoDB and Redis databases


MySQL.
Like other folks here I need a SQL db, At least for MyQL 5.1 
there is a socket based solution from Steve Teale.

https://github.com/britseye/mysqln
Means no licence trouble, and probably easier to establish async 
support.


Quote
Additional drivers are easy to port to vibe.d because of the 
blocking API - basically the only thing that has to be done is to 
replace the socket calls (send(), recv(), connect() etc.) with 
the corresponding vibe functions.

EndQuote

Can you elaborate a bit more ? Maybe using the vibe.d blog.

There is also a socket based PostgreSQL driver available, but I 
have lost the link and dunno about the status quo.



A MIT licenced *D2 crypto lib worth a look :
http://www.dsource.org/projects/dcrypt/wiki/Features

*not up to date


Whishes:
diet template documentation.
diet template javascript example
server side QR-code generation.  (well may be I am able to 
contribute)


Re: Introducing vibe.d!

2012-04-29 Thread bls

On Sunday, 29 April 2012 at 08:52:09 UTC, simendsjo wrote:

On Sun, 29 Apr 2012 08:13:40 +0200, bls b...@orange.fr wrote:



There is also a socket based PostgreSQL driver available, but 
I have lost the link and dunno about the status quo.


This? https://github.com/pszturmaj/ddb


Exactly. Thanks for the pointer, It is pretty hard to create a 
common db- interface.


Re: Wasn't someone trying to work on a C backend for DMD?

2012-04-28 Thread bls

On Saturday, 28 April 2012 at 23:40:39 UTC, Chad J wrote:
I've googled for it a bit and searched over newsgroup messages 
but I can't find the post that mentioned this.  I think it 
might have been amidst the discussion of the javascript backend.


I want to download it and try it out.



http://www.dsource.org/projects/tdc



Re: Windows 8 Metro support

2012-04-10 Thread bls

On 04/09/2012 10:12 AM, Dmitry Olshansky wrote:

Simply put WinRT is a major update on COM technology and even here it's
backwards compatible with the old COM.
The fact that OS API is expossed through this new COM interface is just
a nice feature. I was kind of wondering when they will finally ditch
Win32 API.


And some details at :
http://www.codeproject.com/Articles/262151/Visual-Cplusplus-and-WinRT-Metro-Some-fundamentals

Since WinRT programming in C++ is such a pain, I think we can see this 
as a chance for D2.


Re: The Downfall of Imperative Programming

2012-04-10 Thread bls

On Tuesday, 10 April 2012 at 16:30:34 UTC, Gour wrote:

On Tue, 10 Apr 2012 18:06:37 +0200
Paulo Pinto pj...@progtools.org wrote:

Scala, Clojure and Ocaml also do have quite industry support 
already.


How does the GUI world of Ocaml look like?


Sincerely,
Gour


GTK


Re: custom attribute proposal (yeah, another one)

2012-04-06 Thread bls

On 04/06/2012 07:04 AM, Manu wrote:

I think Johannes proposal already nails it. What benefits would be
merged from this proposal? How would they influence the design?

On 04/06/2012 11:41 AM, Johannes Pfau wrote:

Declaring a custom attribute:
-
module std.something;

struct Author
{
string name;
public this(string name)
{
this.name http://this.name = name;
}
}
-


Why not being more flexible .. Likewise

struct Annotation  //Throw in all your annotations
{

Variant[] [string] map;

Variant[] opDispatch(string key)()
{
return map[key];
}   

// Single value
Variant[] opDispatch(string key, T) (T t )
if ( !isArray!T  !isTuple!T )
{
index ~= key;
map[key] ~= to!Variant(t);
return map[key];
}   
Array, Tuple
}
well.. I am not sure about CTFE


Re: custom attribute proposal (yeah, another one)

2012-04-06 Thread bls

On 04/06/2012 10:51 AM, bls wrote:

On 04/06/2012 07:04 AM, Manu wrote:

I think Johannes proposal already nails it. What benefits would be
merged from this proposal? How would they influence the design?

On 04/06/2012 11:41 AM, Johannes Pfau wrote:

Declaring a custom attribute:
-
module std.something;

struct Author
{
string name;
public this(string name)
{
this.name http://this.name = name;
}
}
-




Oh the joy of copy and paste ..

struct Annotation  //Throw in all your annotations
{

Variant[] [string] map;

Variant[] opDispatch(string key)()
{
   return map[key];
}

// Single value
void opDispatch(string key, T) (T t )
if ( !isArray!T  !isTuple!T )
{
map[key] ~= to!Variant(t);
return;
 }
// Allow Array and Tuple too
}


Goldie Parser Generator. Haxe language definition.

2012-04-06 Thread bls

Hi Nick, I guess :)
some questions.

Since there is no formal language description for Haxe (afaik) How do 
you implement the Gold Haxe grammar ?


It seems that Goldie grammars are very similar to BNF ( not EBNF) is 
this true ?


Since I like Haxe (at least the language, not the OCaml impl.) I would 
like to use your grammar to create a PEG port.

(based on https://github.com/PhilippeSigaud/Pegged)

So ...May I reuse your Gold Haxe grammar ?
I would like to create Haxe to D and eventually HLA translator. The 
final goal is to create a factory pattern based Haxe2XXX translator.


Bjoern..


Re: [OT] Just curious: What's this algorithm's name?

2012-04-04 Thread bls

On 04/03/2012 10:33 PM, Nick Sabalausky wrote:

Suppose you have a directed graph, which may have cycles, and you want to
compute something for each node. But the final result for each node is
dependent on the final results for each of the nodes it points to. (It may
sound like this would just cause an endless feedback loop ie infinite
recursion whenever there's a cycle, but there are applications of this where
that isn't a problem. Ie, in cases where the computation stops recursing
when it gets back to itself.)




Had to find my R. Sedgewick and N. Wirth  Algorithm books..  But: these 
books do not even give a hint. Nada.


However the problem you describe smells like something for which the the 
Chain of Responsibility Pattern is made for.


Though  this pattern requires a break condition 'cause you wont an 
endless search of an responsible

( Finally We are programmers, not politicians )

I have a hard time to image how your Graph Node might look.

SOOOo... Here you go


Re: Simulating multiple inheritance

2012-04-01 Thread bls

On 03/31/2012 10:05 AM, Andrej Mitrovic wrote:

This is related to wrapping wxWidgets.

One issue with the new wxWidgets 2.9.x series is that there seem to be
more multiply-inherited classes than before


As Jacob already said mixin templates and Interfaces are the way to go.
I think you have to define the mixin template as
*mixin* template mixin_name.

interface Baz
{}

mixin template Baz()
{
// In case that you need to access the parent class
alias typeof(this) ThisClass;
}

class Bar
{}

class Foo : Bar , Baz
{
mixin Baz;
}

Good to know that you are still develop the wxWidget bindings. Keep us 
informed.


Re: Simulating multiple inheritance

2012-04-01 Thread bls

On 03/31/2012 10:05 AM, Andrej Mitrovic wrote:

One issue with the new wxWidgets 2.9.x series is that there seem to be
more multiply-inherited classes than before


A bit more complete snippet.

interface Foo
{
void doFoo();
}
// Foo implementation
mixin template FooMixin()
{
alias typeof(this) thisClass;

void doFoo()
{
thisClass.init();
}
}

class Bar
{
void doFoo() {}
}

class Baz :Bar, Foo
{
alias Bar.doFoo BarFoo;

mixin FooMixin;

void init() {}

}

hth


Re: UFCS for D

2012-03-30 Thread bls

On 03/30/2012 02:15 AM, Nick Sabalausky wrote:

Eh? Other people have voiced concerns over that since waaay back in even
pre-D1 times. In particular, many people have argued for allowing modules
with the same name as a package. Ie: you could have both module foo and
module foo.bar.


This is afaik similar to ADA child packages.
Quote :
Ada allows one to extend the functionality of a unit (package) with 
so-called children (child packages). With certain exceptions, all the 
functionality of the parent is available to a child. This means that all 
public and private declarations of the parent package are visible to all 
child packages.


Re: UFCS for D

2012-03-30 Thread bls

On 03/30/2012 05:06 AM, deadalnix wrote:

Le 30/03/2012 11:40, bls a écrit :

On 03/30/2012 02:15 AM, Nick Sabalausky wrote:

Eh? Other people have voiced concerns over that since waaay back in even
pre-D1 times. In particular, many people have argued for allowing
modules
with the same name as a package. Ie: you could have both module foo
and
module foo.bar.


This is afaik similar to ADA child packages.
Quote :
Ada allows one to extend the functionality of a unit (package) with
so-called children (child packages). With certain exceptions, all the
functionality of the parent is available to a child. This means that all
public and private declarations of the parent package are visible to all
child packages.


This sound interesting. And why not use public import for that ? It
wouldn't break any existing code, because it enlarge the field of
possibles.


Asking Nick or me ?

Anyway, you can't really compare the D module- and ADA package concept.
A D-ified ADA package could like like :

module Shelf {

module Disks {

}
module Books {

}
}

I am not an active ADA user but instead of having a single file you 
could use the D-ified Ada way...

module Shelf;
module Shelf.Disks;
module Shelf.Books;
instead. And I think this what Nick is talking about.

Having the same scoping rules.

http://en.wikibooks.org/wiki/Ada_Programming/Packages



Re: Adam Wilson is now a GSoC 2012 mentor!

2012-03-26 Thread BLS

On Monday, 26 March 2012 at 15:27:29 UTC, Andrei Alexandrescu
wrote:
We're very happy and honored to had Adam Wilson on board as a 
GSoC 2012 mentor. Adam brings solid project management 
experience and has a specific interest in the Mono-D project.


Please join me in welcoming Adam to the ranks of GSoC mentors!


Thanks,

Andrei


On 03/26/2012 08:27 AM, Andrei Alexandrescu wrote:
We're very happy and honored to had Adam Wilson on board as a 
GSoC 2012 mentor. Adam brings solid project management 
experience and has a specific interest in the Mono-D project.


Please join me in welcoming Adam to the ranks of GSoC mentors!


Thanks,

Andrei


Welcome Adam and congratulation Alex.

I am using Mono-D and I almost enjoy it.  One thing is for sure:
Code LookUp /
Intellisense is great in Mono-D, ,Code outline simply rox, and
MNono-D is (in this regard) light years ahead of Visual D.

The pure speed  in which Alex's code analyzer is working is just
xtreme amazing. Alex ? Benchmarks ?

But it is a GTK# and  MONO based project and this means it is
finally a C# project.

I am pretty sure that we will have a complete wxWidgets 2.9.3
binding in a few days/weeks.  (and we will have a TOOL to create
almost automatic wxWidgets 2.4. 2.5, 3.0 bindings)  incl. say Gtk
3.0 and iOS support)

So. wouldn't make more sense to ask Alex to port and enhance  his
code analyzer into D2  as GSOC project  to become part of a wxD2
driven IDE ?
I think, Yep.
Despite that,
Alex, thanks for Mono-D, very well done.
My 2 cents, Bjoern


Re: Adam Wilson is now a GSoC 2012 mentor!

2012-03-26 Thread bls

On 03/26/2012 01:11 PM, Kapps wrote:

And one of the very nice things about Mono-D is that the parser is
completely standalone. It would not be difficult to integrate into
Visual Studio in the future


Well, I am almost on Windows.(Not valid for all of us)
(AFAIK) almost everyting to integrate D into Visual Studio is done in D. 
(incl. IDL stuff) correct if I am wrong. So yes... Alex's code Analyser 
should fit. as NET assembly But as well as D shared linrary


Writing a State of the Art D2 IDE will not necessarily require  a 
million lines of code .


I am convinced that developing in wxD2*** code  will be very close to 
what you do in wxPython, maybe even smarter.


But I am loosing the point. Even if Alex carries on in Mono-D during 
GSOC it is a good thing. And.. if we are not able to translate C# stuff 
into D2 than the D2 design fails..




Re: Adam Wilson is now a GSoC 2012 mentor!

2012-03-26 Thread bls

Hi,
to make it absolutely sure !! I hope that Alex's project will make it.

(and as one who has worked on a concrete project with Alex, having 
several private phone conversations, I am sure that Alex will deliver 
pretty cool stuff. Most probably more than one might expect.)



On 03/26/2012 03:00 PM, Adam Wilson wrote:

ono is over a million, Visual Studio is almost as much as the Windows
Kernel (5m+ IIRC), and Eclipse ... well I don't what they are doing
wrong over there but the bloat is epic.
In other words, a good IDE is a massively complicated beast.
Integrations are much quicker and we don't have to reinvent the wheel
all over the place.



IMO this is questionable. What do you count as required LOC ?
Say this is what could be done by Plug-Ins.

SVN / GIT  support,
Database Explorer,
ER Designer
UML Designer
XML/XSL support
SOAP/REST support
etc.

So the core IDE has to support a flexible Doc/View Model a Plug-In 
Architecture, and Source code analysis.

Maybe an internal project-management that supports a build/make tool.
Debug Support.
Period.
All that visual stuff, say panel docking, gui persistence has not to be 
written from the scratch.. It is part of the GUI lib.


Exotic stuff,  You want the best ever Ultimate Development Environment.
Say you want Realtime developer collaboration/Video conferencing ... a 
piece of cake in Python (using async IO/ XMPP ) No rocket science at 
all.




I am convinced that developing in wxD2*** code  will be very close to
what you do in wxPython, maybe even smarter.

But I am loosing the point. Even if Alex carries on in Mono-D during
GSOC it is a good thing. And.. if we are not able to translate C#
stuff into D2 than the D2 design fails..



Actually, I'm porting the ANTLR Runtime from C# to D right now. The
languages are VERY similar, where the whole thing falls apart is the
standard library, or the fact that Phobos is brutally underpowered
compared to the .NET BCL. I wrote a List(T) class just to make the pain
stop.


Well, here I definitely should shut up.. std.collections... Anyway from 
time to time I think it would make sense to port the MOMO/NET collection 
stuff into D. Simply to make porting of dot net code possible without 
too much pain.  but that's an other story.


Thanks for being a Mentor for this Project.


opDispatch(string name, E...) (E e) question.

2012-03-25 Thread bls

How do I call opDispatch(string name, E...)(E elements) ?
What I want to archive is to call f.i. fm.list with an arbitrary number 
of arguments without using


fm.list(1, abc, 4L, 3.33);

Instead I would prefer
fm.list = (1, abc, 4L, 3.33);

Is this somehow possible ?

import std.variant;
import std.conv;

auto fm = FlexMap();

fm.ten = 10;
fm.ten = [Ten, Zehn, Tein];
fm.list = [20, 10, 2, 2, 44 ] ;
fm.list = Hello opDispatch;

struct FlexMap
{
Variant[] [string] map;

Variant[] opDispatch(string name)()
{
   return map[name];
}

Variant[] opDispatch(string name, E...)(E elements)
{
foreach(element; elements)
map[name] ~= to!Variant(element);
return map[name];
}

Variant[] opDispatch(string name, T) (T t)
{
map[name] ~= to!Variant(t);
return map[name];
}   
}



Another question :
How do I bring in :

opDispatch(string name, T) (T[] t)

into FlexMap ?

TIA, Bjoern


Re: opDispatch(string name, E...) (E e) question.

2012-03-25 Thread bls

On 03/25/2012 02:04 PM, James Miller wrote:

On 26 March 2012 09:45, blsbizp...@orange.fr  wrote:

How do I call opDispatch(string name, E...)(E elements) ?
What I want to archive is to call f.i. fm.list with an arbitrary number of
arguments without using

fm.list(1, abc, 4L, 3.33);

Instead I would prefer
fm.list = (1, abc, 4L, 3.33);


You can use @property on opDispatch to use setter/getter notation,
however I wouldn't rely on that functionality long-term if you want to
keep the same function-call syntax (since -property flag is supposed
to enforce proper parenthesis use on `@property`s).


fm.list = (1, abc, 4L, 3.33);


I'm hoping you mean `fm.list = [1, abc, 4L, 3.33];` I think that
using the right template parameters, you can use the same code for
(T...)(T el) and (T)(T[]), I just can't remember what that is...



Ouch, yep, I mean [1, abc, 4L, 3.33]
But I have no clue how to implement it.



Another question :
How do I bring in :

opDispatch(string name, T) (T[] t)


--
James Miller


(T) (T[] t) AND (T) (T t) seems not to work.
snip
struct FlexMap
{
Variant[] [string] map;

Variant[] opDispatch(string name)()
{
   return map[name];
}

Variant[] opDispatch(string name, E...)(E elements)
{
foreach(element; elements)
map[name] ~= to!Variant(element);

return properties[name];
}

Variant[] opDispatch(string name, T) (T t)
{
map[name] ~= to!Variant(t);
return map[name];
}   
// No go
Variant[] opDispatch(string name, T) (T[] t) {}

}


Re: opDispatch(string name, E...) (E e) question.

2012-03-25 Thread bls

On 03/25/2012 02:59 PM, James Miller wrote:

Ok, so looking here:http://dlang.org/function.html, I have determined
that, if you are using Variant arrays (though I'm not sure if you can
do that using literals...) you can use the syntax from this example:


Thanks James..
will give it tomorrow a new try.

At least
Variant[] va =  [1, 2.3222, abc];

is not working.

Guess I have to give up the opDispatch() thing and create it a bit more 
traditional :)



Bjoern

oh, beside you mean :
opDispatch(string name, T) (T[] t...)


Re: opDispatch(string name, E...) (E e) question.

2012-03-25 Thread bls

Thanks Artur,

On 03/25/2012 03:18 PM, Artur Skawina wrote:

On 03/25/12 22:45, bls wrote:

How do I call opDispatch(string name, E...)(E elements) ?
What I want to archive is to call f.i. fm.list with an arbitrary number of 
arguments without using

fm.list(1, abc, 4L, 3.33);

Instead I would prefer
fm.list = (1, abc, 4L, 3.33);

Is this somehow possible ?


Well, you can do

template ID(A...) { alias A ID; }

fm.list = ID!(1, abc, 4L, 3.33);

but is that any better than your first version above?...

Not sure...

Maybe if we rename it
fm.list = Values!(1,2,true);

But I does not work..  Seems I am not able to figure out the opDispatch 
signature.


Think I will rewrite it without using opDispatch.



artur




Re: Pegged: Syntax Highlighting

2012-03-17 Thread bls

On 03/17/2012 01:53 PM, Philippe Sigaud wrote:

Does anyone have experience with other languages similar to D and that
offer AST-walking? Doesn't C# have something like this?
(I'll have a look at Scala macros)



Hi Philippe.
Of course the visitor pattern comes in mind.

Eclipse (Java) uses a specialized visitor pattern  called hierarchical 
visitor pattern to traverse the AST.


The classic visitor pattern has the following disadvantages :

-- hierarchical navigation -- the traditional Visitor Pattern has no 
concept of depth. As a result, visitor cannot determine if one composite 
is within another composite or beside it.


-- conditional navigation -- the traditional Visitor Pattern does not 
allow branches to be skipped. As a result, visitor cannot stop, filter, 
or optimize traversal based on some condition.


Interesting stuff at :

http://c2.com/cgi/wiki?HierarchicalVisitorPattern
You'll find some implementation details at the bottom of the doc.
hth Bjoern


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-17 Thread bls

On 03/16/2012 06:29 PM, Andrej Mitrovic wrote:

So, stay tight! Good times ahead.:)


Incredible good news! Thanks.

One of the very first wxD applications could be a GUI for the generator.





Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-17 Thread bls

On 03/17/2012 09:50 AM, Jacob Carlborg wrote:

This is why a proper compiler is needed, this will not work in the long
run.


Are you aware that doxgen's xml output is based on gcc-xml ?

I think it is necessary to say that doxygen, respective gcc-xml, is 
working on stripped and annotated header files (so called interface files)

f.i. http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/interface/wx/

So, stupid manual work is needed to create these interface files.

Until you don't have a heavily templated c++ lib, using doygen's xml 
output is, IMHO, a reasonable way to create bindings.


well, will see


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-17 Thread bls

On 03/17/2012 10:44 AM, Jacob Carlborg wrote:

On 2012-03-17 18:36, bls wrote:

On 03/17/2012 09:50 AM, Jacob Carlborg wrote:

This is why a proper compiler is needed, this will not work in the long
run.


Are you aware that doxgen's xml output is based on gcc-xml ?


No, I was not aware of that. What is the problem then, doxygen choking
on the XML or GCC choking on the include files?


I think it is necessary to say that doxygen, respective gcc-xml, is
working on stripped and annotated header files (so called interface
files)
f.i. http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/interface/wx/

So, stupid manual work is needed to create these interface files.


That sucks.

 Yeah it sucks, but on the other hand it is AFAIK just removing the 
private stuff (methods, decls,  etc.) forward decls, and write some 
annotations.. like @iOS-only from the header.


I really hope to see a working wxD soon. I will try to create bindings 
for the wxShapeFramework than..




Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-17 Thread bls

On 03/17/2012 10:44 AM, Jacob Carlborg wrote:

What is the problem then, doxygen choking on the XML or GCC choking on
the include files?


gcc-xml is stalled. Means newer C++ stuff is not supported.

See news...
http://www.gccxml.org/HTML/News.html


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-03-17 Thread bls

On 03/17/2012 10:51 AM, bls wrote:

Are you aware that doxgen's xml output is based on gcc-xml ?


I should be more carefull :( It's another wxWidgets utility that is 
using gcc-xml.


Re: Dynamic language

2012-03-15 Thread bls

On 03/15/2012 12:09 AM, so wrote:

Hello,

Not related to D but this is a community which i can find at least a few
objective person. I want to invest some quality time on a dynamic
language but i am not sure which one. Would you please suggest one?

To give you an idea what i am after:
Of all one-liners i have heard only one gets me.
The programmable programming language. Is it true? If so Lisp will be
my first choice.

Thanks.


Why not having both D and Lisp (embedded).
Have a look at newLisp at http://www.newlisp.org

Quote
newLISP can be compiled as a shared library. On Linux, BSDs and other 
Unix flavors the library is called newlisp.so. On Windows it is called 
newlisp.dll and newlisp.dylib on Mac OS X. A newLISP shared library is 
used like any other shared library.


The main function to import is newlispEvalStr. Like eval-string, this 
function takes a string containing a newLISP expression and stores the 
result in a string address. The result can be retrieved using 
get-string. The returned string is formatted like output from a 
command-line session. It contains terminating line-feed characters, but 
but not the prompt string.

End Quote

Would be interesting to implement a toSExpression() template than ... :)






QR code based twitter --slightly OT

2012-03-02 Thread bls
Twitter messages are pretty limited, so I think it could make sense to 
implement a QR code based twitter like information-service. D could be 
the tool of choice, But does this idea makes sense at all ? I Think so, 
but would like to hear your opinion.

TIA
Bjoern


Re: Lexer and parser generators using CTFE

2012-02-28 Thread bls

On 02/28/2012 12:36 AM, CTFE-4-the-win wrote:

We need to have a easy-to-use, complete, seamless, and efficient
lexer-parser generator combo in Phobos, pronto. The lexer itself could
use a character-level PEG or a classic automaton, and emit tokens for
consumption by a parser generator. The two should work in perfect tandem
(no need for glue code). At the end of the day, defining a complete
lexer+parser combo for a language should be just a few lines longer than
the textual representation of the grammar itself.


Are you aware of Philippe Sigaud's PEG work (may become part of his 
template book)


Quote  Philippe ..
I recently wrote a parsing expression grammar module in D, also to 
create grammars and parsers at compile-time and parse inputs at CT.


(PEG: http://en.wikipedia.org/wiki/Parsing_expression_grammar)

Usage is like this:

mixin Grammar(
  JSON - '{' ( Pair ( ',' Pair )* )? '}'
, Pair - String ':' Value
, Value - String / Number / JSON / Array / True / False / Null
, `True - true`
(..., rest of JSON grammar)
);

enum result = JSON.parse(
`{ Hello:42,
World!:
{
a:[0,1,2,3]
}
}`);


End Quote
No that bad :) , I think.

Well, I am still a fan of EBNF based parser generators (recursive 
decent) but that's an other story. If I recall correctly BCS has created 
something working. ( BNF , so limited)


std.collection lets rename it into std,ridiculous.

2012-02-19 Thread bls

Hi
What's  the problem to implement some very basic containers ?
And No !! Don't waste time to tell about built in Arrays and Associative 
arrays, I am following D for at 5 years now..


What I definitely don't get is
queues, stacks and dequeues, and also specialized kind of  stacks/queues 
 don't depend on ranges. Why we don't habe them.

Everybody, using D for serious purposes, is creating home brewed stuff.

But fuc da duc..

the whole Range collection stuff is completely undefined.

All we know right now is that Algorithms are working on 
data-structures. (Pretty new, beside)


//First incarnation ..
public class Deque(T)
{
private class Node()
{
T _value;
Node _previous;
Node _next
}
}
Yep..
should be

final public class Deque(T)
{
}

We are still not there ..
struct Node()

final class Deque(T, alias allocator)
{
}
// Let's range-i-fy it ... and here we are

final class Deque(T, alias allocator) : IXXXRange|T
{
 // push and pop without sense.. what is enqueue now ?
}

Shit. all I want is a generique Queue

The std.collection situation is a shame,
Bjoern


Re: std.collection lets rename it into std,ridiculous.

2012-02-19 Thread bls

On 02/19/2012 03:40 PM, Yao Gomez wrote:

Eagerly waiting your contribution, preferably through a pull request, to
remedy this unfortunate situation.


OK,
Will do. All I need is guide to Range-Interfaces. (and a good reason why 
I should iterate over stacks and queues)


But wait. Despite that : Are final classes the way to go ? I don't know. 
Is it written in the sand or is it the new golden rule ?


What about the allocator ? Who knows... But shit isn't dcollections 
showing the way how to implement flex. allocator on demand. ?


You know it. Everybody is able to contribute to std.collections. But 
thanks to the ignorance here and there, std. collection is still a joke. 
Period.


Bjoern


Re: std.collection lets rename it into std,ridiculous.

2012-02-19 Thread bls

On 02/19/2012 04:05 PM, Bernard Helyer wrote:

Maybe when you learn to type like an adult people will listen to you?



Facts, that's what I am are talking about. If you don't like my speak 
...sorry.

My point is that D2 needs asap a working container/collection lib
(and I think the How to allocate/de-allocate question becomes more and 
more ridiculous.  That Stuff is meanwhile library based.. Typedef f.i.)


So why not plug- in an allocator. ?


Re: std.collection lets rename it into std,ridiculous.

2012-02-19 Thread bls

On 02/19/2012 04:20 PM, James Miller wrote:

On 20 February 2012 13:05, Bernard Helyerb.hel...@gmail.com  wrote:

Maybe when you learn to type like an adult people will listen to you?



Its also worth mentioning that most structures are simple enough that
for 99% of purposes, a homebrew implementation is fine. I was taught
how to implement a queue and a stack at the same times as using it,
that is how simple some of these containers are. And if you need
massive speed, then you probably wouldn't use generic containers
anyway...


Sure thing.. for a while, What if you have to manage a bigger piece of 
software, 20 peiple project . Would nt it be better to use a default 
container having a dedicated interface. Sanity wise ?

--
But this is not my point. I think that std.container/collection is a 
shame (to whom it may concern)





Re: std.collection lets rename it into std,ridiculous.

2012-02-19 Thread bls

On 02/19/2012 03:40 PM, Yao Gomez wrote:

agerly waiting your contribution, preferably through a pull request, to
remedy this unfortunate situation.


Still waiting for an answer.. Show me the Quality assurance table for 
collections.
This can't be difficult for You, since yoy know how to design it.. And 
finally there is SList, Still En Voque ?





Re: std.collection lets rename it into std,ridiculous.

2012-02-19 Thread bls

On 02/19/2012 04:48 PM, Bernard Helyer wrote:

On Monday, 20 February 2012 at 00:29:20 UTC, bls wrote:

On 02/19/2012 04:05 PM, Bernard Helyer wrote:

Maybe when you learn to type like an adult people will listen to you?



Facts, that's what I am are talking about. If you don't like my speak
...sorry.
My point is that D2 needs asap a working container/collection lib
(and I think the How to allocate/de-allocate question becomes more
and more ridiculous. That Stuff is meanwhile library based.. Typedef
f.i.)

So why not plug- in an allocator. ?


When you use words on the internet people judge you based on your words.
There's more to proposals than technical merits, and if you don't
understand that that's fine, but don't be surprised when people dismiss
you quickly. People filter information because they have to -- they'll
take any excuse to ignore you. Don't make it _easy_ for them.


Mo excuse. Be assured, and there is no doubt  that I will name shit 
SHIT. I live in a free country.

Any substantial feedback ?



Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-02-15 Thread bls

On 02/15/2012 06:53 AM, Andrej Mitrovic wrote:

On 2/11/12, Andrej Mitrovicandrej.mitrov...@gmail.com  wrote:

132+ are left to go.


55 left. This is the harder part now since most of these left are
interface mismatches and not codegenerator bugs. As you can see I've
started filing reports with patches:
http://trac.wxwidgets.org/query?reporter=dreyorder=priority


Excellent. Most of your patches are already accepted and closed.

Seems you are a bug fixing machine. Let me quote Vladimir Zeitilin..
I was trying to close these reports as you find them but it looks like 
your speed has picked up so it's going to be more difficult for me to 
keep up now


:)

I have a couple of questions, but I think I have to wait until wxC is 
done. Thanks Andrej.


Re: Review of Jose Armando Garcia Sancio's std.log

2012-02-14 Thread bls

On 02/13/2012 07:50 AM, David Nadlinger wrote:

Known remaining issues:
  - Proof-reading of the docs is required.
  - Not yet fully tested on Windows.

Depends on: https://github.com/D-Programming-Language/druntime/pull/141
(will be part of 2.058)


This is somehow bad. Review a piece of library-software by using a beta 
compiler and beta-library.


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-02-12 Thread bls

On 02/12/2012 03:04 AM, Andrej Mitrovic wrote:

For wxc I'll have to provide both static and shared library support.



Perfect!


win32-only: I've tried statically linking 2.9.3 via optlink but it
couldn't handle the vast amount of symbol names. Even if that was
resolved (it won't be) I can't use optlink anymore since wxWidgets has
basically dropped support for DMC, and I have to use either g++ or MSC
to build wxWidgets. Remember that Optlink can't link to COFF. The
alternatives that I know of are DMD+Unilink + static/dynamic library,
DMD+Optlink + dynamic library, or GDC + static/dynamic library.
There's also LDC but I haven't used it for D2 yet.



I think GDC is the tool of choice for wxd win32 and 64 development 
anyway. so i would use GDC. I meant _using_ wxD. Building wxD is most 
probably also more comfortable using GDC.


Event-Handling. Yesterday I had a look at the old wxd source from 
Anders. wxevent.d looks already very promising.


Thanks,
Bjoern


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-02-11 Thread bls

On 02/11/2012 11:45 AM, Andrej Mitrovic wrote:

Just a small update:

542 classes are successfully generated (and buildable). 132+ are left to go.

I've ran into a few issues where the interface files (from which the
xml is built) are not in sync with the code. So there might be missing
types definitions, or wrong types in methods, etc. But these can be
worked around by adding extra type definitions in the generator (IOW
there's no need to manually touch the .cpp files by hand).

So wxc won't be done by this week, but it's progressing pretty good so
far. Stay tuned..


Chapeau Andrej !

Silly Question .. did you try to  to use regen (or however it is named) 
script to re-create the doxygen xml files ?


Another question regarding wxC. Will there be an option to generate a 
shared library so/dll ?


Thanks (and please keep us informed.)
Bjoern




Re: std.uuid is ready for review

2012-02-07 Thread bls

On 02/02/2012 01:26 PM, Johannes Pfau wrote:

Hi,

std.uuid is ready to be reviewed. As far as I know there's nothing
being reviewed right now, so we could start the review as soon as
a review manager has been found.

About std.uuid (copied from the module documentation):
-
This is a port of boost.uuid from the boost project with some minor
additions and API changes for a more D-like API. A UUID, or Universally
unique identifier, is intended to uniquely identify information in a
distributed environment without significant central coordination. It
can be used to tag objects with very short lifetimes, or to reliably
identify very persistent objects across a network. UUIDs have many
applications. [...]
-

Code: https://github.com/jpf91/phobos/blob/std.uuid/std/uuid.d
API-Docs: http://dl.dropbox.com/u/24218791/d/src/uuid.html

Note: The code and documentation for shaUUID has already been written,
but until phobos has support for SHA1, that can't be included. The code
is currently commented out in the source file (it's well tested
with some 3rd party SHA1 code), but the documentation for those
functions is included in the API-docs. I think those functions should
be reviewed as well, so that it's possible to add them to phobos with a
simple pull request at a later date.

Note2: std.uuid also need this pull request:
https://github.com/D-Programming-Language/phobos/pull/398
It adds a isRandomNumberGenerator template to detect if a template
parameter is a random-number generator type.





Vote + (yes, works fine)

I want it and I need it. A Databases Access Layer (may it be a full 
blown  ORM  or even just a (D)ata (A)ccess (L)ayer ) depends on having 
unique IDs. ?


A convenience wish : string OID = GetUUID(); // RA UUID



OT Adam D Ruppe's web stuff

2012-02-07 Thread bls
You know it, web stuff documentation is a weak point. web stuff looks 
very interesting ...  so a real world sample app would be nice..


I would like to see a sample RIA -  M- V-C  wise, using (say using dojo 
dijit as View layer ) in conjunction with the D web stuff . (Model- 
Controler)


I think atm your library is not made for the masses, but it would be 
nevertheless interesting to see how someone can glue backend (web stuff) 
and frontend stuff (dojo/dijit) together.

thanks for reading.


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-02-06 Thread bls

On 02/06/2012 03:06 AM, Andrej Mitrovic wrote:

On 1/26/12, blsbizp...@orange.fr  wrote:

Hi Andrej,
first of all : it is NOT my intention to pick on your nerves.
I am just curious and , ahem, a bit impatience.

Have you made some progress on the code generator ?
Are you running into problems, hard to solve problems ?

Well, it would be nice to get some feedback. I am really keen to see the code. 
(cause I'll try,based on your code, to create bindings to the 
wxShapeFramework... )
Kind regards,
Bjoern (bls)
PS Have you noticed the wxPHP update.
PPS Wouldn't make more sense to use the new Tango 2 'cause it has XPath support 
? Given XPath support is imited, but I think good enough for this task.


I'm working on this around the clock. If everything goes ok I might
have the wxc wrapper done by the end of the week, but I'm not making
any promises.

I'm not having much difficulty, there are some edge-cases here and
there but it's fine. PS: Yes, however I'm now basing the wxc generated
code around the existing wxc binding, and not wxPhp. wxPhp uses some
3rd party library that has to do a lot of magic to interact with a C
library, so it's code generators are not that useful to me. The
existing wxc bindings already have memory management in place which I
can reuse. PPS: I'm parsing the xml files fine, there's no need to use
tango at this point.

I'm not publishing any code yet since I don't want people to do
duplicate work and make pulls, we'll end up stepping on each other's
toes. And work can't be done in parallel since you need wxc before you
can generate wxd wrappers.

I'd ask for a little bit of patience! Thanks. :)


Very very good news. Thanks Andrej


Re: what is a usage pattern for static in an interface?

2012-02-03 Thread bls

On 02/03/2012 04:00 AM, Jonathan M Davis wrote:

D interfaces_do_  allow for function implementations under certain
circumstances.

- Jonathan M Davis


A code snippet please.


Re: Class Initialization

2012-01-31 Thread bls

On 01/31/2012 12:41 PM, Trass3r wrote:

*whispers gee dee c*


windows binaries please...


Re: A tutorial on D templates: updates

2012-01-30 Thread bls

On 01/29/2012 12:44 PM, Philippe Sigaud wrote:

Hello,

I posted there a few weeks ago about a tutorial on D templates I put in github:

https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/dtemplates.pdf

Since then, I received numerous mails, issues, advices and thanks. Thank to you 
all!

Following the ideas found in TDPL, I wrote a D script to extract and test all 
the samples
presented in the document. I'm proud to say that right now, all named (module 
XXX;) samples
compile, which makes for more than 200 modules tested! Indeed, you could see 
the entire document
as a huge package documentation :)

I also added explanations, new sections and a new appendix in D templates 
resources.

As before, do not hesitate to read, comment, post and even send pull requests, 
I'm all ears.

Bye,

Philippe


First of all thank you so much for this wonderful book!

I would like to ask for a little enhancement regarding mixin templates. 
see snippet.
The second mixin template RandomAccessList is slightly OT 'cause 
Ranges are also touched, but I think this could be very interesting stuff.
A third mixin template example which comes in mind is the Publisher 
subscriber pattern template.


snip.
import std.stdio;
import std.cstream;

void main(string[] args)
{
// showing mixin template scope.
auto bar = new Bar();
writeln(bar.onClick());
din.getc();
}

mixin template FooMixin()
{
void init()
{   
}
string onClick()
{
return Clicked;
}
}

class Foo
{
mixin FooMixin;
}
class Bar : Foo
{

}


// Something more interesting : Mixin templates and ranges

mixin template RandomAccessList()
{

alias typeof(this) Me;

//Either
static private Me[] MeArray;
//OR
private Me next, prev;

}
interface IRandomAccessRange {}

class Contacts : IRandomAccessRange // Contacts not Contact !
{
 mixin RandomAccessList;

}



Re: A tutorial on D templates: updates

2012-01-30 Thread bls

Hi Philippe,
Ok, something more interesting it combines suggestion 2)  and 3). Still 
a quick hack, not much tested, but I think the intention is clear.


The snippets show how a publisher subscriber pattern can be mixed in. 
Further it shows how a simple class could become a stack, queue, list etc.
The FooMixin was just to show (due to a question on D.Learn), how we can 
mimic partial C# classes.


import std.stdio;
import std.cstream;
import std.functional;

void main(string[] args)
{
auto  p = new PersonStack();

p.add(Hans, 42);// uses MIStack push(), MISubScriber notify()
din.getc();
}

mixin template MIPublisher()
{
alias void delegate(Object sender, string event) CallBack;
CallBack[] callBacks;

public void register(CallBack callBack)
{
callBacks ~= callBack;
}

// There is for sure a smarter solution to remove
public void unRegister(CallBack callBack)
{
for ( int i=0 ; !icallBacks.length ; i++ )
{
if (callBacks[i] == callBack)
{
callBacks = callBacks[0..i] ~ 
callBacks[i+1..callBacks.length];
--i;
}
}
}
// Notify ALL Subscribers
public void notify(string evt)
{

foreach ( CallBack callBack ; callBacks )
{
callBack( this, evt );
}
}
}

mixin template MIStack()
{
alias typeof(this) Me;
//alias Me[] Us;
static Me[] stack;


public:

bool empty()
{
return stack.length == 0;
}

int count()
{
return stack.length;
}

void push(Me element)
{
stack ~= element;
}

Me pop()
{
Me element = peek();
stack.length = stack.length - 1;
return element;
}

Me peek()
{
if ( stack.length == 0 )
{
// throw error
}
Me element = stack[stack.length-1];
return element;
}
}



class PersonStack
{
private string name;
private int age;

// Our Mixins
mixin MIStack;
mixin MIPublisher;

this()
{
// Register some subscribers (MIPublisher register function)
// I have used free functions to show the useful toDelegate()
register( toDelegate(DrawPersonBarChart) );
register( toDelegate(DrawPersonPieChart) );
}

// Push
void add(string name, int age)
{
this.name = name;
this.age = age;
// Push Person (MIStack push function.)
push(this);

// Notify all subscribers   
notify(Push);

}
// remove()
}

//Subscriber free functions
void DrawPersonBarChart(Object sender, string msg)
{
writeln(Bar  ~ msg);
}
void DrawPersonPieChart(Object sender, string msg)
{
writeln(Pie  ~ msg);
}


Re: Compile time filesystem access?

2012-01-30 Thread bls

On 01/30/2012 07:18 AM, Adam D. Ruppe wrote:

On Monday, 30 January 2012 at 14:24:32 UTC, Manu wrote:

I want to know if a library is present, and automatically disable
non-vital features if it isn't.


I'd like it too... here's what I tried. It doesn't
work, though.


I am afraid I miss the point but shouldn't module ctors help.. f.i.

module m;
import std.file;
static this()  // module ctor
{
if (/usr/share/include/my.lib.isDir)
import my;
else
import other;

}

Not tested!


Re: Partial classes

2012-01-30 Thread bls

On 01/29/2012 01:43 PM, Mars wrote:

Hello everybody.
Quick question, is there anything like C#'s partial classes in D?

Mars


As already said template mixins are close to partial classes.
A snippet. HTH

import std.stdio, std.cstream;

void main(string[] args)
{
auto bar = new Bar();
writeln(bar.onClick());

// Lets the user press Return before program stops
din.getc();
}

mixin template FooMixin()
{
void initCommonControls()
{

}
string onClick()
{
return Clicked;
}
}

class Foo
{
mixin FooMixin;
}
class Bar : Foo
{

}


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-01-28 Thread bls

On 01/28/2012 03:47 AM, Gour wrote:

On Sat, 28 Jan 2012 12:14:12 +0100
equi...@atw.hu wrote:


I just wonder dwt(http://www.dsource.org/projects/dwt) is not good
enough?


Well, I prefer wx over SWT and besides that, Jacob said he has other
  higher priorities at the moment besides working on DWT.


Sincerely,
Gour




DWT is not playing in the same playground (feature wise-platform wise) . 
So to answer your question Yes, DWT is not good enough.


Let me quote Gour :

Let's not forget that today the language itself does not mean much
without 'batteries included' and the whole ecosystem inckluding
IDE/editors suppor, build systems etc.

So, I would not minimize the fact to get
stable/actively_developed/easily_maintained bindings for native
multi-platform GUI toolkit. ;)


I have to agree.  100 percent
Bjoern


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-01-28 Thread bls

On 01/28/2012 07:12 AM, Jacob Carlborg wrote:

That doesn't stop others to work on DWT :)



No offense Jacob!
It is just that imo wxWidgets  is the most flexible gui toolkiy in town. 
and reading what is planned for 3.0 yum   iOS.. maybe AndroidBut 
despite that, DWT requires Java like programming in D (well, a matter of 
taste) . But also , NO dockable planes receptive, windows... week grid 
support, etc.. and so on, and so on. NO we need a full blown GUI and 
wxWidgets is,at least, a very good one.


a+
bjoern


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-01-26 Thread bls

On 01/25/2012 01:38 PM, Andrej Mitrovic wrote:

The Json parsing I've initially attempted was a mistake. I've assumed
the XML parsing would be harder than necessary, but I ended up
fighting wxPhp's arbitrary Json output (arrays holding objects of
different types.. which is no good for D, or my sanity).

Yesterday I've started working on xml parsing instead (using Vladimir
Panteelev's xml library) and now I have a full script that parses wx
doxygen files in pretty much the same way as the wxPhp script
(although the syntax is much nicer to work with).

I'm now in the process of testing the entire output to verify that
I've parsed the xml files correctly and loaded all the info in the
same way as wxPhp's xml script (basically I'm going to do some printf
diffs).

Once that is done I can begin working on porting the source_maker
script (obviously I can skip the Json part altogether since I have the
structures in memory already).


Andrej,
I can't await your SUCCESS message. For me your upcoming code is the 
most important stuff since years.
A few questions : where do I find Vladimir Panteelev's XML library ? 
Does this library support XPATH ?


Maybe it's too early but what do you think about replacing wxEvent with 
a D solution ?


I think about something similar to DGUI's event framework.  Same is 
valid for the wxWidgets sizer framework.


Enough now... Just want to say: Thanks man !


DStep

2012-01-26 Thread bls
Sorry for my ignorance but why should one use DStep instead of htod in 
order to port plain vanilla C headers ? I have to admit that I haven't 
tried DStep yet.

Did you try DStep on libxml2, respective libxslt ?

TIA,
Bjoern


Re: DStep

2012-01-26 Thread bls

On 01/26/2012 07:51 AM, Trass3r wrote:

Sorry for my ignorance but why should one use DStep instead of htod
in order to port plain vanilla C headers ? I have to admit that I
haven't tried DStep yet.


htod is Windows-only.


And it sucks.
For example it drops const, runs the preprocessor instead of turning
preprocessor directives into proper D equivalents, horribly messes up
the comments (esp. comments for enum members),...


Ok,Thanks for clarification! Seems that DStep is a missing link in the D 
tool-chain and should be part of the DMD package
I'll try DStep ASAP on libxml2 and libxslt. Will let you know how it 
works for me.

Thanks, Bjoern


Re: DStep

2012-01-26 Thread bls

On 01/26/2012 09:51 AM, Jacob Carlborg wrote:

On 2012-01-26 17:08, bls wrote:

On 01/26/2012 07:51 AM, Trass3r wrote:

Sorry for my ignorance but why should one use DStep instead of htod
in order to port plain vanilla C headers ? I have to admit that I
haven't tried DStep yet.


htod is Windows-only.


And it sucks.
For example it drops const, runs the preprocessor instead of turning
preprocessor directives into proper D equivalents, horribly messes up
the comments (esp. comments for enum members),...


Ok,Thanks for clarification! Seems that DStep is a missing link in the D
tool-chain and should be part of the DMD package
I'll try DStep ASAP on libxml2 and libxslt. Will let you know how it
works for me.
Thanks, Bjoern


DStep has nothing to do with XML. It uses the Clang C API to create D
bindings.



libxml2 is a plain c library
http://xmlsoft.org/

libxslt dito.
http://xmlsoft.org/XSLT/

?? May you mix it up. In order to create *bindings* to C++ libs doxygens 
xml output seems to be perfect.


To _port_ C headers DStep is probaly the right tool. But I just see that 
I have to build llvm and what the heck.. :(


Now, in order to parse doxygens xml output std.xml is not good enough. 
In other words it would be nice to have libxml2 as D lib available.





Re: Modern COM Programming in D

2012-01-25 Thread bls

On 01/24/2012 09:07 AM, Lionello Lunesu wrote:

Little over a year ago I held a tech talk at Microsoft about how I used
D to write readable COM code. A while back I thought I'd try to get
permission to share these slides, and what'dya know:

http://lunesu.com/index.php?/archives/126-Modern-COM-Programming-in-D.html

Direct link to the slides:
http://lunesu.com/uploads/ModernCOMProgramminginD.pptx

Let me know what you guys think!

Lionello.


Congratulations Lionello, This is not just a useful snippet. You have 
been able to explain all the D2 goodies in a reasonable context.


This code should have a home and live at Fine_Art_Of_D2_Programming.com
Very well done!
Thank You, Bjoern



Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-01-25 Thread bls

On 01/25/2012 09:07 AM, Trass3r wrote:

Whats.necessary to use D in order to create C++ bindings ?


github.com/jacob-carlborg/dstep


Quote 
DStep is a tool for converting C and Objective-C headers to D modules.

Well THAT'S nitty gritty :)

C++ as well ? How ? And maybe the most imp[ortant point when ?

Don't get me wrong Jacob. In case that dstep is working perfect for C++ 
hallelujah.


(I am nevertheless convinced that porting from XML output has several 
advantages. Multi pass code generation.


Bjoern
-
Slightly Off Topic  DWT (Keinfarbton) f.i. was born on a idea of mine. 
Frank and I have discussed the idea of using Java2XML (ANTLR based) to 
generate D code )


automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-01-25 Thread bls
I have to say that I am very disappointed regarding the feedback I got 
from from my wxWidgets good news message.


Here is a historical chance to enhance D's spectrum in a way that has 
been pipe-dream just a few month ago and the community feedback is : ) 
we are busy with optimizing bla bla. well..


Gregor Richards (some will remember) has written BCDGen. BCDGen takes 
GCCXML output to generated D bindings from C++.

GCCXML is stalled, and far away from being perfect.


But now that even PHP guys are able to create full blown wxWidgets 
bindings based on Doxygen XML Output ..I have to say that is a pity that 
we are not able to do the same.


Whats.necessary to use D in order to create C++ bindings ?
1) Let's give up to create a reasonable XML library in D. Instead I 
would like to suggest that we wrap libxml2. (pure C) Finally this is 
like using the curl lib. And in order to prarse the XML output we have 
necessary XPATH support.


2) Let's re-use Gregor's BCDGen, based on a Doxygen's XML output,instead 
of GCCXML.


3) Let's create a visual tool (a minimalitic IDE), string templates, 
etc. which enable us to create fine tuned D code.


This is indeed NOT  a weekend job. But keep in mind that every C++ 
library  which is doxygen wise commented, is available for automated D2 
binding generation.

Isn't that more important than ...
My2cents
Bjoern





Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-01-25 Thread bls

On 01/25/2012 10:01 AM, Zachary Lund wrote:

On 01/25/2012 11:41 AM, bls wrote:

On 01/25/2012 09:07 AM, Trass3r wrote:

Whats.necessary to use D in order to create C++ bindings ?


github.com/jacob-carlborg/dstep


Quote 
DStep is a tool for converting C and Objective-C headers to D modules.

Well THAT'S nitty gritty :)

C++ as well ? How ? And maybe the most imp[ortant point when ?

Don't get me wrong Jacob. In case that dstep is working perfect for C++
hallelujah.

(I am nevertheless convinced that porting from XML output has several
advantages. Multi pass code generation.

Bjoern
-
Slightly Off Topic DWT (Keinfarbton) f.i. was born on a idea of mine.
Frank and I have discussed the idea of using Java2XML (ANTLR based) to
generate D code )


I'm going to be rather straight forward on my opinion and, possibly, my
ignorance. I think C (or any language with no symbol mangling) is an
ideal language to create a library which is usable globally in almost
any language. I think C++ libraries are an ideal language to create a
library which is going to be used only within the C++ community because
of it's ill symbol mangling system. There is no right way to work with
C++ in D and although there are ways to interface with C++, I do not
think that is the ideal situation.

That being said, libraries like wxWidgets are very large and have been
acquired over several years of hardwork by a very large group. I do not
think that a GUI toolkit library should have to bother with networking,
sound, and so on. Also given the standard library D has, I think the
GUI library D can provide should use Phobos extensively rather than its
own mechanisms.

I think the ideal situation is to have a native D library. Creating
binds to a C++ library is only a temporary solution and is not ideal
both in implementation and in usage.

I do not mind using a C library in D because of how straight forward it
is. But simply mentioning C++ in D seems to add unneeded complexity
which should be avoided. I think the answer to a question such as
What's the alternative to Qt in D? should not be Qt bindings but
maybe a library which imitates the implementation and/or interface of Qt
UI widgets in native D.

Another problem this causes is the seemingly unneccessary time needed to
develop such libraries. I kinda regret saying this but using a C library
in an OOP wrapper can be optimal and easy to work with. Perhaps adding
to GTK+ as a C library for functionality that we want would be more
ideal than trying to mess with C++.

I personally think the SIMD feature is much more important than trying
to mess with C++.


Thanks for the  feedback.
well, I think we have very different views.

Unfortunately I am not a student anymore instead I am a unhappy tax payer.
To fulfill my Job I need GUI,RIA(WEB), Database and XML(SOAP) support. 
To say the least.  So pretty much everything D is not able to deliver 
atm. We are buying 3 party add ons in a few kilo bucks region and 
unfortunately we have to work with a Tool chain which is far away from 
being perfect.
In other words the D language is already offering more than we 
need,could be an option,  but the library situation is a disaster.


wxWidgets. Do you really care about wrapped vs native library ?
Do you think that the D community will ever be able to create a 
wxWidgets comparable native D lib. while not being able to spend some 
time in creating a binding generator ? I would be glad to have such 
bindings !


My 2 cents.


Re: automated C++ binding generation.. Booost D, NO , Not us. SIMD is more important.

2012-01-25 Thread bls

On 01/25/2012 11:06 AM, Gour wrote:

After researching a lot, I believe that wxWidgets is the best solution
for multi-platform development and I'll try to help as much as possible
those people trying to make it happen.


Sinvcerely,
Gour


Hi Gour thanks for the feedback,
Indeed.
wxWidgets in 2.9.3  has closed the gap to QT. (webkit, f.i.) The 
documentation is also very close to what QT has to  offer thanks to 
Doxygen. We should not forget that wxWidget is offering support for the 
RibboBar. (not that I like it too much)


I wonder how much sense it would make to port the PHP 
parser/codegenerator source (wxPHP) into python. At least it should 
result in : More readable code, xml instead of shitty json intermediate 
output for the D codegerator.
Despite that , developing a GUI tool to browse/modify the xml files is a 
piece of cake in wxPython.


Of couse I would be nice to use D. But the XML files are simply to big 
to do DOM parsing. XPATH is required.
Last thing. BCDGEN is using libxml2 to generate D code. and BCDGen was 
the tool to created the libxml2 wrapper. Eat your own Dog food. Good!


http://dsource.org/projects/bcd

Bjoern


Re: MS extend C++ significantly for Windows8... and Andrei got name drop

2012-01-25 Thread bls

On 01/25/2012 07:03 AM, Manu wrote:

This is fairly interesting. MS have extended their C++ compiler
significantly for Windows8 with a bunch of non-standard stuff.
FINALLY implement garbage collection, ref counting, properties,
delegates, events, generics, etc...
If other compilers adopt this tech, D loses some advantages.


But you still have to fight with ifndef ,forward declaration, and a 
template syntax against common sense.  Even if you paint shit yellow 
it's not necessarily gold.


Re: wxWidgets doxygen binding creation.

2012-01-23 Thread bls

On 01/21/2012 01:29 PM, Andrej Mitrovic wrote:

I'm porting the JSON scripts first. There are already JSON dumps that
the php script makes, so I'd like to take advantage of that


Porting the JSON output to ... [please insert target here ]
Back to XML :)
Well, I am not sure about how usable std.json is.

Can you tell about your progress, trouble, doubts  etc, please ?

Bjoern

--
IMHO it should be a straight forward task to create constants, enums, 
globals, and the extern C {}  wxWidgets wrapper library.


Creating the wxWidgets D class wrappers, well I think it is not exactly 
rocket science. But heck, maybe it's more difficult than it looks from a 
first view.

--
Just a few hours ago I found this : http://wxnet.sourceforge.net/apiref/
Move to :Related pages/Notes for contributors...
It's C#,out of date and DLL specific, but I think the Dispose()  related 
stuff is nevertheless interesting.


Re: wxWidgets doxygen binding creation.

2012-01-21 Thread bls

On 01/20/2012 01:09 PM, Andrej Mitrovic wrote:

So I'm trying to port those php scripts and see if it's usable for D.
When I have some scripts done I'll put them on github somewhere. Of
course I'm not stopping anyone else from doing the same..

Cool!!
Out of curiosity. libxml2 for XPath ?
--
I agree with you. Using the doxygen xml files to create the binding is 
for sure less problematic than using SWIG.


Bjoern


wxWidgets good news

2012-01-20 Thread bls
Hi, it seems that the idea of using doxygen xml output to generate D 
bindings was not that bad. I am pretty happy to see that exactly this 
happens in wxWidgets 2.9.4,

https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/make_bindings.py

Generating C functional wrappers is already pretty cool, but the 
fantastic news is SWIG output! As you may have noticed, SWIG has D 
support. Means :  No need to manually re-create C++ classes in D.


Holy crap.



Re: wxWidgets good news

2012-01-20 Thread bls

On 01/20/2012 05:33 AM, Jimmy Cao wrote:

2012/1/20 bls bizp...@orange.fr mailto:bizp...@orange.fr

  As you may have noticed, SWIG has D support. Means :  No need to
manually re-create C++ classes in D.

Holy crap.


Ah, kudos to David Nadlinger.


Ya sorry David , I couldn't remember your name.
Guess David's help is needed anyway to make wxWidgets 4D a success.



Re: wxWidgets good news

2012-01-20 Thread bls

On 01/20/2012 03:24 AM, bls wrote:

Hi, it seems that the idea of using doxygen xml output to generate D
bindings was not that bad. I am pretty happy to see that exactly this
happens in wxWidgets 2.9.4,
https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/make_bindings.py


Generating C functional wrappers is already pretty cool, but the
fantastic news is SWIG output! As you may have noticed, SWIG has D
support. Means : No need to manually re-create C++ classes in D.

Holy crap.



Random thoughts.
I think the challege will be to create a reasonable message system. The 
old WxD projects mimics the MESSAGEMAP() thing. I think a better 
solution would be to use wxWidgets connect() and to design a D-ish NET 
like message system. The cleanest D implementation I have seen so far is 
part of the DGUI project.


SWIG : I think we have to modify : 
https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/swig_tools.py 
a bit, in order to enable SWIG to generate D2 code.


Which wxWidget Version ?
IMO at least 2.9x to avoid the UNICODE - non UNICODE stress. Probably 
2.9.4 is the best choice (doxygen wise) which will arrive AFAIK in February.


How to setup the project ? just the modified Python scripts and some 
docs?  Dunno.


Thoughts ?


Re: wxWidgets good news

2012-01-20 Thread bls

On 01/20/2012 04:51 AM, Trass3r wrote:

Generating C functional wrappers is already pretty cool, but the
fantastic news is SWIG output! As you may have noticed, SWIG has D
support. Means : No need to manually re-create C++ classes in D.


Does SWIG D support static linking by now?


From the docs
20.10 Work in progress and planned features

There are a couple of features which are not implemented yet, but would 
be very useful and might be added in the near future:


Static linking: Currently, the C wrapper code is compiled into a dynamic 
library, out of which the symbol addresses are looked up at runtime by 
the D part. If statically linking the different languages into one 
binary was supported, a tool-chain capable of performing IPO at link 
time could inline the wrapping code, effectively reducing the overhead 
for simple calls to zero.


Maybe someone should send David some cookies :)


Re: wxWidgets good news

2012-01-20 Thread bls

On 01/20/2012 09:02 AM, Andrej Mitrovic wrote:

On 1/20/12, blsbizp...@orange.fr  wrote:

Hi, it seems that the idea of using doxygen xml output to generate D
bindings was not that bad. I am pretty happy to see that exactly this
happens in wxWidgets 2.9.4,
https://github.com/wxWidgets/wxWidgets/blob/master/docs/doxygen/scripts/make_bindings.py


All files in that folder are dated July 2009. Is there some newer
script you were referring to?



Wish I am able to send you more recent code :(

I have been a bit confused due to the last changes information on GIT.

Inspiration comes from
The wxDesigner  Blog  Documentation in Doxygen
http://www.wxdesigner-software.de/WoWoW30.html

2.9.3 changes.txt
- Documentation for wxWidgets has been converted from LaTex to C++ 
headers with Doxygen comments and significantly improved in the process.


SORRY !!!


Btw, wxPhp uses doxygen to generate its bindings but it has its own
set of parser scripts. They seem to be up to date compared to these
python scripts from 2009.


Unti version 2.8 x wxPHP is using GCCXML Output. The author is THINKING 
about using Doxygen's XML ouput.  Except a small PHP script there is 
nothing concrete atm.


*Update* Just had a look at 
http://wxphp.org/wxphp/blog/commit-of-new-version.


This means wxWidgets doxygen xml output is reality. And the old Python 
scripts are sill useful.


Again, sorry for being not careful enough.

Bjoern


Re: wxWidgets doxygen binding creation.

2012-01-20 Thread bls

Hi Andrej,
From : http://wxphp.org/wxphp/blog/commit-of-new-version

Theres a new xml parser as I wrote in some older news that extract the 
details of wxWidgets *doxoygen* documentation.



- The doxygen xml files can be used to create D bindings .


Re: OOP Windows

2012-01-16 Thread bls

On 01/16/2012 09:07 AM, Andrej Mitrovic wrote:

Oh I thought that tutorial was about MFC/ATL, but it seems to use the
regular C API. I might look into this to add it to the DWinProgramming
project if it's worthwhile.


I think it is worth a closer look.  Especially Bartosz Milewski 
ActiveObject class. https://www.relisoft.com/win32/active.html



OT @Andrej
The MONO folks are using Cairo to rebuild MS NET System.Drawing and 
System.Drawing2D. I wonder if this could be an approach for DGUI.

I quess my question is : using CAIRO or GDI+  as Graphic engine for DGUI.
TIA
Bjoern


Re: The book Programming in D is in beta

2012-01-12 Thread bls

Hi Ali,
Why not 1) just translate the example code into English. 2) Google 
Translate the text and 3) ask the native English speaking D community 
for a helping hand.
IMO the GOOGLE Turkish to English translation is translatable into 
readable English, without too much effort :)


So instead of wasting time with manual translation,  keep your book in 
sync with D2, add some examples..  It's an excellent book about D2 (and 
beside an exercise on how to write programming books in general)

A+
Bjoern

On 01/12/2012 12:51 AM, Ali Çehreli wrote:

I have continued the translation and added the following chapters:

* Floating Point Types
* Arrays
* Characters
* Slices and Other Array Features
* Strings

I have translated the following chapter as well, out of order:

* Templates

http://ddili.org/ders/d.en/index.html

Ali

On 11/13/2011 11:00 PM, Ali Çehreli wrote:
  I have been translating my Turkish D book D Programlama Dili to
  English under the title Programming in D. I have decided to make its
  current state available online:
 
  http://ddili.org/ders/d.en/index.html
 
  I will make more chapters available as they get translated.
 
  As the book is for the novice programmer, the chapters that have been
  translated so far will not be very interesting to you. For that reason,
  I have decided to skip a number of chapters and translate two from the
  later ones as well:
 
  Exceptions:
 
  http://ddili.org/ders/d.en/exceptions.html
 
  Ranges:
 
  http://ddili.org/ders/d.en/ranges.html
 
  I hadn't known that my English was so poor. :) Please be patient; the
  text is being edited by an expert English speaker and will continuously
  be updated as it gets corrected.
 
  I welcome any feedback at acehr...@yahoo.com and of course here.
 
  Thank you,
  Ali





Re: Taking a function or delegate as argument.

2012-01-10 Thread bls

On 01/10/2012 06:53 AM, Jacob Carlborg wrote:

On 2012-01-10 14:48, simendsjo wrote:

On 10.01.2012 14:43, Mike Parker wrote:

On 1/10/2012 10:05 PM, simendsjo wrote:

If I want to have a method taking a callback function, I have to
specify
if it should take a function or delegate even if I don't really care.
What's the best way to accept either? I cannot see any wrapper for
something like this in std.typecons.


The simple way:

void callback(int i, void delegate(int) dg)
{
dg(i);
}

void callback(int i, void function(int) fn)
{
void wrap(int j)
{
function(j);
}
callback(i, wrap);
}


Yeah, but a bit tedious.. I found toDelegate:
http://dlang.org/phobos/std_functional.html#toDelegate


Or make it a template parameter and check if it's callable using
std.traits.isCallable.


What's wrong with toDelegate ? Seems to be pretty handy.

//simple snip
import std.functional;

int main()
{
int delegate( int i) dg;
alias dg callback;
callback = toDelegate(test);
writeln( callback( 12 ) );
readln();

return 0;
}

int test(int i) { return 30 +i;}




Re: Automatic binding generation

2012-01-06 Thread bls

On 01/06/2012 12:34 PM, Piotr Szturmaj wrote:

Is should be possible to use debug info of a library to generate D or
other language bindings. Current approaches are SWIG, htod and/or manual
coding. The first two do not always work as expected (try using them to
make OpenCV bindings) as parser-based converters do not always support
all build environment details. Often, you need a fully capable C/C++
compiler to correctly parse headers.

Function information may be extracted from:

* PDB files using DIA SDK on Windows
* DWARF info using libdwarf or libdw on *nixes

Debug files contain information about functions, their argument types
and return types, about structs and classes/namespaces (C++). Recent
version of DWARF may even contain information about macros.

The usual binding creation would be simple:

1. build library using existing build environment with debug info
2. run converter to generate D bindings (this may be used to make C#'s
bindings as well)

Thanks to the 1st point we can avoid many incompatibilities with
SWIG/htod parsers as we get all symbols in one file. The whole process
may be automated in most circumstances. Eventually some fixup files may
be used to assist with conversion (similar to SWIG files, but without
enumerating everything).

Thoughts?


Sure,  not exactly what you have in mind, but at least an exotic thought
Source commenting - Doxygen XML output - XML to D.

This is not as obscure as one might think, F.I. - GCCXML based bindings. 
- Ages ago I've  talked with Frank (keinfarbton) about using Java2XML to 
automate SWT porting...






Re: Database developer's gentle view on D.

2012-01-02 Thread bls

On 01/01/2012 10:49 AM, Adam D. Ruppe wrote:

On Sunday, 1 January 2012 at 04:28:45 UTC, bls wrote:

WEB Development is for sure doable in D, reusable Frameworks are
nevertheless AFAIK not available.


What kind of features did you have in mind for this?



Hi Adam,
first of all: A happy and successful new year to you!
To answer your question  :
An SaaS application living in a Cloud-Space, preferred atm is Amazon EC. 
The database Back-End will be (most probably PostGreSQL)
WHY PostGres ? Callback notifications/ Server-side events ... not 
available in MySQL. (which you prefer in your framework)

Another point is DB replication, partial DB replication. #

The challenge for us is SaaS user management.
Due to the fact that we are supporting small companies(1-5 users) as 
well as huge,international acting companies the Saas Software has to scale.
I.E. From : I would give your Software a try. We need just the basic 
package ... to We want it all (and more); We are looking for a long 
term contract .
In detail this means we have customers who wish to rent just PARTs OF 
OUR SOFTWARE for a month, others would like to rent our Software for a 
year, including all features.


SOAP/REST  is (in our case) needed to f.i. obtain prices. (https 
tunneling seems to be good enough (tm) )The other need for SOAP/REST (I 
am not sure if should go this way) is to access the SaaS application to 
receive certain informations/to add an potential clients, reuests, what 
the heck. ) In this case we have to establish a WSDL/REST - maybe oData 
Service.  (I would  prefer REST)


---Still have a hangover from new years day, so that's it 4 the moment.

Indeed, I had your library in mind while talking about D for the WEB.
Bjoern


Re: Database developer's gentle view on D.

2012-01-02 Thread bls

On 01/01/2012 07:02 AM, Steve Teale wrote:

On Sat, 31 Dec 2011 20:28:43 -0800, bls wrote:


 Not yet available. In case that Steve Teale (and he did a dammed
good Job, as well as Piotr) will add std.database this will not change
the situation significantly. 'Cause std.database will contain just
rudimentary DB support..  A Database independent, ORM based library
module is not even matter of discussion. That's a  pity.



Bjoern,

Even being retired does not mean there's nothing else to do but D library
components. I didn't get back to you yet because I'm busy making
furniture for our expanding little enterprise here, and because of the
holidays, and because I need to lose a few kilos off the belly that
magically appeared while I was doing nothing but sit in front of a
keyboard.

Also I'd say for rudimentary I'd want to say basic. There's a slight
difference.

I'll be back.

Steve

But don't put the database stuff



Hi Steve,
first of all: A happy and successful new year to you!

What makes me a bit nervous is the use of structures in your source.
In case that your goal is to establish a D database access standard, 
client and server wise, Interfaces are the way to go.


Well, isn't  the right of the youth to be impatient :) (I am just 50)

So I am waiting for your feedback regarding the link I've send you. In 
my (in this case not so humble opinion) following this Design would make 
much sense.

Kind regards, Bjoern


Re: Database developer's gentle view on D.

2012-01-02 Thread bls

On 01/01/2012 12:22 AM, Jimmy Cao wrote:

GUI library for Windows.  Pretty easy to use.


... and should be named Forms4D

I definitely like this library. Pretty straight OOP, Each DOTNET Forms 
developer will immediately  feel at home. New liberal license. Just cool!




Re: Happy New Year in 2012....

2012-01-02 Thread bls

On 12/31/2011 09:34 PM, Andrei Alexandrescu wrote:

to the entire D community!

Andrei


And from France. A successful new year to all of you.
Bjoern


Re: Discussion on D at archlinux.org

2012-01-02 Thread bls

On 01/02/2012 08:15 AM, Andrei Alexandrescu wrote:

https://bbs.archlinux.org/viewtopic.php?pid=1034979

Andrei


C will reign supreme forever.

Feedback : - Oh cool, a talking dinosaur :)

Thanks man.


D Feed Feature request : Message SuperDan ification

2012-01-02 Thread bls
Maybe it's just me but I really miss SuperDan ...  respective all his 
incarnations.


SuperDanification is indeed not a piece of cake.

I think we could see this as  Natural language to DSL translation problem

Which could lead us, (being positive this year)  to a programming 
paradigm not yet part of our beloved multi-paradigm language.
Logic programming. Horn clause for rescue . TupleOfTupleTemplated 
Library based of course. :)

Makes sense ?



Database developer's gentle view on D.

2011-12-31 Thread bls

Not that you really need it.
Things move forward. Phobos becomes more and more reliable and usable, 
It seems that the accepting Foreign modules/Fixes situation is better 
than ever.  So it looks like things went into the right direction 
unfortunately not for me.


Let  me tell you in a second or two about my world.
Creating huge database based multinational applications   (likewise 
multinational/lingual Accounting - Order Sys.)


As said, I have to create Database applications,  consuming SOAP 
respective REST Services. Targets are Desktop(WIN only), WEB and Smart 
Devices. All of them have to interop.


So why not using D ? (Which I would like to do)

DB Support..
   Not yet available. In case that Steve Teale (and he did a dammed 
good Job, as well as Piotr) will add std.database this will not change 
the situation significantly. 'Cause std.database will contain just 
rudimentary DB support..  A Database independent, ORM based library 
module is not even matter of discussion. That's a  pity.


GUI..
Well for us Windoze is the only interesting Desktop platform.
A _reasonable_ GUI is not available yet.(D-GUI looks pretty good,though)
WEB Development is for sure doable in D, reusable Frameworks are 
nevertheless AFAIK not available.


Smart Device Development..
   (Win 7 mobile/ Android/ IOS ) GDC for rescue ? On Android D To Java ?

Consuming SOAP/REST..
 ATM std.XML is not really perfect. So going a step ahead and asking 
for parsing WSDL files to generate appropriate D code would not make too 
much sense.
Further : Some Services require Certificate authentication. Another  No 
Go. No Crypto lib.


Don't get me wrong, I like D!  Otherwise I would not have followed  D 
for meanwhile 5-6 years.


Without having an DB-Object Relational Mapper, Crypt/Decrypt- extended 
XML support, PDF creation, Reporting, and XML related tools and (mucho 
importante) localization support,  D is not an option for us  --at the 
moment.


 So ... Being a bit enthusiastic about D's progress ? Sure!
 Leaving the planet, went to outer space with a  D Type _2_ Rocket made 
by BOING engineer W.B. ?Risky ;)


A+
Bjoern


Re: Using delegate for WindowProc - possible ?

2011-12-29 Thread bls

On 12/28/2011 03:45 PM, Tal wrote:

Can I do something like this :
__
extern (Windows) LRESULT delegate (HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam) MyWinProcDelegate;

this() {
MyWinProcDelegate =Events;
}

extern (Windows) LRESULT Events (HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam) {
MessageBoxA(null , Success!!! , null ,0);
return DefWindowProcA(hWnd, message, wParam, lParam);
}
__

The Events() doesn't seem to fire... am I missing something ?


Maybe std.functional toDelegate() ?

auto DelegateToUse = toDelegate(Events);
Not sure how much sense this makes...

If I  recall correctly I have used

alias extern windows LRESULT delegate() callback;
callback = cbfunc;
As said I am not sure, hth Bjoern


Re: Using delegate for WindowProc - possible ?

2011-12-29 Thread bls

On 12/28/2011 03:45 PM, Tal wrote:

Can I do something like this :
__
extern (Windows) LRESULT delegate (HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam) MyWinProcDelegate;

this() {
MyWinProcDelegate =Events;
}

extern (Windows) LRESULT Events (HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam) {
MessageBoxA(null , Success!!! , null ,0);
return DefWindowProcA(hWnd, message, wParam, lParam);
}
__

The Events() doesn't seem to fire... am I missing something ?


ok next try : At least it compiles ..

import std.functional;

int main(string[] argv)
{



extern(Windows) int delegate() dg;
alias dg callback;
callback = toDelegate(test);




return 0;
}

extern(Windows) int test() { return 42;}

hth, bjoern


Re: Using delegate for WindowProc - Is possible and fun!

2011-12-29 Thread bls

On 12/28/2011 03:45 PM, Tal wrote:

Can I do something like this :
__
extern (Windows) LRESULT delegate (HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam) MyWinProcDelegate;

this() {
MyWinProcDelegate =Events;
}

extern (Windows) LRESULT Events (HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam) {
MessageBoxA(null , Success!!! , null ,0);
return DefWindowProcA(hWnd, message, wParam, lParam);
}
__

The Events() doesn't seem to fire... am I missing something ?


Hi Tal.
I have added an other example using array of delegates. I guess I know 
what you want to do... so do not miss the end of the document. Enjoy.


import std.stdio;
import std.functional;


int main(string[] argv)
{


// array of delegates
extern(Windows) int delegate( int i)[] dg;
alias dg callback;

// function to delegate
callback ~= toDelegate( test );  // std.functional
writeln( callback[0]( 1 ) );

callback ~= toDelegate( inc );
writeln( callback[1] (0) );
writeln (callback[0]( 1 ) );
readln();


return 0;
}

extern(Windows) int test(int i) { return 41 +i;}
extern(Windows) int inc(int i) { return ++i;}

// Now an associative array of delegates indexed by (of course) HWND  ;)
extern (Windows)
LRESULT delegate (HWND hWnd, UINT message, WPARAM wParam,LPARAM 
lParam)[HWND] dg;


alias dg MyWinProcDelegate;

bjoern



Re: Bridging C++ and C#

2011-12-22 Thread bls

On 12/20/2011 02:37 PM, mta`chrono wrote:

I like their approach. They're using gcc-xml to parse c++ files and
generate approtiated wrapper code. maybe we could write a similar tool
for d.


http://dsource.org/projects/bcd

Project is Not up to date.
AFAIK gcc-xml is a dead project. Thanks to David Nadlinger SWIG  has now 
official D1 abd D2 Support. Since SWIG also supports a subset of  C++ 
templates it is IMO the better choice.


Bjoern


Re: gl3n - linear algebra and more for D

2011-12-04 Thread bls

On 12/04/2011 03:39 PM, bearophile wrote:

This seems the 15th D implementation of certain things I've seen so far. Also 
to avoid further duplication I'd like 2D/3D/4D vectors (for game or graphics 
purposes) in Phobos.


Isn't he a nice guy ?
Since 5, maybe 6, years bearophile is complaining that D is not Python. 
And in case that bearophile is not in the mood to complain he fires up 
some obscure benchmarks or he is telling you why language X Y Z is 
better than D. Pretty annoying imho.


My 2 cents

OK, Somehow your announcement implicates that you've implemented a 
DirectX wrapper.  gl3n provides all the math you need to work with 
OpenGL, DirectX or just vectors and matrices,,,


True ? Avail. ?
Bjoern


Re: SQL/database server capabilities NO ODBC please

2011-12-04 Thread bls

On 11/26/2011 10:13 PM, Steve Teale wrote:

On Sat, 26 Nov 2011 15:31:33 -0800, bls wrote:


Hi Steve
First of all : I am sorry about my harsh words within my last reply. ---
I am afraid that this feedback is also not very gentle.

Picking up ODBC in order to figure out how an generic database Interface
may look like is a very bad idea.

Creating an ODBC Interface at all is pretty useless. NOBODY is using
ODBC at all.

Creating std.database based on sockets is useless. Let's take MySQL for
instance.  In case that you create a commercial application based on
MySQL you have to pay fees to ORACLE ( approx. 1000 Euro, per Server)
and nobody cares about your BOOST licensed Phobos raw socket stuff..

Despite that : std.database becomes unmaintainable. I've had a look at
your sources, Tough stuff.  Same is valid Piotr's PostgreSQL
implementation.

NO!.
I am all against it. I think that implementing std.database requires
understanding of Martin Fowler's  Enterprise patterns, As said before :
Function follows Form  :)

Last, and most probably useless comment, Have a look at
http://www.sqlalchemy.org/

Cheers,
Bjoern


Bjoern,

No need for apologies, the D newsgroup is a hard school.

The intro for SQLAlchemy says:

Over five years of constant development, profiling, and refactoring has
led to a toolkit that is high performing and accurate, well covered in
tests, and deployed in thousands of environments.

The situation for D is probably roughly as follows:

About three months  of experimentation, and struggle with inaccurate
documentation, has led to a point where a group of three or four of us
can communicate reasonably effectively with four database systems - MySQL
(API and Protocol), SQLite, PostgreSQL (API and Protocol), and SQL Server
(from Linux and from Windows vis ODBC).

We are learning to walk. To do the things SQLAlchemy describes, I think
you have to understand how to do that.

You may detest ODBC, but it is very soon going to be the only way to
communicate with SQL Server short of writing another wire protocol
effort.  There was the alternative of OLE DB, but MS is dumping that.

In another post under the std.database thread I have already suggested
that the post of top-down high level designer is certainly up for grabs.
Do you fancy it? Maybe by the time the top level design is completed,
Piotr and I and and others will have the means to do the nitty-gritty
lower-level stuff. in a reasonably consistent way.

Steve


Point taken! Thanks. :)
Despite that  hope you will agree with me that following/mimic JDBC 
instead of ODBC makes more sense.


Sure, it's your turn and  ..
asinus sacuum portat.

so I'd better shut up.
Bjoern


Re: SQL/database server capabilities NO ODBC please

2011-11-26 Thread bls

Hi Steve
First of all : I am sorry about my harsh words within my last reply.
--- I am afraid that this feedback is also not very gentle.

Picking up ODBC in order to figure out how an generic database Interface 
may look like is a very bad idea.


Creating an ODBC Interface at all is pretty useless. NOBODY is using 
ODBC at all.


Creating std.database based on sockets is useless.
Let's take MySQL for instance.  In case that you create a commercial 
application based on MySQL you have to pay fees to ORACLE ( approx. 1000 
Euro, per Server) and nobody cares about your BOOST licensed Phobos raw 
socket stuff..


Despite that : std.database becomes unmaintainable. I've had a look at 
your sources, Tough stuff.  Same is valid Piotr's PostgreSQL 
implementation.


NO!.
I am all against it. I think that implementing std.database requires 
understanding of Martin Fowler's  Enterprise patterns, As said before : 
Function follows Form  :)


Last, and most probably useless comment, Have a look at 
http://www.sqlalchemy.org/


Cheers,
Bjoern



Re: is D ncurses-only language?

2011-11-23 Thread bls

On 11/23/2011 01:58 PM, Mike Wey wrote:

On 11/23/2011 01:58 PM, Trass3r wrote:

c) gtkD looks it's in best shape...works with Phobos and Tango, with D
1.0 and D 2.0, 64 bits support, wraps GTK+ 2.22.x API.

Quite good, although a bit behind GTK+ schedule. The problem might be
there is only one developer (Mike) working on it.


So he's still working on it?
GTK+3 is a major step.


Yes, I'll probably update GtkD to the latest 2.x release before looking
at GTK+ 3.



Understandable. However have just seen GTK broadway samples. Blows me 
away. This is is must have 4 D.

For the curious..

http://www.geek.com/articles/news/gtk-html-5-update-puts-desktop-apps-on-the-web-20110318/



Re: DSQLite a libraryri using sqlite

2011-11-07 Thread bls

On 11/04/2011 11:47 AM, bioinfornatics wrote:

i have wrote a litlle lib using etc.c.sqlite3 for use sqlite in D
Now it is  most easier to use sqlite in D than directly use C interface

I have put here :
https://github.com/bioinfornatics/DSQLite/blob/master/examples/test_sql.d



Here we are again.
Again, Zero coordination in Phobos development.
-You are working on SQLite,
-Steve is working on MySQL / and more important .. on std.database
-Piotr is working on PostgreSQL,

Steve started his development based a the MySQL CAPI, works almost fine 
until - Ultra-nervous License obsessed people bashed that approach...

Sad.
//Beside what was the CAPI manifesto good for ?.

A fee weeks ago I wrote a mail to Steve, in which I mention that a 
Top-Down development would make more sense . Means Interfaces/ Design 
first.. detail implementation later.
It is indeed very frustrating but I have to say : Sorry Steve, IMHO you 
don't see the big picture. std.database will fail.


_SQLite_
Now you came up with a higher level wrapper around sqlite, which is for 
sure not compatible to whatever Steve or Piotr have in mind.

--
.I am afraid that Phobos will take another 3 years to consolidate. 
std.database is just another indication for that..

my 2 Euro cents   ( pretty weak nowadays :)
Bjoern.





Re: Native D MySQL Driver

2011-11-05 Thread bls

On 11/04/2011 03:00 PM, Sean Kelly wrote:

nless something has changed in the last few years, the way to do this in MSSQL 
is via a plugin in the SQL server itself.  Back in the days of yore this was 
via extended stored procedures, which were loaded as a DLL by the SQL server, 
but I think more recent iterations can call COM or .NET code or something like 
that as well.  In short, the event notification isn't typically done via a 
back-feed through a client connection.  Do any modern DBMSes have pub/sub 
functionality like this?


F.I. PostgreSQL

1)
CREATE OR REPLACE FUNCTION notify_demo() RETURNS TRIGGER AS '
BEGIN
NOTIFY demoApp;
RETURN NULL;
END;
2)
CREATE TRIGGER demo AFTER UPDATE
   ON users FOR EACH ROW
   EXECUTE PROCEDURE notify_demo();
3) C#
using System;
using Npgsql;

namespace TriggerDemo
{
class Program
{
static void Main(string[] args)
{

string connString = Server=127.0.0.1;Port=5432;User 
Id=postgres;Password=pass;SyncNotification=true;

NpgsqlConnection conn = new NpgsqlConnection(connString);

try
{
conn.Open();
NpgsqlCommand cmd = new NpgsqlCommand(listen 
demoApp;, conn);

cmd.ExecuteNonQuery();
conn.Notification += new 
NotificationEventHandler(conn_Notification);

Console.ReadLine();
conn.Close();
}
catch (NpgsqlException ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}

static void conn_Notification(object sender, 
NpgsqlNotificationEventArgs e)

{
Console.WriteLine(Row was updated);
}
}
}

Firebird is very simular.

I think MSSQL doesn't need a plugin. I have some test-code hanging 
around, the in case that it is more than just being curious, I can send 
you a copy. Guess it was SQLServer 2008, But the dotnet code is pretty 
complex.

Regarding MySQL--Simply has no support for server side events.
Bjoern


Re: Native D MySQL Driver

2011-11-05 Thread bls

On 11/05/2011 10:23 AM, Sean Kelly wrote:

  Is it possible to listen on multiple events with a single connection?


Sure, it is possible. see my code snippet.


Re: Native D MySQL Driver

2011-11-04 Thread bls

On 11/03/2011 10:15 PM, Steve Teale wrote:

2) No Windows Named Pipe support that I've noticed.


Isn't it part of std.windows ?  Named piped support is part of 
kernel32.dll maybe this link helps 

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365150(v=vs.85).aspx



3) No SHA1 digest support


The is a MIT X11 licensed lib on dsource called dcryot.

A public domain C lib is available  under 
http://libtom.org/?page=featuresnewsitems=5whatfile=crypt

and finally (like it) a Javascript snippet, no licence information!  
http://www.webtoolkit.info/javascript-sha1.html

HTH Bjoern



Re: Native D MySQL Driver

2011-11-04 Thread bls

On 11/04/2011 09:25 AM, Steve Teale wrote:

  I don't think you need to worry
about changes while stepping through rows.


That's questionable. Consider Stock Market quotes. Some lib designers, 
for instance. libpgxx (C++ PostgreSQL) have a different view.. let me 
quote :
*With conventional database APIs, you issue commands and queries to a 
database session or connection, and optionally create the occasional 
transaction. In libpqxx you start with a connection, but you do all your 
SQL work in transactions that you open in your connection. You commit 
each transaction when it's complete; if you don't, all changes made 
inside the transaction get rolled back.*


However, there are always many ways to skin a cat. PostgreSQL, Firebird, 
MSSQL Server (not sure about MySQL) enable you to trigger server side 
events.
Means the database server fires an update event (say employee deleted 
event) and a D function living in a secondary thread will catch this 
event and inform all interested parties (subscribers**) to refresh their 
RowSet. (and of course the UI)


Beside, this is the way we create mission critical,db-centric realtime 
apps. works fine.

My 2 cents.
Bjoern

** Publisher/Subscriber pattern.




  1   2   3   4   >