Module-based programming
JS
js.mdnq at gmail.com
Fri Jul 26 04:42:25 PDT 2013
On Friday, 26 July 2013 at 09:12:27 UTC, Land wrote:
> I'm confused when it comes to modules.
>
> I've read somewhere that modules are basically 'singleton
> classes' and that anything that doesn't need its own state
> should
> not needlessly be put inside a class.
>
> But what if I want to create a simple OpenGL shader object. Do I
> create a class like this:
>
> class Shader
> {
> // Method
> // Method
> // Method
> // Method
>
> // Field
> // Field
> // Field
> }
>
> Or do I have a structure that I operate on via module methods?
> (C-style, basically)
>
> struct Shader
> {
> // Field
> // Field
> // Field
> }
>
> // Method
> // Method
> // Method
> // Method
>
> It's probably clear to you guys, but I'm stumped.
>
> Thanks for any answers
Non-member methods require you to pass the object you want to
modify... do you really want to do all that extra typing? It's
your choice... you wanna program in C or C++?
More information about the Digitalmars-d-learn
mailing list