Better HN
topnewbestaskshowjobs
Log inSign up

crazypython

4,542 karma · joined Jul 18, 2019 (7y ago) · 1,228 submissions

Submissions

comment 6y ago · link · parent

D has support for contracts.

pycontracts and icontract are Python libraries that enable contracts. icontract starts faster because it avoids parsing Python code, and its lambdas are understood by your IDE.

C++20 will support contracts.

1112.

Applying “Design by Contract” [pdf](se.ethz.ch ↗)

1 points · by crazypython · 6y ago · 1 comment

comment 6y ago · link · parent

I don't see why people take "Rust has affine types" and "affine types help us have safe systems programming" and then think "Rust is the only safe systems programming language."

1114.

Uniform function call syntax (postfix functions)(dlang.org ↗)

2 points · by crazypython · 6y ago · discuss

comment 6y ago · link · parent

I don't see why people won't just take the step D and Lisp do-- allowing full use of the programming language at compile time.

You can execute an ordinary functions at compile-time to read a DSL from a string or read attributes (reflective metaprogramming) on your program's classes. Take the string it outputs, use mixin(), and you have code. For example:

    // Sort a constant declaration at Compile-Time
    enum a = [ 3, 1, 2, 4, 0 ];
    static immutable b = sort(a);
"a" only appears in the compiler's memory. "sort" is a normal function that runs at compile-time. "allowing accessto the full language at compile-time" is similar to what dynamic languages such as Python and JavaScript give you, except D is a static language with GCC and LLVM backends.

comment 6y ago · link · parent

I'd like to add that Calibre (ebook-convert on the CLI) has a mode for outputting a .txt file with markdown formatting. It can take HTML as input.

comment 6y ago · link · parent

Because we have a movement called "Make the D compiler compatible with all C++ code" https://wiki.dlang.org/Calypso

comment 6y ago · link · parent

D has a fast backend that omits assembly- it's DMD.

comment 6y ago · link · parent

Compiling extremely quickly will change your development experience to be like using a scripting language. As far as I know, D can still compile itself- and the entire standard library- in less than 5 seconds, with parallelism turned off.

comment 6y ago · link · parent

I was thinking about making a language with Rust syntax that compiled to D. ("Compile your Rust programs 10x faster!") You can replace "let" with "const" to get transitive immutability in D with type inference.

As a programmer who first used Python than C++, I don't find types after or before any nicer or worse.

As for Monads, you could write a template that wraps a pure function that creates side effects through its arguments into a Monad rather easily.

As for pattern matching, you can do that by writing your own template too.

comment 6y ago · link · parent

D does have smart people working on it, but like you said, maybe not enough. Walter Bright, creator of D, single-handedly created the first C++ compiler that compiled directly to machine code. Andrei Alexandrescu was on the C++ committee.

comment 6y ago · link · parent

What are you trying to make? A social network? A highly interactive web app?

Could you build your app by generating HTML on the server, including some JavaScript and returning it? That's how old reddit, Hacker News, Stack Overflow, and no-JS Amazon are built.

1123.

Industrial Society and Its Future – Dr. T.J. Kaczynski (1995)(youtube.com ↗)

4 points · by crazypython · 6y ago · discuss

comment 6y ago · link · parent

Sorry to hijack the thread, but why did you choose C instead of D? You can adapt your C program into D using a few find-and-replace searches, and you can #include arbitrary C headers (even Linux kernel headers) using DPP.

1125.

Ask HN: Why do you use Rust, when D is available?

147 points · by crazypython · 6y ago · 255 comments

comment 6y ago · link · parent

I wonder how far one could get combining the strengths of Haskell's bidirectional type system and Dlang's (http://dlang.org/) efficiency into Lisp to get a fast language.

comment 6y ago · link · parent

> Now, not knowing what you’re doing is a crime isn’t a legally sound defense argument, but it does raise serious questions about how we view punishment and those we deem should be punished.

Isn't it a Mens Rea defense?

1128.

New C++ header generation available in D 2.091.0(dlang.org ↗)

2 points · by crazypython · 6y ago · discuss

comment 6y ago · link · parent

Do you implement inspect.stack, metaclasses, __mro_classes__, etc.?

comment 6y ago · link · parent

I hope they let others place ads on it. Then it will be real "TV."

comment 6y ago · link · parent

Can anyone who's taken that and MIT's deep learning course (introtodeeplearning.com) compare them?

How much do the material overlap? Which one is better?

comment 6y ago · link · parent

Well, the returned value leaks all the bits of information, unless that is randomized too to prevent replay attacks.

comment 6y ago · link · parent

Falun Gong is a religious movement banned by the Chinese Communist Party.

1134.

Calypso, a compiler that interfaces D with C++(github.com ↗)

1 points · by crazypython · 6y ago · discuss

comment 6y ago · link · parent

-XStrict?

comment 6y ago · link · parent

Maybe one could make a service worker to intercept and transform the JSON to HTML.

comment 6y ago · link · parent

I use http://colorizer.org.
1
3738394041