/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

news.ycombinator.com/item?id=1803815
twitter.com/AnonBabble

Rust is for brainlets who are scared of pointers

Java is the best language

Java 8 was a mistake

Rust have pointers too, you can even use them in safe code.

C# is the only sane choice for enterprise or decent applications with time constraints

Gawd damn. Whoever thought it'd be a good idea to mix types with OOP

C++ is literally the abortion child of C and Python. Two very good languages independently. But combined is cancer.

What is a good book for learning python?

Welcome to /programminglanguagewarsgeneral/

>C++ is literally the abortion child of C and Python.
What the fuck?

What possible reason would I have for using => arrow functions in javascript instead of function()?

>Whoever thought it'd be a good idea to mix types with OOP
What the fuck are you talking about? The whole point of OOP is to have types.

One liner lambdas.

There are not none. Learn Ruby instead

why though? there's plenty of top quality sepples code about that's very fast and neat

all depends on the programmer. shit ones are going to churn out shit code regardless of the language

I'm working on an application to another company cause fuck refactoring the entire code base with no other employees ((((because there are no other employees)))).

I guess I'm also working on a jenni clone in Go, but I'm becoming tired of that and want to do something else.

>mixed C and python
Eh. I don't see it at all. It's OOP+C+random garbage a committee decided on+random garbage a committee decided on to fix the old garbage they added+random....
lim->inf
Random garbage.

a lot of people come to these threads asking
>how do i into coding
but how do i into self motivating?

>but how do i into self motivating?
Watch all these brainlets constantly shitting on glorious languages such as C++ and realize you will never have such a worthless existence. Now go be awesome.

>What the fuck are you talking about? The whole point of OOP is to have types.
No, it's not you stupid idiot.
In true fashion OOP programming. There exists only one type. The object. And with that single type, polymorphic inheritance can be done to create derived objects. But they're still of the type "object".

See the above. Types in OOP languages is fucking stupid

u r dum

>Diet
>Exercise
You'd be surprised how much these things get you to do shit

powdered caffience snorted straight up the snout la

or just pick a theoretically challenging problem and develop a solution for it

Find a project you feel driven to do. Don't learn only for learnings sake. Make something. Try to apply what you've learned realistically and throw it away if you don't like it.
Most languages have orthogonal features and a lot of redundant features figuring out what set of features you want is important and can't be done by inspection.

/dpt/ - Designated Pajeet Thread

You don't. You just set a certain time of your day to programming and mesh your hands on your keyboard until progress is made.

i do both, to some degree
i cut fast food and soda completely, don't smoke cigarettes. i also skate a lot.
the problem is I'm more motivated to get better at skating (which doesn't help my career) than I am to sit down and code as much as a few lines.

Exactly, you have hierarchies of types.

think you're being a bit myopic there
ok sepples isn't "true fashion OOP" but I don't see why that's a bad thing. even java isn't "true fashion OOP" since it doesn't have first class fucntions.

>he needS static typing

>skating programmer
God. I can't help but imagining you're the girl in this picture.

Who says that OOP implies first class functions?

They're still all the same type, idiot.
A int and a std::string are not.

You try using OOP in a well suited manner in C++.
Python is the closest anyone would ever get to true OOP. And C++ and Python are so fucking different

>it isn't a bad thing
user it severely compromises the paradigm.
OOP can be optimized as well as functional programming if effort was put into it. It just isn't being done because people like to avoid it.
I don't hate real oop, it has a niche use. But pseudo-oop is terrible. The compromise completely ruins the goals of the paradigm.
It's like if you used mutable globally shared state everywhere in FP and still called it FP.

because any object must have a procedural interface?

Is it a new meme?

>python is the closest
Try smalltalk or a real pure OOP language.

Rust has pointers, too, though

Are variable-length arrays in C legit?
That is, are they good practice? Sloppy practice? I had never used them until this year and it still throws me off working from a paradigm of ``C can't do that''.

I don't follow.

>Python is the closest anyone would ever get to true OOP.
python doesn't even have proper encapsulation with is the fundamental principle of an object. you are ridiculous.

I don't need it. But it's clearly better.
It's painful to have had it for years and now work in lua and python for two weeks.

and no pointer arithmetic, they're practically useless.
I can't even use a negative number as an index.

>Are variable-length arrays in C legit?

This is one of those arguments that never ends, so you aren't going to get a straight answer.

>They're still all the same type, idiot.
No, they're subtypes of the same type. They implicitly convert to other types. That doesn't mean they're the same type any more than being able to write
void foo(double);
foo(1);

means that int and double are the same tye.

it depends on the specific case in which you're using them. there are many case where variable lengh arrays are good practive.

