Re: how to make private class member private

2018-03-17 Thread Amorphorious via Digitalmars-d-learn

On Saturday, 17 March 2018 at 23:54:22 UTC, psychoticRabbit wrote:

On Saturday, 17 March 2018 at 21:33:01 UTC, Adam D. Ruppe wrote:

On Saturday, 17 March 2018 at 21:22:44 UTC, arturg wrote:

maybe extend that to a list of types?


this is basically what C++ friend does and D was trying to 
avoid the complexity of


Really, the complexity of 'friend' comes from people abusing it.

In D, I would prefer no breaking change here. Leave private as 
it is.


Just a simple attribute that only applies within a class, and 
only to private members within that class.


@strictly private string firstName_;

Nothing outside of the class, not even the module, can access 
this now. It's all encapsulated.


It breaks nothing (AFAIK).
It's very clear what the intention is here.
It's an easy attribute to remember.
It restores the principle of class enscapsulation within a 
module, for when it's really needed.


Now D programmers would have the best of both worlds.



Why do you insist that you know how everything works and you are 
the harbinger of truth. The fact is, you don't know squat about 
what you are talking about and you just want to conform D to your 
naive ignorant understanding of programming so you don't get 
confused rather than learning and accepting D for what it does, 
which is do everything better than C/C++. You keep trying to make 
it in to C/C++, the the hell don't you just go use C/C++ then?


No one is going to listen to you. Your ignorance is pointed out 
by many that have used D far longer than you have and you think 
you can come in and point out all the things wrong without having 
any experience with it.


The fact is, the creator of the class is also the creator of the 
module.. and preventing him from having full access to the class 
is ignorant. He doesn't need to encapsulate himself. 
Encapsulation is ONLY meant to reduce dependencies. If the 
programmer, probably someone like you, can't trust himself to 
understand his own code then he shouldn't be coding.


If you don't like it, just write one class per module and don't 
have any free functions... it solves your problem and it doesn't 
use your shitty "solution". No one is forcing you to access your 
class outside the class but inside the module.


The fact is you are ignorant of what you speak about and that is 
99% of the problem. If you don't like how D does it, go use 
another language that does it the way you "think"(if you could 
call it that) is correct.


Many of the thing D does is learned from the mistakes of C/C++... 
and for you to pretend that your insignificant self who has never 
wrote a compiler much less read the specs has a clue about the 
ramifications of the changes is moronic.


Your only reason for not liking it is because you "don't like 
it"... how moronic.


"Mmm.. I don't think I like it.

I feel you should be able to make a member of a class, private, 
regardless of where the class is located. This seems to break the 
concept of class encapsulation.


No. I don't like it at all.
"

Yet you have no clue... You "learned"(brainwashed" that 
encapsulation means private members of classes cannot be accessed 
from C++ and because D provides a more complex rule that you 
can't seem to grasp(but which is very simple and no other human 
that has used D has had issues with) you say that D is wrong 
rather than that you or C++ is wrong.


The fact is, you are a moron. It's not because of this one issue 
but because of your mentality of which this is just an example. 
I'm sure you have the same thing with many issues in your life 
and you go strutting around like you own the place telling 
everyone what is wrong with how things are done when you yourself 
have no clue.


Want me to prove it to you?

You say:
"I feel you should be able to make a member of a class, private, 
regardless of where the class is located. This seems to break the 
concept of class encapsulation.

"

Yet, really, what you mean is that it breaks the concept of class 
that you learned in programming 101 that had to do with C++. You 
don't have a clue about logic and qualification. Maybe you are 
confused and you thought D was C++?



You know, if you go to Rome... ah never mind, you won't get it...






Re: how to make private class member private

2018-03-13 Thread Amorphorious via Digitalmars-d-learn
On Wednesday, 14 March 2018 at 01:41:33 UTC, psychoticRabbit 
wrote:

On Tuesday, 13 March 2018 at 21:38:59 UTC, Amorphorious wrote:



You are a moron...etc..etc..etc..etc.


See. This is what happens when you have access to a keyboard 
while high on ice.


