Re: Can we make auto return type inference a little more lax?

2011-05-16 Thread Jonathan M Davis
On 2011-05-16 21:31, Andrej Mitrovic wrote: > Yeah it's low priority, but nice to have. > > Note that there's a similar issue with tuples. However since tuples > are a library type and not first-class citizens (when it comes to > return types that is), the compiler probably won't be able to figure

Re: Can we make auto return type inference a little more lax?

2011-05-16 Thread Andrej Mitrovic
Yeah it's low priority, but nice to have. Note that there's a similar issue with tuples. However since tuples are a library type and not first-class citizens (when it comes to return types that is), the compiler probably won't be able to figure out a common type. What I mean is this: auto foo()

Re: Can we make auto return type inference a little more lax?

2011-05-16 Thread Jonathan M Davis
On 2011-05-16 20:40, Andrej Mitrovic wrote: > auto foo() > { > if (1) > { > return [0, 0]; > } > else > { > size_t one; > size_t two; > > return [one, two]; > } > } > > void main(){ } > > Error: mismatched function return type inference of

Can we make auto return type inference a little more lax?

2011-05-16 Thread Andrej Mitrovic
auto foo() { if (1) { return [0, 0]; } else { size_t one; size_t two; return [one, two]; } } void main(){ } Error: mismatched function return type inference of uint[] and int[] Surely the compiler can figure out a common type for t

Re: correct way to create boiler plate code

2011-05-16 Thread dmerrio
Thanks for the formatting tips. Copy and pasting kind of messed up the formatting, not that it was good to start with. I am still developing a coding style. == Quote from bearophile (bearophileh...@lycos.com)'s article > dmerrio: > > import main; //class definition of rng > > import std.math; //tr

Re: correct way to create boiler plate code

2011-05-16 Thread dmerrio
Thank you for the reply. Potential, but there still seems to be alot of repetitive code.

Re: correct way to create boiler plate code

2011-05-16 Thread bearophile
dmerrio: > import main; //class definition of rng > import std.math; //trig functions > import std.conv; //to!double > import std.string; //toupper > > double transFunc(alias transedentalFunc)(rng aRng){ > try{return(transedentalFunc(aRng.getCellValue().coerce! > (double)));} //cellValue st

Re: correct way to create boiler plate code

2011-05-16 Thread Kai Meyer
On 05/16/2011 01:08 PM, dmerrio wrote: I am parsing some formulas from a spreadsheet file. To duplicate the behavior of the spreadsheet functions, I am having to create a lot of boiler plate code that maps from the spreadsheet functions to the built-in functions. Mixin would seem to allow me to a

QtD segfaults on showing messagebox