also you've probably seen them used in your very first C hello world program (printf uses them)

first for Swift is best language

You missed the bus user

and the last

any good python curses programs i can mess with to learn from?

They are a poor substitute for std::vector.

no, because it's 2017
use django and build a JS curses emulator instead

VLAs are not the same as malloc arrays moron

I'm not sure I follow.
Is that related to how argv/argc get set?

wrong and irrelevant

no, printf is defined using VLAs
int printf(const char *format, ...);

Use Termbox instead.

That's not what a VLA is.

Try this then
std::vector foo(std::vector);
foo(1);

You can't? Oh. Maybe because C++ sucks and Python is awesome.

The issue I'm having is that with true objects, you can create actual true lists that contains different types of data.
With C++, this is near to impossible. And even if you did manage to do it, the only way to actually access the values is as such
for(Object obj:objects)
{
type objType = objects.getType();
switch (objType)
{
case typeInt:
intObject value = static_cast(obj).getValue();
}
}

And then the case is repeated for every single type you want to support.
>this is "Proper" c++ code

data HL xs where
Null :: HL '[]
(:>) :: x -> HL xs -> HL (x ': xs)
infixr 5 :>

Wrong, it's actually message passing.

Speak in a language that people actually use

>Complaining because you can't put an int where you expect a list of floats
What's your point? Do you just hate type checking or something?

> ::offset(-1)

Why such low quality bait? Rust has many issues, but pointer arithmetic and manipulation aren't some of them.

do you have to understand the whole program before you can make open source contributions?

>lel use python xD

Speak in a language that ADULTS actually use

Did you read the rest of the comment?

That's what it's like with OOP in a typed language

inventwithpython(.com) was* pretty good

* = unfortunately, you'll only learn python 2.

You should understand the entire translation unit you're modifying, at the very least.

You mean like Python?

> python2
> Literally encoding retarded

In the trash it goes.

anyone know how to delete a file with bash after a php script is done using it? it doesnt let the php file finish the file im using before bash deletes it

c is for brainlets who are scared of registers

sh -c "rm $file"

you could just delete it with php
then you wouldn't have to worry about scheduling between them

std::variant bruh

news.ycombinator.com/item?id=1803815

>rollerblading
>not inline skating

for(Object obj:objects)
{
type objType = objects.getType();
switch (objType)
{
case typeInt:
int value = obj.getVarient().get()
}
}
Congratulations. You changed one line of code into something else.

Ideally yes. Whole-system understanding is invaluable but rarely obtained.

when i tried this it said resource unavailable. I'm using "unlink()"

You're making the C++ way more complicated than it needs to be.
It's literally just this.
unsigned char* objects;

To access an object of type T preceded by other objects whose combined width is i:
*(T*)(objects + i)

If you have to do that then you are not using good OOP practice.

>The issue I'm having is that with true objects, you can create actual true lists that contains different types of data.
What can you do with with a list of data whose types you don't know anything about?

Did you close the file stream first?

Do anyone working here uses oop for their projects? If so, then what are you doing and why do you use oop?

what is OOP?

Nope.

I do love lain though

thank you based

PHP is given too much hate

In situations where the types can switched between with ease. For example, std::vector, std::tuple, and std::list. Or long int, int, float, double, etc:.

Common operations that can be done on multiple types should be able to combined into a list.

>In situations where the types can switched between with ease.
In these situations there is a common interface to those types, so you can just upcast to the interface and use that. lrn2 inheritance.

The benefit is not worth the cost.
Types are compile time constructs. To make type information available at runtime, like slow-ass languages like Python do, would be too great a sacrifice for the rather limited and petty use cases your suggestion would facilitate.

To add to , in the cases where there is no common base class, you can also do this:
>make an abstract base class to represent the interface you need
>make a template class that extends it and stores an instance of its parameter
>in practice, have the parameter be the type you want to be treated uniformly with other types
>have your template class implement the abstract base class's virtual functions in terms of the parameter type (use specializations if necessary)
>store a list of instances of the abstract base class
>put template class instances in it

i made an ALL CAPS IRC NETWORK

ircs://2hu-ch.org/lobby

BUT WHY

I THINK SO!

no idea wtf you're talking about overcomplicating this shit

>mfw sepples doesn't even let you specialize only some parts of a template class
>mfw literally why even include template classes if you ain't gonna do that shit

How do I write a program worth using? Meaning that at least I'll use it regularly, if not anyone else. Everything I do and need to do is already written, and better than I ever could (meaning there's no lack of features or bugs that make me want to write from scratch or contribute).

How do I stop "

the solution is to git gud enough at programming that solving a problem from scratch feels less intimidating than learning to use and trust whatever solution is already out there