Yep. So maybe you should stop doing the ice?!?! Then maybe you 
could actually reply with an intelligent answer? How old are you, 
BTW? 15? You know that at that age ice is pretty bad for you. It 
will drop your IQ 20 points in a year, so since you obviously 
have an IQ of 60 then means you've been doing ice for about 1 
year now... better stop while you have any brain cell's left.





Re: how to make private class member private

2018-03-13 Thread Amorphorious via Digitalmars-d-learn

On Tuesday, 13 March 2018 at 06:10:26 UTC, psychoticRabbit wrote:

On Tuesday, 13 March 2018 at 05:35:30 UTC, Amorphorious wrote:


There is another problem:

3rd: You are a brainwashed monkey who can't think for himself.


Gee..takes some real brains to come up with that one.


See, You learned a little about C++/C#/Java and think the 
world must conform to what they say is correct and deny 
everything that contradicts it rather than first seeing if you 
are on the wrong side of the contradiction.


The fact is, there is no reason a module should be restricted 
to see it's own classes private members.


Yeah that sounds fine. As long as you're willing to give up the 
concept of class encapsulation.


And, as long as you are willing to have programmers use the 
same syntax in D, as used in the 3 most widely used lanaguages 
on the planet, but get very different semantics. It's a real 
gotcha for those programmers.



It's sorta like a family who runs around pretending that they 
can't see each others private parts. Sure, it sounds like a 
good thing... until someone accidentally drops the towel and 
the offended calls the cop on their brother and has him 
arrested for breaking the law.


I'm not interested in your fanatasies. Keep them to yourself.

You should learn that your view of the world is very minute 
and stop trying to fit the world in to your box. It's called 
growing up. If you can't make a distinction between C++ 
encapsulation and D encapsulation you have far bigger problems 
than you think.


I think the view of the 3 most widely used langauges on the 
planet, is not something to dismiss so easily. D has what, 1000 
programmers, maybe.. so I wonder whose world is really minute.


In any case, I'm not attacking D. I use it. I am just 
questioning whether the different semantics for private, in D, 
is really worth it.



You are a moron. That is the simple issue. That is why you get 
confused easily and why you have trouble. I am stating this not 
as a ad hominem but as the truth.


