Old thread: What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
github.com
dlang.org
twitter.com
>What are you working on
I defend languages without generics on Sup Forums.
>Le interfaec{}
With generics I don't have to lad.
>go learn how to use interfaces
Why do you hate fast code?
>tfw want to write a data structure library in Go that works for every type you pass it, but no generics
Just use void* xD
>writing data structures in a language without variant types
struct {
TypeName: string,
value: interface{},
}
thats not a variant
your system is old as hell, you're undoubtedly getting slower compile times than with a newer pc, and you can't even use modern software development tools without it grinding to a halt
>What are you working on
Came across this:
github.com
I'm trying to understand it to see if I can make something out of it.
>muh pet feature nobody uses
every time
interfaces are 100% compile-time checks unless you do a type assertion, and you wouldn't do a type assertion, because you're not abusing the empty interface, are you?
should I be doing something besides learning a programming language?
not as long as it is C++ or java that you're learning
>what is indirection
shitposting
>muh pet feature nobody uses
"Every feature I'm too dumb to use is unnecessary". You're just as bad as Cniles.
why
>Cniles
What a childish way to talk about programmers with more talent than you can possibly imagine.
C is the fast language. It's the gold standard for real programming. If you can't live up to that standard, find another job.
Web browser is not platform to run software on.
I don't understand why none of the big companies haven't done anything to address this, well windows 10 added software store but that's only for windows and it's add ridden shit so I doubt people even want to use it.
The big problems are
1) Installing software, nobody want to do it
2) Portable software, even if you can compile your program to multiple platforms you still have the problem that there is no GUI library that looks native on each platform.
3) The shitty attempts at making cross platform framework lock you into using one shitty language and bloated shitty build tools.
This is what a Cnile would say.
more proof go-whiners don't know anything about go
I'm looking at the tour of Go regarding threading. It's very basic. I just don't see what convenience these features offer to your typical scenario where you need to do some complex threading. All of what's presented there seems more suited for painfully simple situations. Vitally no contested data with mutexes as your guard. Of course you can build something that does threading well in almost any language that allows you atomics (I'm presuming here) but if I'm looking for a language feature that'd draw me to the language it has to be something that helps me where I need it, not where I'm already doing well. I don't like Rust in general but they get that right to some extent. Their features do help you with what they promise in a wide range of situations. Their borrow checker (if as advertised) work well to prevent a wide range of errors that might not be easy to catch by yourself. But I don't see a similar gain here.
You can compare to languages that are very ill prepared for concurrency like C or C++ but these language features really seem more suitable for low-granularity operations (such as the searching a binary tree in the Tour) or the latancy-heavy tasks like the webscraper.
>templates
I wouldn't bring those up because I don't care that Go doesn't have generics that much. But they're actually very different in usefulness between C++ and D. I find D to give templates some actual use.
>but C++ templates are truing complete
Yeah I'm not interested in the technicalities here. Nobody should use them as if they were.
If you think interfaces don't use indirection you're pretty retarded.
They wouldn't, if Go had generics :)
Learn problem solving, understanding what people are actually asking of you, how to be a person people can stand being around, how to prioritize your tasks.
>What a childish way to talk about programmers with more talent than you can possibly imagine.
Desu user not all C programmers are smart. You get a lot of people who like its reputation and the 'back to roots'-aspect (not saying it's correct) of it now.
>tfw too smart to write software in languages without lazy multiple-inherited parametric polymorphic variadic monadic monoidal functorial variant annotated mixin trait bizzbang semantics
>That's how most languages use exceptions
that doesn't mean it's how they should be used in C++. i know Java (and C# to a lesser extent) abuse them, but that doesn't mean it's a good thing (least of all in C++). it's a different story in those languages anyway since they're garbage-collected and lifetimes are not actually tied to scopes. it's C++'s lifetime/scoping rules and RAII that go hand-in-hand with exceptions and suggest/demand a different/better kind of usage
>One of the reasons constructors are so limiting is that the only way to raise errors is to throw exceptions or create zombie objects
you definitely shouldn't create zombie objects, that defeats the purpose and eliminates the benefits of the exception model. it makes sense that throwing exceptions is the only way to raise errors in constructors; if there's an unhandleable error constructing an object, the state following should absolutely be such that the object does not exist. if you want more complex construction logic, additional checks, etc, you can still write a static function to implement that logic without breaking exception safety (you can even, as you said, use optional/variant for this). this is far better than just tossing exceptions out the window
>In practice that only extends to memory allocations because strong exception safety is a bitch
largely, i suppose so, though it's still doable often enough. and while strong exception safety guarantees are nice, only a basic guarantee is generally needed to guarantee leak-freedom, at least (and that's still a pretty damn good benefit)
i just don't see the argument for the alternative alone. exceptions and optional/variant/result type returns are not mutually exclusive. you can have exceptions and reap the benefits of both approaches, but you can't get the benefits of exceptions with just the alternative
and how do I learn that?
>writing a wall of text with far more words than characters of go code you have ever written
the state of you
>Web browser is not platform to run software on
It is now.
Constructors are a cancer and NTFS uses exceptions for control flow.
func (x *T) f() { fmt.Println(x) }
there is indirection of x here
func (x T) f() { fmt.Println(x) }
there is a copy of x, not an indirection, here
are you scared of pointer dereferences?
user I'm not immortal. I don't prioritize knowing every language intimately above lots of things. That's why I'm asking someone who knows more about this specific thing. It's not a new concept. Have you ever read a book?
you could have learned 75% of go in the time it took to write that "hmm looks useless to me even though i've just scanned a tutorial" post
>go to /wdg/
>everyone talking in their Jargon and referencing libraries as if everyone would know these libraries by heart
I'm a bit jealous desu. It's like they care about their domain over bickering about language differences. Languages are just tools.
Interfaces in Go are pointers you fucking retard.
> trash software*
fixed for you.
WASM
C++ and java are the only good programming languages
>fussing over a pointer indirection
lmao
Ok. So you're implicitly telling me it's useless for my purposes now? Or is what I care about in this particularly hard to reach part of Go?
I also get the feeling you overestimate the time it took to write this short piece of text.
Sounds to me like you prioritize feature count in the language too much. Big languages are just difficult to start. Complex languages are hard. There's a difference. I'll take a big helpful language over a helpless language every day.
there are no nontrivial and production-quality programs written in rust, d, haskell, ml, or c++14
stop flogging dead horses
>modern software development toolz
He fell for the Ultimate Meme
>Constructors are a cancer
they're great for encapsulation
>NTFS
I/O is different than "pure" programming
Because people in this thread (and software in general) have strong opinions about what languages to use. From an outside perspective it makes no sense, but internally it's a religious thing mostly.
try running mathematica, oh nvm you're a nomath codemonkey
i like how vscode has taken a few pointers from acme in terms of farming functionality out to command-line filter programs
of course, they've made a fucking mess of it, but the sentiment was there
Everyone I know who claims that C is great doesn't actually use the language. They always say that it's so easy to avoid memory bugs yet whenever they try they constantly have segfaults and fuck up pointers left and right.
>encapsulation
The only time this is important is when you have subtyping (class extension; not interface implementation). As soon as you remove subtyping, constructors are useless and a crutch.
>encapsulation
Nasty.
hmm so where are all these programs if these companies aren't just playing with the language?
it's 2017, should be easy to find them on, say, github
>i like how vscode has taken a few pointers from acme in terms of farming functionality out to command-line filter programs
>of course, they've made a fucking mess of it, but the sentiment was there
They inherited this from Sublime, which inherited it from TextMate, which was doing this in 2005, with Ruby of all things as the language of choice for writing those external tools
Why, companies don't have to publish to github
How would you know?
sublime was the original textmate is a clone
c++14 is just c++11 with a few tweaks
>ebay
>>Large scale data mining tools.
Basically replacing python?
>AdRoll
>>Integral parts of AdRoll's business are built on D.
>Auburn Sounds
>>Audio processing
That's OK.
More datascience.
>Facebook
>>C Preprocessor warp and more infrastructure tools.
Ehhh. Rather unimpressive use.
>CERERIS
>>We use D to develop MVC web framework for embedded systems.
I'm sure it's very complex for no good reason.
There's github links to D projects on that very page user. Are you retarded?
Cut line 10, insert below line 6.
>thinks he's good at math because he can use some software and that's both necessary and sufficient
Sure whatev'
>Constructors are a cancer
do you have some sort of reasoning for why you say that? how is allowing objects with invalid states thus requiring validity checks at potentially any given usage point better than consistent/ubiquitous beginning- and end-of-lifetime semantics, automatic binding of lifetime to scope, and being able to simply use objects while knowing by implicit contract that they are valid?
>NTFS uses exceptions for control flow
i don't really understand how that's relevant
You don't need constructors for any of that.
t. Cnile
I'm not that user, but to me, the better alternative to constructors is just one syntax to construct an object with values for each field (ensuring that every field is initialized), then static functions to construct different kinds of objects with different invariants. This is generally more flexible than constructors, it isn't inefficient now that we have move-semantics and agressive compilers, and it works better in the presence of exceptions
>every language but C has constructors
There are no nontrivial and production-quality programs written by you.
As someone whos just out of jail and has programmed a good bit in the past but its been 10 years, what should I learn to get a job or work for myself?
I have an engineering degree, but was bad boy with weed for a few years.. depression made me a crim.
Doing a university course and theyre pushing java down my throat. Its actually fun, since I used to write in C in my primary degree.
What happened to /wpc/?
I am uninspired and want to program something just for the fuck of it.
So i have a crapload of helper functions, do i make one big dll with everything or a bunch of dll with separates the helpers into categories like networking and shit?
The practical value in having the concept of a protocol(ObjC)/interface(Java,Go) just clicked with me, it feels like it eliminates the need to refactor large portions of your code if you just stick to an interface, both for the client code but also upstream as well, they've both confined to the same interface but can change their own code as much as they want without breaking anything.
oh fuck off, acme was doing it in the 80s, so was sam
search in files? grep
reflow a comment? | fmt
want a line or character for a selection or you whole file? | wc
fucking git integration? git
Link them statically you brainlet.
I'm not questioning sam or acme's great design and support for Git integration in the 1980s, I'm saying most of the braindeath in VS Code can be traced directly back to TextMate's Ruby scripts
inb4 "muh rust"
learn C++ and python, remove java
What do you do when you have an object where some of the state is always initialized to the same values? Just pass in the same ones every time? What do you do when you have an object where some of the state is initialized to a value dependent on the other initialization arguments? Just calculate it each time? Having a function to abstract over this kind of thing is useful. Those functions are constructors.
I don't know about your university but usually there's deans or student councilors you can ask about this.
you can never get a white collar job as an ex-convict
it just doesn't happen
but java so easy...
ya will do. didnt think of that
sure buddy
So you suggest user should just lay down and die? I've heard of American stigma against convicts but it seems a bit extreme.
>but java so easy
user there's plenty of Java jobs almost anywhere.You could check what local job offers there are and ask about the situation.
thankfully I live in ireland and ive to give permission for a company to access my record. Id just bail if they ask.
Ive asked companies who reported my offense to take down the websites as well so its not googleable.
Im going to fight tooth and nail to get back to the top.
Thanks for the advice, think, ill get good at java again.
Need some help with R.
How would i go about plotting a 3d sphere with a grid similar to the globe ?
Did you blow up some protestants?
unfortunately no, imported some weed.
i thought (for some reason lol) that his response had anything to do with my post, so i was speaking in that particular context (constructors in terms of how they relate to the other features/semantics i was talking about)
>the better alternative to constructors is just one syntax to construct an object with values for each field (ensuring that every field is initialized), then static functions to construct different kinds of objects with different invariants
you can already technically do this in C++ with aggregate initialization. and regardless of whether using aggregate initialization or user-defined constructors, you could always use a static function to surround construction with additional logic (and as you said, this has improved thanks to move semantics, guaranteed copy elision, etc). however, this does introduce a bit of a problem: it removes the ubiquity. i mean, what you describe (a set of static creation functions which initialize an object instance) is almost the same as what a set of constructor overloads does. the main difference is that constructors are invoked with a uniform syntax which also carries additional semantic meaning that ties in with a number of language features/semantics. various named static creation functions, on the other hand, are a total unknown to such features/semantics and to generic code. and of course having the functions all named the same thing would defeat the purpose (they might as well just be constructor overloads at that point). how do you create a smart pointer to an object created with one of these static functions, without multiple allocations, and without simply having the function return a smart pointer (what if you want a different smart pointer type? what if you just want the object created on the stack?). how do you use one of the functions to construct the object into uninitialized storage (a la placement new)? and so on
If you make something that is performance critical, and in particular if it's concurrent, the normal rule is you avoid allocating on the heap at all. Use object preallocated data (just operate on massive lists), or use pools of data etc.
Any language/runtime will support just allocating a large blob of data and then playing with it with code that looks like C. Effectively once you want to write perf sensitive code in a garbage collectied language you have to start writing code that looks like C.
That can mean using data orientation (SoA for example is a very non-idiomatic thing to do in most C-like languages and especially OO ones). Not using heap allocation at all for any length of time is definitely non-idiomatic in Java/C#/Python/js etc., but that's what you need to do if you want any kind of performance comparable to C.
There are two truths here: 1) Any language can be as fast as C and 2) When they are as fast as C, they also look like C regardless what it was to begin with.
gcc eat my .c file after compile. could you tell me why?
post the command line you entered
It contained unsafe code.
All C code is unsafe code.
Exactly.
GCC doesn't always eat .c files.
So this is the power of rust false flagger samefagging
That's a compiler bug
By using Python + scipy instead
I don't think so, Tim.
Hey guys am new to this hole thing where would you guys recommend where I start?