2011-05-16 Thread simendsjo
This happens on Win7 32 bit using dmd 2.053 and Qt 2010.05 import std.stdio; import qt.gui.QMessageBox; import qt.gui.QApplication; int main(string[] args) { auto app = new QApplication(args); // comment out the messagebox, and it doesn't crash QMessageBox.critical(null, tr("This is

Re: Interface/abstract constructors

2011-05-16 Thread Steven Schveighoffer
On Mon, 16 May 2011 16:34:20 -0400, nrgyzer wrote: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel If D supported runtime reflection (and it does to a very very small degree), then you could use it to ensure the correct constructor is available. -Steve It's semicode, so

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Adam D. Ruppe
Nick Sabalausky: > Then again, if the network is all designed as set up well, and > not congested, and the DB does have the data in RAM cache, then I'd > imagine the lack of needing to do physical disk I/O could still > make it faster. Yeah, I work with two setups like that, but in my cases the db

Re: Interface/abstract constructors

2011-05-16 Thread nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Mon, 16 May 2011 16:12:05 -0400, nrgyzer wrote: > > == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > >> On Mon, 16 May 2011 15:32:43 -0400, useo > > wrote: > >> > Hey guys, > >> > > >> > is there any chanc

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Nick Sabalausky
"Adam D. Ruppe" wrote in message news:iqrj55$24d8$1...@digitalmars.com... > Alexander wrote: > > Database access vs a session cache is another thing you'd profile. > I suspect you'd be surprised - database engine authors spend a lot > of time making sure their engine does fast reads, and frequent

Re: Interface/abstract constructors

2011-05-16 Thread Steven Schveighoffer
On Mon, 16 May 2011 16:12:05 -0400, nrgyzer wrote: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Mon, 16 May 2011 15:32:43 -0400, useo wrote: > Hey guys, > > is there any chance to create an abstract constructor like: > > abstract class ABC { > >abstract this();

Re: Interface/abstract constructors

2011-05-16 Thread nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Mon, 16 May 2011 15:32:43 -0400, useo wrote: > > Hey guys, > > > > is there any chance to create an abstract constructor like: > > > > abstract class ABC { > > > >abstract this(); > > > > } > > > > DMD always says "...this

Re: Cannot build qtd on dmd 2.053

2011-05-16 Thread simendsjo
On 14.05.2011 20:07, simendsjo wrote: I used the instructions here: http://dsource.org/projects/qtd/wiki/BuildWindows Could qtd depend on another qt sdk than the one linked from this page? A messagebox poppes up saying: "generator.exe - The procedure entry point _Z17qt_message_output9QtMsgTypeP

Re: correct way to create boiler plate code

2011-05-16 Thread Trass3r
foreach runs at runtime, while mixin is expanded at compile time. Not the whole truth though. foreach over tuples gets unrolled at compile time so you can do stuff like: // +=, -=, ... Vector opOpAssign(string op, U)(U s) { foreach (i, _; tuple) mixin("tuple[i] " ~ op ~

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Robert Clipsham
On 16/05/2011 09:54, Alexander wrote: On 16.05.2011 01:25, Robert Clipsham wrote: It most definitely does not work perfectly. You highlight those that are not familiar with web development? They're the ones that use it. Visual Studio defaults to not using it now, there's a reason for that. I

Re: Interface/abstract constructors

2011-05-16 Thread Steven Schveighoffer
On Mon, 16 May 2011 15:32:43 -0400, useo wrote: Hey guys, is there any chance to create an abstract constructor like: abstract class ABC { abstract this(); } DMD always says "...this non-virtual functions cannot be abstract" - when I use an interface like: interface ABC { this();

Re: correct way to create boiler plate code

2011-05-16 Thread dmerrio
changing the relevent code, changes the error, but it still does not compile... immutable funcs = ["tan"]; void createFuncs(){ foreach(func; funcs){ mixin("double " ~ toupper(func) ~ "(double aReal) {return(" ~ func ~ "(aReal));}"); } } new error... Error 1

Re: Interface/abstract constructors

2011-05-16 Thread Jonathan M Davis
On 2011-05-16 12:32, useo wrote: > Hey guys, > > is there any chance to create an abstract constructor like: > > abstract class ABC { > >abstract this(); > > } > > DMD always says "...this non-virtual functions cannot be abstract" - > when I use an interface like: > > interface ABC { > >

Re: Interface/abstract constructors

2011-05-16 Thread Timon Gehr
> Hey guys, > > is there any chance to create an abstract constructor like: > > abstract class ABC { > >abstract this(); > > } > > DMD always says "...this non-virtual functions cannot be abstract" - > when I use an interface like: > > interface ABC { > >this(); > > } > > I get a similar er

Re: correct way to create boiler plate code

2011-05-16 Thread Timon Gehr
> I am parsing some formulas from a spreadsheet file. To duplicate > the behavior of the spreadsheet functions, I am having to create a > lot of boiler plate code that maps from the spreadsheet functions > to the built-in functions. Mixin would seem to allow me to > automate the boiler-plate creati

Interface/abstract constructors

2011-05-16 Thread useo
Hey guys, is there any chance to create an abstract constructor like: abstract class ABC { abstract this(); } DMD always says "...this non-virtual functions cannot be abstract" - when I use an interface like: interface ABC { this(); } I get a similar error: "...constructors, destruct

Re: correct way to create boiler plate code

2011-05-16 Thread Trass3r
string[] funcs = ["tan"]; calling mixin a compile time has the following error... Error 1 Error: variable func cannot be read at compile time C:\D\SVNProjects\trunk\xcellD\xcell1\trig.d 22 That's because funcs is mutable. Try to make it immutable or enum.

correct way to create boiler plate code

2011-05-16 Thread dmerrio
I am parsing some formulas from a spreadsheet file. To duplicate the behavior of the spreadsheet functions, I am having to create a lot of boiler plate code that maps from the spreadsheet functions to the built-in functions. Mixin would seem to allow me to automate the boiler-plate creation, but i

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Adam D. Ruppe
Alexander wrote: > I don't know how many visitors your websites have, but if you have > several visits per second - you will feel it. Two notes here: #1 several visits per second means over 5 million views a month. That's actually very rare. The way I do optimizations is I write it just however c

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Jacob Carlborg
On 2011-05-15 23:13, Nick Sabalausky wrote: Like I described in another post, I've *worked with* people who did web development professionally who still undeniably had nearly zero real competence. So you can't tell me just because they do it professionally indicates they actually have a clue what

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Alexander
On 15.05.2011 20:54, Adam D. Ruppe wrote: > FYI, PHP uses files on the hard drive for sessions by default... > optionally, it can use a database too. Not really. There are different options to keep the session data, though - so some of them may resort to store something in the disk. Both cases

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Jacob Carlborg
On 2011-05-15 21:19, Adam D. Ruppe wrote: But, in a lot of cases, you have to change the model to change the data you're showing anyway... the view only has what's available to it. Depending on what needs to be changed this is the job of the controller, to get the necessary data, for a specifi

Re: toHash() and Interfaces

2011-05-16 Thread Steven Schveighoffer
On Wed, 11 May 2011 19:43:03 -0400, Stewart Gordon wrote: On 06/05/2011 13:02, Steven Schveighoffer wrote: D has this horrible notion that any interface can be for a COM object, even though COM interfaces can only inherit from IUnknown (known statically). Therefore, interfaces that don't

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Adam D. Ruppe
Jacob Carlborg wrote: > I think you really should give it a try. This is a good place to start: Cool, thanks! > Don't know why but I think this is verbose and it's more difficult > to visualize how the HTML will look like. That's also a bizarre example... 9/10 times, my code looks more like: au

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Adam D. Ruppe
> Instead you move the view layer into the model or controller > layer. How's that any different? Is that really what's happening? Any template has variables made available to it from the model. I'm just making them available at a higher level (pre-wrapped in semantic tags and grouped together).

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Jacob Carlborg
On 2011-05-15 20:11, Alexander wrote: On 15.05.2011 19:36, Adam D. Ruppe wrote: I think you'll feel differently once you see people abuse that option. It becomes hard to follow what's going on. Sure I will feel differently, that's why I've said "if used correctly" - and I do use it corre

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Jacob Carlborg
On 2011-05-15 19:15, Adam D. Ruppe wrote: Jacob Carlborg wrote: But that way you would need to declare different types of Options structs all over the place? Sometimes, but most functions are fine with regular argument lists, to me, using enums for options where appropriate. In Rails basical

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Alexander
On 16.05.2011 12:23, Nick Sabalausky wrote: > The vast majority of web developers *are* very, very, poor coders. Being > correct and being in the majority have absolutely *nothing* to do with each > other. Sorry, but I still don't get it - who is defining what is correct and what is not? And

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Nick Sabalausky
"Alexander" wrote in message news:iqqq9p$ka6$1...@digitalmars.com... > On 16.05.2011 01:21, Robert Clipsham wrote: > >> I can't be bothered collecting lots of references, but having done web >> development both professionally (not as much as Nick) and >> non-professionally, I can tell you that

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Alexander
On 16.05.2011 01:21, Robert Clipsham wrote: > I can't be bothered collecting lots of references, but having done web > development both professionally (not as much as Nick) and non-professionally, > I can tell you that it *is* widely accepted as bad practice. Accepted as bad practice by whom?

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Jacob Carlborg
On 2011-05-15 17:46, Adam D. Ruppe wrote: Jacob Carlborg wrote: I don't see anything wrong with the view layer containing simple logic, like this (written in HAML): I don't think it's bad - I just think it isn't as good as we can get. Correct me if I'm wrong but you don't like to have logic

Re: How To Dynamic Web Rendering?

2011-05-16 Thread Alexander
On 16.05.2011 01:25, Robert Clipsham wrote: > It most definitely does not work perfectly. You highlight those that are not > familiar with web development? They're the ones that use it. > > Visual Studio defaults to not using it now, there's a reason for that. I > don't know about PHP IDEs.