You lack the reasoning ability to realize that the world is 
vastly different than what goes on in your pea sized brain(that 
is a personal attack, unless one is using pea as a metaphor for 
your lack of experience in the real world to teach you that 
things don't always follow linear lines).


1. EVEN IF THE TOP 1 MILLION PROGRAMMING LANGUAGES ALL USED THE 
EXACT SAME SYNTAX, SAME COMPILER, SAME FORUMS, SAME WHATEVER, it 
means NOTHING! Truth isn't dictated by numbers. You surely are a 
believer in Christianity or Islam? This type of "logic" is what 
they typically use.


   a. You'd see that all those 1M PL's are identical, so, in 
fact, there is just 1. In fact, one could say inflate all 
programming languages by saying there are N copies. e.g., D 
actually has 1 Billion versions all identical. Don't believe me, 
just make 1 Billion copies on your 4TB HD(ok, it will take about 
10PB, so what).  If you want, write a self-modifying compiler 
that modifies the source a bit to change random non-breaking 
changes. That way you actually have 1 Billion different copies... 
just so you can be pedantic.


   b. God didn't write "Classes must be self-encapsulated" in the 
10 commandments... hence it is false to assume they must. After 
all, if God wanted it, it would be so.



2. Being a lemming makes this very hard for you to grasp... but 
ask yourself why Haskell is different, after all, it didn't 
conform to C/C++... so it must be wrong too.


3. Why aren't people running around living in caves? After all, 
the first humans started doing that! In fact, why don't all 
humans live in the sea? After all, the real first humans did that.


Your logic is that the first dictates what the last should be... 
and the only reason is because your pathetic brain can't grasp 
the fact that there is no law that requires that. It's no 
different than saying that the son of a blacksmith must be a 
blacksmith, but again, your inability to abstract will find this 
very hard to understand. Let me put it different, Is a son of a 
bitch a bitch? Oh, does that make more sense? No? Oh well, I 
tried...


The fact is, you are clueless on some level if you really think 
you are right. The fact that you would waste your time and 
everyone around you arguing some useless point that means nothing 
is pointless... which goes to show that you are not that 
intelligent. The goal, here, is to try to fix whatever bug is in 
your brain that prevents you from becoming more intelligent. Only 
time will tell if it works...


I'm sorry for wasting your time. I'm sure you have better things 
to do like go argue why Hans Solo should have wore a blue vest 
instead of a black one because it's the colors of his heraldry 
and Lucas was wrong for putting him in black. Or maybe today it 
you were going to argue that Harry Potters wand should be made 
out of Ceder because all wizards use Ceder. Or maybe it is 
something else?








Re: how to make private class member private

2018-03-12 Thread Amorphorious via Digitalmars-d-learn

On Tuesday, 13 March 2018 at 05:11:48 UTC, psychoticRabbit wrote:

On Tuesday, 13 March 2018 at 02:24:38 UTC, Mike Parker wrote:
On Tuesday, 13 March 2018 at 02:06:57 UTC, psychoticRabbit 
wrote:


Mmm.. I don't think I like it.

I feel you should be able to make a member of a class, 
private, regardless of where the class is located. This seems 
to break the concept of class encapsulation.


No. I don't like it at all.


If you have access to the module source, you have access to 
the source of types inside it. Making the module the lowest 
level of encapsulation makes sense from that perspective.


There are two problems I see:

1st - D has broken the concept of class encapsulation, simply 
for convenience at the module level. Not good in my opinion.


2nd - C++/C#/Java programmers will come to D, use the same 
syntax, but get very different semantics. Not good in my 
opinion. (i.e. I only realised private was not private, by 
accident).


D has made many good design decisions. I do not see this as one 
of them.


There is another problem:

3rd: You are a brainwashed monkey who can't think for himself.

See, You learned a little about C++/C#/Java and think the world 
must conform to what they say is correct and deny everything that 
contradicts it rather than first seeing if you are on the wrong 
side of the contradiction.


The fact is, there is no reason a module should be restricted to 
see it's own classes private members.


It's sorta like a family who runs around pretending that they 
can't see each others private parts. Sure, it sounds like a good 
thing... until someone accidentally drops the towel and the 
offended calls the cop on their brother and has him arrested for 
breaking the law.


You should learn that your view of the world is very minute and 
stop trying to fit the world in to your box. It's called growing 
up. If you can't make a distinction between C++ encapsulation and 
D encapsulation you have far bigger problems than you think.




Re: Interfacing with webcam

2018-01-11 Thread Amorphorious via Digitalmars-d-learn

On Tuesday, 30 September 2014 at 03:41:20 UTC, Kyle wrote:

Hi,

Has anyone successfully used D to capture images from a webcam? 
Something like what you can do with OpenCV or pygame's camera 
API? Any idea how I can do this without having to know a lot of 
complex stuff? Thanks!


Looking for something similar. I simply need to show the video of 
a camera and be able to do to basics like rotation, crop, etc.


Re: Any free stock market data API?

2018-01-04 Thread Amorphorious via Digitalmars-d-learn

On Thursday, 4 January 2018 at 23:04:44 UTC, Amorphorious wrote:

Most are in other languages:

https://www.alphavantage.co/

https://iextrading.com/

are two free ones.

I'm just hoping for a more D'ish solution.



http://www.quantmod.com/

I'm wondering if I can use something like alphavantage and this 
package and integrate it between D and R. Have R/qauntmod do all 
the statistical work to avoid rewriting it all but easily 
coordinate all this from D.


Or maybe there is a better way?


Any free stock market data API?

2018-01-04 Thread Amorphorious via Digitalmars-d-learn

Most are in other languages:

https://www.alphavantage.co/

https://iextrading.com/

are two free ones.

I'm just hoping for a more D'ish solution.


Re: arsd simpledisplay opengl 3d

2017-12-26 Thread Amorphorious via Digitalmars-d-learn
Thanks. It's working. Seems like either it was the drawing code 
or the setting one of the setup conditions.


arsd simpledisplay opengl 3d

2017-12-26 Thread Amorphorious via Digitalmars-d-learn
Hi Adam, I'm interested in using your simpledisplay for 3D in 
openGL. I have worked with 2D fine but 3D is problemattic. I 
cannot get any depth even though i have set up 3D mode by 
modifying gamehelpers:


SimpleWindow create2dWindow(int width = 512, int height = 512, 
int viewportWidth=512, int viewportHeight=512, string title="") {
	auto window = new SimpleWindow(width, height, title, 
OpenGlOptions.yes);


window.setAsCurrentOpenGlContext();

glEnable(eGL.BLEND);
glBlendFunc(eGL.SRC_ALPHA, eGL.ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_SMOOTH);
glClearColor(0,0,0,0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear 
color and depth buffers

glDepthFunc(GL_LESS);
glDepthMask(GL_TRUE);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_DEPTH_TEST);

glMatrixMode(eGL.PROJECTION);
glLoadIdentity();
	//glOrtho(0, viewportWidth, viewportHeight, 0, 0, 1);	// Specify 
opengl window size, which differs from OS window size

//glMatrixMode(eGL.MODELVIEW);
//glLoadIdentity();
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective(145, 1.333, 0.01, 100);


//  glDisable(eGL.DEPTH_TEST);
glEnable(eGL.TEXTURE_2D);

return window;
}

I've played around with various settings but either I get nothing 
or 2D. Any idea what I might be missing?


Re: Compile to non-OS binary

2017-12-24 Thread Amorphorious via Digitalmars-d-learn

On Sunday, 24 December 2017 at 03:24:36 UTC, Adam D. Ruppe wrote:

On Sunday, 24 December 2017 at 03:15:58 UTC, Amorphorious wrote:
In fact, it would be very helpful to have switches that 
disable the various "features" of D that I will not use rather 
than having to do any self compilation.


The way I did it was create a custom runtime only including the 
features I wanted, then use `-defaultlib=` to disable linking 
in the library.. There's also the `-betterC` switch that will 
skip things like this too.


This is my old code, but emphasis on old, I haven't updated it 
for over a year and runtime hacks like this tend to need tweaks 
to keep working http://arsdnet.net/dcode/minimal.zip


I believe gdc also has several flags to disable individual 
features.


Thanks.

We can remove phobos easily but the runtime must be custom, which 
requires recompiling with the appropriate compilers.


How much hacking have you had to do? is it mainly just removing 
bits of code or did you have to do extensive work? and if so, 
what areas, if you recall?


Did you having any major problems messing around with this stuff 
or is it pretty straight forward?





betterC current consequences

2017-12-24 Thread Amorphorious via Digitalmars-d-learn

The docs states

Consequences
As no Druntime is available, many D features won't work. For 
example:


Garbage Collection
Thread-local storage
TypeInfo and ModuleInfo
Classes
Built-in threading (e.g. core.thread)
Dynamic arrays (but not slices) and associative arrays
Exceptions
switch with strings
final switch
synchronized and core.sync
Static module constructors or deconstructors
Struct deconstructors
unittest (testing can be as usual with the -betterC flag)

The predefined version D_BetterC can be used for conditional 
compilation.


Are each of these still valid statements?

Also, is the GC os independent? I see there is an os module for 
the gc, but does it require the os for any particular reason?


Re: Compile to non-OS binary

2017-12-23 Thread Amorphorious via Digitalmars-d-learn

Premature send(tabs?!?! ;/)

void main()
{

   version(BIOS)
   {
   import iBIOS;
   BIOSOut("Hello World");
   } else
   {
   writeln("Hello World");
   }
}


When compiled appropriately will create a bootable executable 
that displays the string. Else will create an OS specific 
executable that prints the string.


(for demo purposes only)

This should be seamless as I will be switching functionality 
regularly.





Compile to non-OS binary

2017-12-23 Thread Amorphorious via Digitalmars-d-learn
I would like to compile D for the different supported 
architectures only without and OS, C lib, D lib, or GC code. For 
example, as a boot loader or even bios binary.


In fact, it would be very helpful to have switches that disable 
the various "features" of D that I will not use rather than 
having to do any self compilation.


Ultimately LDC and/or GDC will be required for optimized binaries 
with the same limitations. For testing purposes I would also like 
the ability to compile to the OS PE structure.


For example

import BIOS;

void main()
{

   BIOSOut("Hello World");
}


will output