On Wednesday, 5 March 2014 at 02:28:00 UTC, Nick Sabalausky wrote:
On 3/3/2014 5:35 PM, Chris wrote:
Maybe I'm a bit too philosophical about this. But consider the
following
(made up) case:
struct MyTemp(T) {
// ...
T add(T a, T b) {
if (a is string b is string) {
On Sunday, 2 March 2014 at 18:59:23 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 15:23:03 UTC, H. S. Teoh wrote:
This is a pretty good primer to templates:
https://semitwist.com/articles/article/view/template-primer-in-d
The trouble is with most of these tutorials that they
On Wednesday, 5 March 2014 at 22:46:40 UTC, sclytrack wrote:
Are there any disadvantages of using a fixed size array for
fixed size
coordinates and vectors, over creating an actual typedef or
struct Vec3?
Don't know what's the current situation in druntime, but when I
tried static arrays a
On Wed, Mar 05, 2014 at 11:31:12PM +, develop32 wrote:
On Wednesday, 5 March 2014 at 22:46:40 UTC, sclytrack wrote:
Are there any disadvantages of using a fixed size array for fixed
size coordinates and vectors, over creating an actual typedef or
struct Vec3?
Don't know what's the
On Wednesday, 5 March 2014 at 23:47:33 UTC, H. S. Teoh wrote:
Whoa. What did you do with those arrays?? Either you did
something
wrong, or there's a nasty bug somewhere in the
compiler/language; AFAIK
static arrays are supposed to be value types so they shouldn't
generate
any garbage at all.
On Thu, Mar 06, 2014 at 12:02:42AM +, develop32 wrote:
On Wednesday, 5 March 2014 at 23:47:33 UTC, H. S. Teoh wrote:
Whoa. What did you do with those arrays?? Either you did something
wrong, or there's a nasty bug somewhere in the compiler/language;
AFAIK static arrays are supposed to be
On Monday, 3 March 2014 at 22:50:18 UTC, Frustrated wrote:
On Monday, 3 March 2014 at 18:46:24 UTC, Chris wrote:
I think the problem is not that people don't understand
templates in the sense that they are abstractions. The
question is whether there are loads and loads of use cases for
On Tue, Mar 04, 2014 at 10:32:52AM +, Chris wrote:
[...]
Maybe that's why it is so hard to see the benefits of templates,
because many cases (of abstraction) are already covered by OOP. I
like templates, but I'm not sure if they are as useful as D's
ranges. Ranges and component programming
On Tuesday, 4 March 2014 at 15:52:37 UTC, H. S. Teoh wrote:
On Tue, Mar 04, 2014 at 10:32:52AM +, Chris wrote:
[...]
Maybe that's why it is so hard to see the benefits of
templates,
because many cases (of abstraction) are already covered by
OOP. I
like templates, but I'm not sure if they
On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote:
On Tuesday, 4 March 2014 at 15:52:37 UTC, H. S. Teoh wrote:
On Tue, Mar 04, 2014 at 10:32:52AM +, Chris wrote:
[...]
Maybe that's why it is so hard to see the benefits of templates,
because many cases (of abstraction) are already
On Tue, 2014-03-04 at 10:27 -0800, H. S. Teoh wrote:
On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote:
[…]
True, true. The fact that the compiler can check for the right types
is great.
Btw, the quote you have in this post:
Never ascribe to malice that which is adequately
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
I just discovered by trial and error that I could use 'mixin'
in Templates (as opposed to Template Mixins), and when you know
that it seems likely that you can accomplish lots of stuff you
couldn't before.
This was asked about
On Tue, Mar 04, 2014 at 07:23:49PM +, Jesse Phillips wrote:
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
I just discovered by trial and error that I could use 'mixin' in
Templates (as opposed to Template Mixins), and when you know that
it seems likely that you can accomplish
On Tuesday, 4 March 2014 at 19:18:28 UTC, Russel Winder wrote:
On Tue, 2014-03-04 at 10:27 -0800, H. S. Teoh wrote:
On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote:
[…]
True, true. The fact that the compiler can check for the
right types
is great.
Btw, the quote you have in this
On Tue, Mar 04, 2014 at 07:18:17PM +, Russel Winder wrote:
On Tue, 2014-03-04 at 10:27 -0800, H. S. Teoh wrote:
On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote:
[...]
Btw, the quote you have in this post:
Never ascribe to malice that which is adequately explained by
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
All the D aficionados seem to wet their pants over
meta-programming, but I struggle to find a place to use it.
IIRC, I used it in a couple of places when I was trying to write
library stuff for MySQL, but in my current project, I
On 3/1/2014 1:00 PM, Steve Teale wrote:
I have already dealt
with the yada-yada cases by old-fashioned OOP.
As I see it, a big part of the benefit of templates is that they can
help you avoid a lot of the downsides of OOP:
- OO Boilerplate.
- Multiple dispatch is ridiculously messy, having
Nick Sabalausky:
- Lumping all data/functionality for a single object instance
into the same physical chunk of memory causes problems for
parallelization. And that's increasingly problematic on modern
processors which work best when operating as streaming-data
processors. (See
On 3/4/2014 7:42 PM, bearophile wrote:
Nick Sabalausky:
- Lumping all data/functionality for a single object instance into
the same physical chunk of memory causes problems for parallelization.
And that's increasingly problematic on modern processors which work
best when operating as
Nick Sabalausky:
But, I admit, I have wondered if a language could aid the
creation/usage of entity systems with some special language
features.
I have seen that a good way to learn lazyness and purity is to
try to write some Haskell code. Then you can use the same ideas
in other
On 3/3/2014 5:35 PM, Chris wrote:
Maybe I'm a bit too philosophical about this. But consider the following
(made up) case:
struct MyTemp(T) {
// ...
T add(T a, T b) {
if (a is string b is string) {
return a~b; // or return a~+~b; or whatever
} else
On 3/4/2014 1:27 PM, H. S. Teoh wrote:
On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote:
Btw, the quote you have in this post:
Never ascribe to malice that which is adequately explained by
incompetence. -- Napoleon Bonaparte
I'm surprised that Napoleon would say something like this.
On 3/4/2014 9:00 PM, bearophile wrote:
Nick Sabalausky:
But, I admit, I have wondered if a language could aid the
creation/usage of entity systems with some special language features.
I have seen that a good way to learn lazyness and purity is to try to
write some Haskell code. Then you can
On Sunday, 2 March 2014 at 18:59:23 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 15:23:03 UTC, H. S. Teoh wrote:
This is a pretty good primer to templates:
https://semitwist.com/articles/article/view/template-primer-in-d
The trouble is with most of these tutorials that they
On Monday, 3 March 2014 at 16:40:09 UTC, Chris wrote:
I'm always willing to use templates, but maybe in fact the use
cases are limited. I have a class for html elements (that
implements DOM functionality), and a class for building trees
with the tags. Of course, for html tags only string as a
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote:
There is nothing wrong about not using templates. Almost any
compile-time design can be moved to run-time and expressed in
more common OOP form. And using tool you have
On Monday, 3 March 2014 at 18:03:12 UTC, Frustrated wrote:
If you don't attempt to use templates, even in example code,
you won't get it.
What I don't get in this discussion is that all those fine phobos
examples are neglected. Yes, it is library code, but
On Monday, 3 March 2014 at 18:03:12 UTC, Frustrated wrote:
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote:
There is nothing wrong about not using templates. Almost any
compile-time design can be moved to run-time and
On Monday, 3 March 2014 at 17:24:08 UTC, Dominikus Dittes Scherkl
wrote:
On Monday, 3 March 2014 at 16:40:09 UTC, Chris wrote:
I'm always willing to use templates, but maybe in fact the use
cases are limited. I have a class for html elements (that
implements DOM functionality), and a class for
On Monday, 3 March 2014 at 18:46:24 UTC, Chris wrote:
E.g. an algorithm that finds the first instance of something
might be different for each type (string, char, int) and the
abstract implementation has to differentiate internally (if
string else if int else if ...). But this is no longer a
On Monday, 3 March 2014 at 19:32:51 UTC, Dicebot wrote:
On Monday, 3 March 2014 at 18:46:24 UTC, Chris wrote:
E.g. an algorithm that finds the first instance of something
might be different for each type (string, char, int) and the
abstract implementation has to differentiate internally (if
On Monday, 3 March 2014 at 18:46:24 UTC, Chris wrote:
On Monday, 3 March 2014 at 18:03:12 UTC, Frustrated wrote:
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote:
There is nothing wrong about not using templates. Almost any
On Sunday, 2 March 2014 at 06:50:02 UTC, Steve Teale wrote:
On Saturday, 1 March 2014 at 22:16:54 UTC, woh wrote:
You probably don't have a good understanding of templates if
you have only used 2 in your entire codebase. Or you are
talking about a very tiny codebase.
That's just what us
On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote:
There is nothing wrong about not using templates. Almost any
compile-time design can be moved to run-time and expressed in
more common OOP form. And using tool you have mastery of is
usually more beneficial in practice than following
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote:
There is nothing wrong about not using templates. Almost any
compile-time design can be moved to run-time and expressed in
more common OOP form. And using tool you have
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote:
The documentation examples quickly make your eyes glaze over,
looking at the code in Phobos is doubtless instructive, but you
can wade through a lot of that without finding what you want.
Try this:
https://semitwist.com/articles/article/view/template-primer-in-d
http://nomad.so/2013/07/templates-in-d-explained/
http://ddili.org/ders/d.en/templates.html
That's a nice list. Is there a place on the wiki where these could be linked to?
On Saturday, 1 March 2014 at 18:00:21 UTC, Steve Teale wrote:
On Friday, 28 February 2014 at 19:06:26 UTC, Dicebot wrote:
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
Is this typical - libraries use templates, applications
don't, or
am I just being unimaginative?
Steve
On Sunday, 2 March 2014 at 15:23:03 UTC, H. S. Teoh wrote:
This is a pretty good primer to templates:
https://semitwist.com/articles/article/view/template-primer-in-d
The trouble is with most of these tutorials that they offer
examples that are things you would probably never want
On Friday, 28 February 2014 at 19:06:26 UTC, Dicebot wrote:
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
Is this typical - libraries use templates, applications don't,
or
am I just being unimaginative?
Steve
Also every time you catch yourself doing any sort of
You probably don't have a good understanding of templates if you
have only used 2 in your entire codebase. Or you are talking
about a very tiny codebase.
n Saturday, 1 March 2014 at 18:00:21 UTC, Steve Teale wrote:
On Friday, 28 February 2014 at 19:06:26 UTC, Dicebot wrote:
On Friday, 28
On Saturday, 1 March 2014 at 22:16:54 UTC, woh wrote:
You probably don't have a good understanding of templates if
you have only used 2 in your entire codebase. Or you are
talking about a very tiny codebase.
That's just what us template-blind people want to hear -
confirmation that we are
All the D aficionados seem to wet their pants over
meta-programming, but I struggle to find a place to use it.
IIRC, I used it in a couple of places when I was trying to write
library stuff for MySQL, but in my current project, I use it only
once. That's when I want to stuff something onto my
A lot of my code doesn't use very many new templates either... my
web code does use a few magic templates which fills in a lot of
boilerplate, but the app code - the business logic - uses almost
no templates at all. My xml/html dom.d library also uses very few
templates, it just doesn't fit as
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
Is this typical - libraries use templates, applications don't,
or
am I just being unimaginative?
Steve
It is quite true as a generalization but in practice border line
between application and a library is not that clear. You
Well, when you're starting to use many templates you may end up
with separate library.
Templates provide compile-time correctness, concepts (in Boost
sense), policy-base design (see Modern C++ Design: Generic
Programming and Design Patterns Applied by Andrei Alexandrescu)
and compile-time
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
All the D aficionados seem to wet their pants over
meta-programming, but I struggle to find a place to use it.
IIRC, I used it in a couple of places when I was trying to write
library stuff for MySQL, but in my current project, I
On Fri, Feb 28, 2014 at 06:42:57PM +, Steve Teale wrote:
All the D aficionados seem to wet their pants over
meta-programming, but I struggle to find a place to use it.
IIRC, I used it in a couple of places when I was trying to write
library stuff for MySQL, but in my current project, I
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
All the D aficionados seem to wet their pants over
meta-programming, but I struggle to find a place to use it.
IIRC, I used it in a couple of places when I was trying to write
library stuff for MySQL, but in my current project, I
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
Is this typical - libraries use templates, applications don't,
or
am I just being unimaginative?
Steve
I believe it is typical. However it can also be definition, what
is a library? What is an application? Certainly your
In my experience in D, it comes down to one thing. Do I need to
handle the type of something and act upon it?
This is shown heavily in dvorm and Cmsed's router/restful
api/javascript generator.
In these cases I need to create code and have it string mixed in
based upon a type.
However I'm
On Sat, Mar 01, 2014 at 01:07:04AM +, Jesse Phillips wrote:
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
Is this typical - libraries use templates, applications don't, or
am I just being unimaginative?
Steve
I believe it is typical. However it can also be
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
All the D aficionados seem to wet their pants over
meta-programming, but I struggle to find a place to use it.
IIRC, I used it in a couple of places when I was trying to write
library stuff for MySQL, but in my current project, I
53 matches
Mail list logo