/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: dec_pdp-11-tan.jpg (800x1000, 96K)

Other urls found in this thread:

transitiontech.ca/random/RIIR
youtube.com/watch?v=EY6q5dv_B-o
way-cooler.org/blog/2019/04/29/rewriting-way-cooler-in-c.html
twitter.com/AnonBabble

i was pair programming late night with my boys when suddenly we had to share a mouse and we both touched hands, we ended up kissing each other in the bed
am i gay??

on a serious note, what do you people think of the rust rewrite of gnuutils?

based thread

they aren't that much different, as i said earlier they basically are asserts.
Only asserts you don't have to litter your function body with. And there's a clear difference between pre/post. Think about if NASA had to write a function with only raw asserts vs in/out sugar.

trying out template metaprogramming

Attached: 1449052837370.jpg (983x844, 111K)

>on a serious note, what do you people think of the rust rewrite of gnuutils?
transitiontech.ca/random/RIIR

Attached: jake_gyllenhaal_nightcrawler.jpg (600x637, 43K)

We need to go back to punch cards.

Attached: FortranCardPROJ039.agr.jpg (1687x809, 381K)

I'm making a programming language.
It works fairly well (except for some reason, every mathematical operation with result "0" returns "False" instead...)
but I still have no idea how to handle assignment and definitions. What are some texts on the subject?

