Module-based programming

Land Land at gmail.com
Fri Jul 26 02:12:26 PDT 2013


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


More information about the Digitalmars-d-learn mailing list