The D Language

User avatar
signalseeker
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by signalseeker »

I am not sure what you mean...do you want to build a backtesting/simulation engine in python or just write mission critical parts in a faster language?



There are lots of options these days to integrate c/c++ with python like pyrex, psycho, weave, ctypes etc etc. Both python and even numpy have excellent c API's. I suggest that you consider that option.



On the other hand if you are looking to build an independant system and compatibility with python is not an issue, you should look at Java as well.



btw, you should check this out - http://www.lecturefox.com/blog/python-design-patterns-by-alex-martelli
The dark is light enough.
User avatar
Cheng
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by Cheng »

If you are used to Pascal and want something new and fancy why don't you try Oberon ? Big Smile
"No trade with death / No trade with arms / Dispense the war / Learn from the past"
User avatar
FDAXHunter
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by FDAXHunter »

There's IronPython which leverages the power of .NET. I've read that some people consider that a lot better than the original Python.
The Figs Protocol.
User avatar
Tradenator
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by Tradenator »

Thanks for all the responses.  I know there is a lot available in python, and we are already using numpy/scipy and some of the C integration stuff.  (Another guy, an actual professional programmer, is evaluating D.)  I was just looking for other opinions and got some good ones.  A common theme seems that nobody here seems to like D, perhaps at least partly because you are fluent in C/C++.  Anyway, thanks again for the opinions.
User avatar
jslade
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by jslade »

The last time I had a legacy system in pascal, I piped it through p2c, got code which looked better than mine ever did, compiled it, and kept my customer happy forever (she's still happy, near as I can tell). Maybe you can do the same, and paste some python over it if you need some flash. Pascal's type safety and structure seems to loan itself to a pretty nice translation into C. Nicer than writing it in C would probably be.



D (which I never heard of until just now) looks like someone attacked C++ with Objective-C and a spork. Why, for god's sake?



Then again, I just went through learning a bit of OCaML, mostly because I think working in the same room with Sam Steingold would be pretty neat. Upsides: interactive top level, type safety, terse and quick, M$ seems to be getting behind it (F#), insanely fast if you understand things like tail recursion, multiparadigm. Downsides: crap IDE's, no libraries, little useful documentation, looks sort of like APL or something:



let haar l =

let rec aux l s d = match l, s, d with

[s], [], d -> s :: d

| [], s, d -> aux s [] d

| h1 :: h2 :: t, s, d -> aux t (h1 + h2 :: s) (h1 - h2 :: d)

| _ -> invalid_arg "haar" in

aux l [] [];;
"Alles hat ein ende, nun die wurst hat zwei."
User avatar
Nonius
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by Nonius »

sorry to bring up a very old thread. just was trying to find the right place to ask about how to do something in Python that I do in C# and I notice there are C# and Python guys in this thread.



So, I do these types of classes a fair amount in C# (by the way, it's annoying you can't paste in code and respect the indentations).



public sealed class Foobar

{

//stuff



public Foobar ()

{



//stuff that's read in from a file





}



public void Foo(){









}







private static readonly Foobar instance = new Foobar();



public static Foobar Instance

{

get

{

return instance;

}

}

}



so, in particular, in any part of my project I can do:



Foobar.Instance.Foo();



a Foobar object is only created once and I can reference it anywhere without having to pass it in as an argument to a method that needs it. examples of uses would be registering a method in an object as a delegate that's contained in Foobar and which is triggered when an event occurs.



how to do in Python?
Chiral is Tyler Durden
User avatar
svisstack
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by svisstack »

it's just a singleton, http://python-3-patterns-idioms-test.readthedocs.io/en/latest/Singleton.html

but unfortunately if you are using it often it means code is improperly designed, so this can be something that usually people dont do and maybe dont know answer to your question
Time well wasted.
User avatar
Nonius
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by Nonius »

Thanks Svisstack!



care to elaborate on your second comment?
Chiral is Tyler Durden
User avatar
svisstack
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by svisstack »

singleton pattern is often named as anti-pattern, because improperly used it will make in future more harm than good,



using singleton you are introduces to application global state,



also is overused in places where should not be used and its result of pure bad object orientated design,



also it places unnecessary restrictions and making automating code testing complicated.



also its hard to debug code because you will need track what caused that singleton state



also you need to synchronize if using it from multi-threads.



for example singleton makes sense for database connection or for application configuration
Time well wasted.
User avatar
svisstack
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

The D Language

Post by svisstack »

.
Time well wasted.
Post Reply