>Only asserts you don't have to litter your function body with. And there's a clear difference between pre/post. Think about if NASA had to write a function with only raw asserts vs in/out sugar.
One line before the { vs one line after the {

This isn't even sugar it's a syntactic monosaccharide

oh?

are you fucking trolling dude
its before the bracket or after the bracket
its totally irrelevant

so im at a bootcamp, and I have no idea what is going on...

we are doing servlets and hosting using tomcat to host the webpages... but I have no idea what they are doing, and I cant follow along.

Do any of you have recommended reading on servlets so that I can cram tonight and try and catch up tomorrow?

Feel free to go back. No one else is stopping you or following.

It does seem necessary, programs are getting way too bloated.

Not that user, but I can definitely see the appeal. Personally if I were designing a language I'd build it into the type system and thus the function signature.

>on a serious note, what do you people think of the rust rewrite of gnuutils?
I'm rewriting gnuutils in Ada as an exercise before I start work on my microkernel this fall when the snow prevents me from going outside anymore.

why does he go around the world taking credibility for C and UNIX?
he didnt do shit he was a glorified secretary for Dennis Ritchie and Ken Thompson

Attached: brian_kernigger.jpg (200x300, 46K)

What are you working on?

Same reason Stallman considers himself the spokesman for GNU/Linux even though he didn't even write the kernel, nor all the GNU tools.

Lisp is the most powerful programming language.

The Shen sub-type of Lisp*

You will follow. The punchcard jihad is coming.

>oh?
ummmmm... uhhhhh UUUHHHHHH
I only started using C++11 recently so... templates are a pretty big deal for me?

Attached: 894262.jpg (726x1000, 390K)

>C++11
Go with C++17 and use if constexpr . Covers most of your SFINAE needs.

Attached: have't feel it!.png (640x480, 242K)

or, you know, uhh....

Attached: Screen Shot 2019-07-02 at 2.27.57 PM.png (906x586, 95K)

what does that even do?
an overload of '*'
???

C++ code makes me want to throw up. How can someone design a language so ugly.

>unironically using static_cast
>not using variable templates so you could simply type internal::is_unit_v
>those spaces before and after brackets
What is this, 2003? Also, as I said, use if constexpr.

remove and replace :: with '.' and C++ would be improved 10x, prove me wrong.

>How can someone design a language so ugly.
Start with C.

multiplication for unit types that produces the correct type for the incoming units and preserves as the resulting type of the operation on the underlying storage types

Currently restricted to C++11 because reasons

He literally doesn't
youtube.com/watch?v=EY6q5dv_B-o

C is a high level language.

Yes.

Surely there's a better way to model units.

but user, the internets and C++ forums specifically are telling me to C++11/14 or die!

Attached: love story.png (1600x900, 791K)

Don't believe them. Believe in me who believes in you! Latest standard or bust.

Depends on what you consider "better." I'm trying to leverage the type system to guarantee unit-correctness at compile time.

Attached: Screen Shot 2019-07-02 at 2.45.19 PM.png (1426x534, 165K)

How long before Linux is rewritten in Rust?

Rust can't even sanely manage a compositor.
way-cooler.org/blog/2019/04/29/rewriting-way-cooler-in-c.html

When rust gets decent designers and stops the traits and macros abuse.

As soon as D gets nogc.

Anone~ Please teach me JavaScript!

Attached: 3bb7f01e9e13531b46e3efbc2f774e89.jpg (1200x1800, 279K)

SPARK is the future

>Depends on what you consider "better."
Maintainable. Legible. Extensible. I'm not into C++ or type stuff so I can't really say. It just looks overly complicated for what it ultimately does.

How does your system handle composite units. How would I specify a variable of type "kilogram meters seconds^-2"

This is the most elegant way to do this, right?

if "--no-colors" in sys.argv:
class colors:
HEADER = ''
OKBLUE = ''
OKGREEN = ''
WARNING = ''
FAIL = ''
ENDC = ''
BOLD = ''
UNDERLINE = ''
else:
class colors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

How about I teach you operator tactics instead?

Attached: 1555251328193.jpg (794x1200, 152K)

>1970
>all software is shit
>wait in queue to get my punchcard to run

>2019
>all software is shit
>wait in queue to build my commit on server farm

that's just lmao ngl

>>wait in queue to build my commit on server farm
but why

Every day we stray further from God's light

Attached: uterine_prolapse.jpg (2078x1532, 548K)

post you're programming outfit

Attached: 1562093627738.jpg (1500x832, 560K)

>How does your system handle composite units.
Pretty well so far
>How would I specify
Err, except for that, haven't implemented a terse way to do that yet. You can do it, but currently you have to declare a number of intermediate template aliases which kind of defeats the goal of ease-of-use. (pic related)
I'm not too concerned about maintainability, but I don't mean that in a bad way. This library has a single, well-defined purpose; when it handles that it is "done." Except for improvements in the language and standard library that could be used to improve the implementation (or error messages), it'll be complete and correct by demonstration.

Attached: Screen Shot 2019-07-02 at 3.06.07 PM.png (808x398, 51K)

enterprise wagies.

Attached: duck.jpg (1600x1600, 211K)

What the fuck?

I'd use some standard argument parsing facility

Attached: no_socks.png (1200x1181, 1.43M)

Best language for metaprogramming?
Do i have to use SML or is there a better alternative?

convert two strings into integers multiply them then return the product as a string without using type conversions.

std::string convstr(int x)
{
std::map M =
{{0, '0'}, {1, '1'}, {2, '2'}, {3, '3'}, {4, '4'}, {5, '5'}, {6, '6'}, {7, '7'}, {8, '8'}, {9, '9'}};
std::string sum = "";
while (x != 0) {
int y = x % 10;
sum += M[y];
x /= 10;
}
std::string hmm = "";
for (int j = sum.size(); j >= 0; j--)
hmm += sum[j];
return hmm;


this part was hacked together but i got it to work.

Common Lisp.

wheresyourproof.cockadoodle

>convert two strings
>int x
n-nani

Every nonmeme piece of software needs some time to build, no way around it.

Sorry, I thought I was talking to an adult.

>char, int
>0, '0'
just use an array

sscanf(s1, "%d", &i1);
sscanf(s2, "%d", &i2);
sprintf(*output, "%d", i1*i2);

Nonironically C++. It makes you employable and impresses cs qts.

why the fuck are you mapping ascii chars to their integer representation
just subtract '0'
that's not 0
but '0'

Actually nevermind, forgot I do have a way. I don't particularly like how verbose it is, but the sepples has some awkward parsing restrictions.

Attached: Screen Shot 2019-07-02 at 3.11.16 PM.png (708x288, 38K)

ret = "--no-colors" in sys.argv:
ass = "\033"
class colors:
ENDC = '' if ret else ass+'[0m'
BOLD = '' if ret else ass+'[1m'
FAIL = '' if ret else ass+'[91m'
HEADER = '' if ret else ass+'[95m'
OKBLUE = '' if ret else ass+'[94m'
OKGREEN = '' if ret else ass+'[92m'
WARNING = '' if ret else ass+'[93m'
UNDERLINE = '' if ret else ass+'[4m'

>2019
>tcc still doesn't support C11 atomics
why even live?

>2019
>using tcc

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

you take two strings turn them into integers multiply them then return the product as a string.

ass

user
'1' - '0' == 1
'2' - '0' == 2
'3' - '0' == 3
//etc
there's no need for the mapping

I'm not gonna take it at your word asshole.

would that be considered a type conversion? the challenge said you can't use type conversions. i had no idea you could do that.

I want to make a "scientific calculator" website relating to some niche numeric analysis algorithms for which there doesn't exist a calculator online.

How do existing such websites do their calculations? I could just do a React app and implement them in js (lel) but I know nothing about js's accuracy when it comes to precise calculations, and I'd rather stick to something tried and true like Matlab. Do they send an HTTP request to a server, the server churns it out, and then returns a JSON payload with the results? How would you get Express or something to link up with Matlab anyway?

Attached: images.png (211x239, 6K)

i think it means don't use the standard library's type conversion functions
this is what's typically inside them, however
this isn't really type conversion in and of itself though, just subtraction

cute girl

there's probably a js library for proper maths you can leverage
the advantage would be that you can run everything inside the browser on the user's computer instead of dealing with the load of having to do the calculations on your server

radical yo

wasm. call C/C++ code from your javascript and run it right in the browser. Most scientific algorithms are already implemented in C libraries, so you only have to manage to build them with e.g emscripten.

He literally founded GNU.

Was lazy evaluation in Haskell a mistake?

He's the guy that takes all the credit for the hardwork others did. Sounds about right.

No

Most of your boogeyman "bloated" software is written in your beloved C and C++.

>beloved
>C++
hahaha nice try

Studying lazy evaluation was the reason the language was invented.

lazy by default, yes.
But haskell is a research language, so it doesn't matter.

JS in browsers has doubles and arbitrary length integers. Bitwise ops allow for (u)int32 to some degree. The rest are library solutions.

Irrelevant. When you literally found a project, I guess it's appropriate to consider yourself its spokesman.

There is a lot more bloated software out there written in C than C++, Cnile.

Attached: mountain.png (186x162, 71K)

Doubt.

Java and C# are the enterprise languages for over a decade now and are horribly bloat.

well yea, all real software is written in C or C++, which would obviously include bloated software
i mean there are obviously edge cases like electron applications and what have you, but those are significantly more bloated than any C or C++ application

Define "real software".

Anything written in [insert your language here]

Attached: BA475323-681B-4BAA-A5BB-8510234702BB.jpg (540x720, 86K)

You can only post in this thread if your main language was used to make the most advanced jet in the world, the F-35 for you uneducated swine.