[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]
4chanarchives logo

/dpt/ - Daily Programming Thread


Thread replies: 324
Thread images: 24

File: 1444164399410.png (1MB, 1702x2471px) Image search: [Google] [Yandex] [Bing]
1444164399410.png
1MB, 1702x2471px
Falsifying your employment history edition!
old: >>52033619
what are you working on, /g/?
>>
First-ish for Go.
>>
File: 1448453529488.jpg (101KB, 884x903px) Image search: [Google] [Yandex] [Bing]
1448453529488.jpg
101KB, 884x903px
D
>>
>>52038440
C with GNOME libs is sweet
>>
Is it true that F# is the best programming language?
How do other languages even compete?
>>
java
>>
>>52038207
not a bad idea, ill give it a shot
>>
>>52038491
It's true, Senpai
>>
had some free time today, thought i'd look in to an esolang. this is cjam, program that returns the area of a circle

"Enter the radius of the circle:"oli2#P*p
>>
Daily reminder that if you can't pattern match or specialise, you don't have support for generics
>>
>>52038491
It's true
>How do other languages even compete?
They don't. The race is over. F# won.
>>
>>52038440
reminder:
https://www.youtube.com/watch?v=6G3kQyqMFpQ
>>
>>52038591
OCaml says hi. OCaml wonders how you like being 10x slower than it.
>>
Do I have to learn C# before F#?
>>
>>52038705
Start with C
>>
>>52038705
You should forgot about both.
>>
>>52038723
I already know C senpai
>>
>>52038705
No, it's better to start with F# outright too.
>>
>>52038362
>>52038600
no need to remind us that haskell in inferior :^)
>>
>>52038705
You have to learn to play D# first.
>>
>>52038705
>>52038723
Start with the Greeks
>>
>>52038704
It's not

F# is wonder why no multicore
>>
File: 2015-12-24_17-16-11.png (9KB, 869x284px) Image search: [Google] [Yandex] [Bing]
2015-12-24_17-16-11.png
9KB, 869x284px
>>
>>52038504
good way to get banned from irc channels
>>
>>52038847
If your bot doesn't act like a bot, how would they ever know?
>>
File: 2015-12-24_17-19-04.png (12KB, 869x292px) Image search: [Google] [Yandex] [Bing]
2015-12-24_17-19-04.png
12KB, 869x292px
My skills improve every day. Do yours?
>>
>>52038847
A fun challenge is to write markov bots and see how long they can remain undetected
>>
>>52038866
let () =
print_endline "why use a shitty language?";
print_endline "Greatness Awaits (tm)!"
>>
>>52038847
there are channels dedicated to people building bots

>>52038866
ur a hax0r m8
nice numbers, btw
>>
>>52038879
>markov bot
>2016 almost
At least graduate to LSTM bots already!
>>
File: 2015-12-24_17-23-07.png (16KB, 871x359px) Image search: [Google] [Yandex] [Bing]
2015-12-24_17-23-07.png
16KB, 871x359px
>>
>>52038866
should be:
DateTime.Now.ToString("hh:mm tt")
|> printfn "I am a programming Master. It's %s"
>>
File: 2015-12-24_17-26-27.png (9KB, 488x281px) Image search: [Google] [Yandex] [Bing]
2015-12-24_17-26-27.png
9KB, 488x281px
>>52038943
That's why I come to /g/, for the elite skills. What's the |> operator called, and can you stack them? Wait, I'll try.
>>
>>52038924
No, I'm right. There's no advantage to dynamic typing. It just makes it easier to write compilers for the language. That's all.

If you're sure I'm wrong, please explain why you think dynamic typing is useful for anything.
>>
>>52038973
I think it's called pipelining, and yes it can be continuously stacked with other operations.
>>
>>52038847
>he isn't an op in at least 30 channels on 5 networks
cumon step it up
>>
File: 2015-12-24_17-28-34.png (9KB, 496x290px) Image search: [Google] [Yandex] [Bing]
2015-12-24_17-28-34.png
9KB, 496x290px
wowow you can stack whatever the fuck |> is called
>>
>>52038973
pipe forward operator. It takes the value of the expression before the operator, and makes it the last parameter of the function after the operator. Yes, you can stack them. They are beautiful.
>>
>>52038973
>That's why I come to /g/, for the elite skills
kek
>>
>>52038986
Dynamic typing makes it more difficult to write compilers for the language. Static typing makes it more easy to write compilers for the language.
>>
>>52039003
Try pattern matching next.
>>
>>52039021
I do the same actually. There's actually a small number of good programmers in /dpt/
>>
>>52038922
>using if statements
>not using pattern matching

why live?

let rec gcd x y = 
match y with
| 0 -> x
| y -> gcd y (x % y)
>>
>>52039026
and what exactly is that based on? Static language compilers do everything that a dynamic language compiler does, except they also verify types, field names and references etc during compilation. TypeScript is basically just a static compiler that does this to vanilla JS, and can find some compile time bugs by figuring out what types variables are meant to be at compile time. You can add type annotations though to help it out, but it will infer a lot by itself.
>>
>>52038986
>It just makes it easier to write compilers for the language.
Haha, that's completely incorrect. You need a compiler and a VM. Maybe for the same feature set, because dynamic types can do a lot more than static without extra functionality.

>If you're sure I'm wrong, please explain why you think dynamic typing is useful for anything.
Polymorphism, generics. "Oh let me just implement a bunch of box classes and write an interface for all the types that this function needs to accept". Or you can have a significantly more complex compiler to do this for you.
>>
>>52038973
Pipe operator
>>
>>52039079
A dynamically typed variable needs to be analyzing the type of the variable at all times. A statically typed language just needs to ensure that the operation is sensible for that type; this requires less code to achieve.
>>
>>52039054
>F# is better than Haskell
myGcd x 0 = x
myGcd x y = gcd y (x `mod` y)
>>
File: 2015-12-24_17-37-40.png (12KB, 509x377px) Image search: [Google] [Yandex] [Bing]
2015-12-24_17-37-40.png
12KB, 509x377px
>>52039029
>>
>>52039082
>You need a compiler and a VM.
I'm talking about the compiler. And you don't need a VM, you can compile directly to native code if you want to. Or you can use an interpreter, which are also much easier to write.

>because dynamic types can do a lot more than static without extra functionality.
They can't do anything static languages can do. dynamic languages are the same as static languages, except without compile time type checking. That's the only difference.

>Polymorphism, generics.
What about them?

>"Oh let me just implement a bunch of box classes and write an interface for all the types that this function needs to accept"
Not really sure what you mean. What's a good example of what you're talking about? If a dynamic method accepts multiple parameter types, it still needs to check what they are at run time. Nothing is easier here, just more bug prone.
>>
>>52039129
>'mod'
HAHAHA
>>
IGNORE TRANNY THREADS

REPORT TRANNY POSTERS
>>
>>52039079
>Static language compilers do everything that a dynamic language compiler does, except they also verify types, field names and references etc during compilation
Dynamic languages do type-checking too, just during runtime. And how is 'doing more' and argument for better?
>>
>>52039125
>A dynamically typed variable needs to be analyzing the type of the variable at all times.
at run time yes. It doesn't have to, but most dynamic languages will.

>A statically typed language just needs to ensure that the operation is sensible for that type; this requires less code to achieve.
Static languages like C# and Java will still do run time checks on types, because it can't always be sure if a type will be what it's meant to be. This is done at run time, just like in languages like python and JS, but has nothing to do with the compiler.
>>
>>52039167
>And how is 'doing more' and argument for better?
They can catch bugs at compile time that a dynamic compiler will not find.
>>
what other languages support static duck typing like go?
>>
>>52039308
ocaml.

F# kinda with records..

both better languages than go btw
>>
IGNORE TRANNY THREADS

REPORT TRANNY POSTERS
>>
>>52039331
so go is the only imperative language?
>>
>>52039346
no, ocaml and F# are multiparadigm. They support imperative just fine.
>>
Can C# really be included in the same group of languages as C/++?
>>
>>52039343
>>52039166
this. the dubs know.
someone make a new one...
also, ignore and report anime threads.
>>
>>52039308
"static duck typing" is called structural typing
https://en.wikipedia.org/wiki/Structural_type_system
>>
>>52039343
I don't like trannies, but you have to admit, in anime, it is cute.

If they were 3D tranny posters I'd agree, 3D transsexuals are an abomination.
>>
File: ew.png (272KB, 470x624px) Image search: [Google] [Yandex] [Bing]
ew.png
272KB, 470x624px
How do I learn JS, /dpt/?
>>
>>52039427
> I don't like trannies, only pretend trannies
>>
>>52039156
What I'm saying is that the onus of implementing type generic functions, polymorphism, etc. is on the programmer with a statically-typed compiler. I'm sure this can be avoided with a sufficiently complex compiler, but that's the argument against it. You either end up with a compiler that isn't good enough to allow you to write transparently polymorphic code or a compiler that is so complex it has to write a good chunk of the application for you just to get around the artificial constraint of type safety, which is a massive effort. The dynamic compiler leaves type checking to the runtime or programmer if they need to specifically handle different types. This reduces the development cost for the compiler and the application code for most applications. Static type checking can be important for certain applications where code paths might not be touched for a long time, but not all applications are like that and so don't benefit from the extra checks a static compiler offers, but do from the easier to implement type parametrized code. It's all about costs.
>>
>>52039462
Fuck around with canvas.
>>
>>52039469
Can you explain an example?

generic functions and polymorphism is just as hard in dynamic languages as it is static ones. The only difference is a static compiler will verify certain bugs won't occur at compile time, while a dynamic language will wait until run time.

I'm not sure what makes you think this is not the case.

>It's all about costs.
I agree. This is why I hope dynamic languages are phased out of production environments completely.
>>
>>52039465
Anime trannies are cute though.

I don't like real life rape either, but in anime it is cute.

We can enjoy fictional things that we hate IRL.
>>
>>52039427
>anime trannies
these are actually really rare
most anime traps are simply crossdressers and not trans at all
>>
>>52039462
Read Eloquent Javascript. Should take about half a day to a day or so.
>>
>>52039683
what about https://github.com/getify/You-Dont-Know-JS
>>
>>52039469
>Static type checking can be important for certain applications where code paths might not be touched for a long time, but not all applications are like that and so don't benefit from the extra checks a static compiler offers, but do from the easier to implement type parametrized code. It's all about costs.
To add. This is why I would like a language like Typescript (but not JS, a real systems language) where types are optional to best take advantage of both cases.

>>52039542
>generic functions and polymorphism is just as hard in dynamic languages as it is static ones.
No it isn't.
function iterate(t)
local s = type(t)
if s == "table" then return pairs(t)
elseif s == "list" then return ipairs(t)
elseif s == "set" then return coroutine.wrap(function()
for k, v in pairs(t) do
if type(v) == "boolean" and v then
coroutine.yield(k)
end
end
else
error("unsupported type for iteration")
end
end

for i in iterate(list{1, 2, 3, 4}) do end
for k, v in iterate({a = 1, 5, 6, 4, 3, cpp="sucks"}) do end
for i in iterate(set{'a', 'b', 'c'}) do end

I'm not even going to get into how this would be implemented in C++... You would have to have to write a virtual base function that implemented an "iterate" method and then override it in every class you want to iterate. That's overhead because the dynamic code above divorces types and methods. Yeah you can do this in some languages via reflection, but it's just implementing the characteristics of a dynamic language at that point. Just ask people who have had to use dynamic types in C#, Go, or Java. The miniature embedded dynamic language needed reflection implements is a pain in the ass. you could blame the compiler not being advanced enough, but there is my point. The compiler has to be very advanced to get around the type safety system. But in a dynamic language with optional type checking you get the best of both. The compiler ends up being a big linter
>>
>>52039747
Sorry for the fuck-ups. I'm bad at writing.
>>
>>52038440
FAAAAAAAAAAAAAGGGGGGGGGGGGGGGGGGGGOOOOOOOOOOOOOOOT
>>
>>52039382
Yes.
>>
Hey /dpt/ what do you think of my code
>>
>>52039722
Never read it. All you really need to know about javascript beyond EJ is that it's single threaded so you can depend on the document not changing while inside a block of code.
>>
>tfw you only know C
>all the fun projects are done in javascript
Can I do back-end web development in C and learn just enough JS to make a front-end?
>>
>>52039542
there is no point in enforcing things like type arguments at runtime, which is why dynamically typed languages do not care about them at all
compound types are often just hashtables. if you have a list of some object, then no type checking is done at runtime. if a["foo"], where "foo" is some member and a the compound type, doesn't exist, then the runtime will just throw an exception
checking if a map contains a key is a lot simpler than type verification
this is what duck typing is about: if something exists at runtime, fine, if it doesn't, crash
if you want a list of some types that share a common feature then in a dynamically typed language you define the structure for each and that's it, in a statically you define the structure and also something that describes what these types have in common so the compiler knows what's up
the entire worry about correctness is moved to the programmers brain from the compiler, which obviously isn't that good for big projects
for small projects and scripts however it's completly fine and easier to write because you do not have to describe what things have in common
>>
I wish in JavaScript

"string" * 3 = "stringstringstring"

And

"3" * 5 = "33333"

Why doesn't it, /dpt/?
>>
>>52039831
learn JS and use it for backend AND frontend...
or, do something useful with C instead.
>>
>>52039831
JavaScript is piss easy senpai.

Just read this:

https://developer.mozilla.org/en-US/docs/Web/JavaScript
>>
>>52039853
because it's not python
>>
>>52039865
Is it possible to do neat things with JS without having to load 50MB of js frameworks upon loading the page?
>>
>>52039886
yeah, use angular.js
>>
>>52039886
What the fuck is a "neat" thing?
>>
>>52039880
I know, but it just seems common sense, all dynamically typed programming languages should do this.
>>
>>52038472
but GNOME is shit
>>
>>52039933
For me
"3" * 5 == 15
is the expected behavior for an untyped language.
>>
>>52039747
>a language like Typescript (but not JS, a real systems language) where types are optional to best take advantage of both cases.
That's objective-c

>That's overhead because the dynamic code above divorces types and methods.
That doesn't make it overhead.. What kind of "overhead" do you think this is in C++? It would be a little bit more verbose for C++, but not necessarily in other languages.
member __.iterate(t : Table) = pairs(t)
member __.iterate(t : List) = ipairs(t)
member __.iterate(t : Set) =
t |> Seq.ofSet
|> Seq.map (fun (key, val) -> k)

Would be the equivalent in F#. But this is of course compile time type safe. Is this less good compared to your version somehow?

>The miniature embedded dynamic language needed reflection implements is a pain in the ass.
I'm not sure what you're saying but Java and C# both have reflection. You could write the kind of dynamic code you wrong in Java or C# without any issues if you felt there was a reason for it.

>The compiler has to be very advanced to get around the type safety system
In Java or C# you just cast everything as an object, and bam, the type system is "off" and your code is effectively dynamic. People prefer to use the type system when it's provided for them though.
>>
>>52039913
non-trivial things, like web apps
>>
>>52039908
>use flavor of the month hipster.js framework #8324832
>>
>>52039886
yes, learn the whole ecmascript and code it yourself without frameworks
>>
>>52039951
For that, I think it would make more sense to use the unary operator.

"3" * 5 = "33333"

+"3" * 5 = 15
>>
>>52040013
>Anon reliving the PHP and JavaScript design and development experience
>>
>>52040013
>Use extra syntax for 95% of use cases
>Use reduced syntax for 5% of use cases

For what purpose?
>>
>>52039844
>there is no point in enforcing things like type arguments at runtime
but there use a point to enforcing at compile time.

>if something exists at runtime, fine, if it doesn't, crash
What about if you never want it to crash. What if certain things *should* always exist, and if they don't it's because there's a mistake somewhere in the code. These are bugs static typing make impossible to happen.
>>
>>52040104
Because it makes more sense, and you just pulled those numbers out of your arse.
>>
>>52040128
>but there use a point to enforcing at compile time.
>What about if you never want it to crash. What if certain things *should* always exist, and if they don't it's because there's a mistake somewhere in the code. These are bugs static typing make impossible to happen.
where did i claim the opposite again?
>>
>>52039853
>>52039933
I just found out, there is String.repeat()
>>
>>52040181
You didn't, but that's what the entire point of the thread of posts is. Dynamic typing being useless. No one's discussing what should or shouldn't be checked at run time.
>>
>>52040179
How often do you need to repeat a string exactly compared to multiplying two numbers in code?
If anything, 95% was conservative.
>>
>>52040183
This is why people look at you funny when you claim that you "need" operator overloading.
>>
>>52040210
I'm not the same anon, I was just saying
still... I'd prefer the python syntax, desu senpai
>>
>>52040183
Yeah.

And it looks hideous.

"3".repeat(5)

"3" * 5

Which looks better?
>>
>>52040210
What's the reason? I've never heard anyone say you "need" it. It's just super handy sometimes. Of course shitty programmers can write garbage with it.
>>
>>52040242
"3" "* 5
>>
>>52040191
>Dynamic typing being useless
again, if the script you are writing is simple enough so that you do not need correctness enforcement through type safety then a dynamically typed language has less overhead
the other point was that in regards to the simplicity of the interpreter vs the simplicity of the compiler, the dynamically typed interpreter is simpler
the op of the post i replied to claimed:
>generic functions and polymorphism is just as hard in dynamic languages as it is static ones
which i replied to because i don't think that's correct, atleast regarding the compiler/interpreter
the effort of maintaining correctness for generic functions/polymorphism or whatever is moved from the compiler into the brain of the programmer
>>
>>52039984
but angular was released in 2009
>>
>>52039939
no
>>
dynamically typed language:
let sq x = x * x; /// not type safe

statically typed language:
let sq x = x * x; /// type safe

any questions
>>
>>52040195
You multiply two numbers more, but usually, when you do it, they are of the same type, so you're asking the wrong question, anon.
>>
>>52039908
>search angular.js
>angularjs.org
>click on video
>gay ass song about angular.js
nope
>>
>>52040306
>>js related
>>gay
>surprised
>>
>>52040254
Because most people who find it handy will do shitty things with it.
If you're not able to work around not having overloading, you certainly wont write any good code with it either.
>>
>>52040292
I'm not the one using a language with implicit type conversion.
>>
>>52040279
>dynamically typed language has less overhead
How so? This was claimed, but never explained.

>the dynamically typed interpreter is simpler
Agreed. That was my point too. But this is of no benefit to the programmer targeting it. It's just easier for the developers of the interpreter. This is the only benefit to dynamic typing I can see.

>the effort of maintaining correctness for generic functions/polymorphism or whatever is moved from the compiler into the brain of the programmer
how so? Static and dynamic languages require equal thought from the programmer for this stuff. A static language will just tell you at compile time if you made a mistake.

see >>52039964
>>
>>52040318
>Because most people who find it handy will do shitty things with it.
not good programmers. bad programmers will shit the bed no matter what they are doing.
>>
>>52040242
Why the everloving fuck would you ever use a repeat method on a string literal?
It doesn't look half as stupid when you uses actual fucking vars like a normal person.
>>
>>52040318
Operator overloading is just syntactic sugar. It just makes your code shorter.
>>
>>52040354
>he hasn't joined the UFCS cult

m8 it's all fuckin rainbows over here
5.sqr.add(5).sqrt.writeln;
>>
>>52040306
>walk into sex shop
>find dildo
>wontsomebodypleasethinkofthechildren.avi
>>
>>52040354
I use it for indents
require 'logger'
require 'facets'
require 'terminfo'

class String
def wrap
columns = TermInfo.screen_size[1]
lines = self.word_wrap(columns).split("\n");
indents = lines[1..-1].join(' ').word_wrap(columns - 26).split("\n").map{|line| "#{' '*26}#{line}"}
indents.unshift(lines[0])
"#{indents.join("\n")}\n"
end
end

class Logging
def self.log
if @logger.nil?
@logger = Logger.new STDOUT
@logger.level = Logger::INFO
@logger.formatter = proc do |severity, datetime, progname, msg|
"#{severity} #{datetime.strftime '%Y-%m-%d %H:%M:%S'}: #{msg}\n".wrap
end
end
@logger
end
end
>>
>>52040354
See my meme star function, anon.

var star = function(str) {
var val = "\n"

for(var i = 0; i < str.length - 1; i++){
val += (" ".repeat(i) + ( str[i] + " ".repeat(str.length - (2 + i)) ).repeat(2) + str[i] + "\n");
}

val += str + str.reverse(1) + "\n";

for(var i = 2; i <= str.length; i++){
val += (" ".repeat(str.length - i) + ( str[str.length - i] + " ".repeat(i - 2) ).repeat(2) + str[str.length - i] + "\n");
}

return val;
}
>>
>>52040371
So you're saying everyone should have to read your entire project to establish when the + operator is actually plus and not something obscure?

How else will they know? Are you gonna document it every time? If not, when do you document it?
What if someone is reading one part using overloads but doesn't come across the few times you did document it?

The ends do not justify the means.
>>
>>52040415

>you shouldn't be allowed to overload operators
>you should be allowed to name your own variables, functions etc
>>
What exactly is operator overloading?
>>
>>52040411
Yes, lets change a language syntax so that making memestars is easier.
>>
>>52039853
found the code monkey
>>
>>52039964
>That doesn't make it overhead.. What kind of "overhead" do you think this is in C++? It would be a little bit more verbose for C++, but not necessarily in other languages.
Programmer time necessary to implement the type abstraction. Obviously it's compiled out...

>In Java or C# you just cast everything as an object, and bam, the type system is "off" and your code is effectively dynamic.
It does so through the same type abstractions I was talking about. Just because you don't have to implement it yourself doesn't mean it isn't there.
>>
>>52040447
When an operator can do multiple things, usually depending on the type of data applied to it.
For example, in VB.NET:
2 = 2 ' = True
"2" = "2" ' True
a = 2 ' either assigns 2 to a or checks if a equals 2, depending on context
>>
>>52040415
you should only override + when the use of it will be obvious. Like creating a vector type, or a special numeric type.
>>
>>52040447
vector2 
a = {1, 1},
b = {0, 0};

a = a.add(b); // add is defined by whoever wrote vector2
//vs
a += b; // += is defined by whoever wrote vector2
>>
>>52040333
to be fair, i hadn't looked at ocaml so far, only at haskell and f#, and ocaml infers all the information i called to be redundant in my post about statically typed languages requiring more effort
i guess for nominally typed languages it's true that sometimes more effort to build the same small thing is required, but for proper structurally typed languages like ocaml, it doesn't seem to be an issue
>>
>>52040481
People should also only write 100% bug-free code :^)
>>
>>52038440
this pic is fucked up
>>
>>52040474
>a = 2 ' either assigns 2 to a or checks if a equals 2, depending on context

That's so fucking confusing.
One = should always be assignment.
Two == should always mean comparison.
I don't even want to know what the fuck === means in javashit.
>>
>>52040474
>when an operator can do multiple things
>(builtin operator with builtin types example)
what the actual fuck are you talking about
>>
>>52040494
how so senpai
>>
>>52040461
>Programmer time necessary to implement the type abstraction.
Type abstractions are made in dynamic languages too, they are simply only checked at runtime. You're not making anything new in a statically typed language. You might just need to write it a little differently so the compiler can know what the types are at compile time, instead of run time.
>>
I'm not even happy about * being overloaded in C++, now you guys want to overload + as well? Christ...

>>52040495
=== in JS is the same as == pretty much everywhere else. VB just likes to be extra retarded.
It gets bonus points for having arrays, properties, and functions ALL use () to be referenced. So if you have an array property with a constructor, good luck figuring out what the fuck you're supposed to call it with.
>>
>>52040428
If I see a variable, finding out where it is declared is not a problem.
The same goes for functions.

How the fuck does anyone know when you've used overloading or not, without trailing through the entire class?
>>
>>52040491
of course. You think they should write code with bugs?
>>
>>52040495
ignore him he doesn't know what he's talking about

operator overloading means the programming language lets you define how an operator works for a class
often it's gotta have a certain function signature (e.g. == returning a bool)

if you wanted to make a reference class, you could overload == to check by reference
>>
>>52040537
for example, you could write +,-,/,* operators for a vector class
so that it's
(vector_a + vector_b) * constant;
and not
vector_a.add(vector_b).times(constant);
or
vector_times(vector_add(vector_a, vector_b), constant);

normally languages don't support arbitrary operators (e.g. you can't just make up a random token like £*%"* and call it an operator)
>>
>>52040537
You're retarded. Operator overloading, just like function overloading, just means that the operator in question does multiple different things without explicit differentiation. Whether or not those overloads are part of the standard or are programmer-defined is irrelevant.
>>
>>52040571
Holy shit.

http://en.cppreference.com/w/cpp/language/operators
https://msdn.microsoft.com/en-us/library/aa288467(v=vs.71).aspx
https://dlang.org/spec/operatoroverloading.html
https://msdn.microsoft.com/en-us/library/dd233204.aspx

http://stackoverflow.com/questions/77718/why-doesnt-java-offer-operator-overloading
>>
>>52040586
Wow, how much of a retard are you?
Half your links prove me right, the other are explicitly only talking about programmer-defined overloading.

https://en.wikipedia.org/w/index.php?title=Operator_overloading&oldid=678336489
>In programming, operator overloading—less commonly known as operator ad hoc polymorphism—is a specific case of polymorphism, where different operators have different implementations depending on their arguments. Operator overloading is generally defined by the language, the programmer, or both.
>>
>>52040571
However you're using "operator overloading", it's not how most people do
>>
>>52040415
You should always formally document overloaded operators.
CarFactory first, second, third;
first = second + third;

It's not always straightforward to understand why CarFactory can be '+' together. If you're going to do operator overloading, it's important to document the semantics of what it means.
>>
>>52040632
This guy gets it.
>>
>>52040632
So what is operator overloading as most people do it?
>>
>>52040484
all that effort to make your code two characters shorter. the "a = " is either not needed in the first case or missing in the second case or you're comparing apples to bananas
>>
>>52040631
>half your links prove me right
>here, look at this link you didn't fucking give

That's because operator overloading, 99% of the time a programming language mentions it, means the user defining an operator.

>>52040650
The user defining how the operator works for relevant types.


The fact that the operator depends on the type (and might work differently depending) is a given in any static language.
>>
>>52040632
Most people being retards who don't understand programming concepts doesn't mean that those concepts are somehow false.
>>
Daily reminder that the act of writing code is not coding, it is programming.

You are a programmer not a coder
You write code and You develop programs
>>
>>52040637
Car Factory shouldn't override +. If it's not already obvious what it does, it shouldn't the overridden. Just add a method to the class.

If it wouldn't make sense to name the method
CarFactory.sum(cf1 : CarFactory, cf2 : CarFactory)

does, then don't override +.
>>
>>52040680
What is the meaning of CarFactory.sum()? You still need to look in the documentation to find the details.
>>
>>52040655
Yeah, it could be:
a.addAssign(b);
Or if you're allowed symbols in your function names
a.o+=(b);
(in C++ you can manually call user defined operators - a.operator+=(b) )


>>52040661
>most people are wrong about this phrase
ok
>>
>>52038865
This
somebody explaiin
>>
>>52040553
>you can't just make up a random token like £*%"* and call it an operator
>PEP 465, a new operator (@) for matrix multiplication

POTTERY
>>
>>52040686
>What is the meaning of CarFactory.sum()?
my point exactly. If it's not obvious, then don't write it. You would never "sum" a car factory.
>>
>>52040698
Why the fuck don't python just use *
Jesus

But anyway, to anyone who doesn't like operators, the problem is the same as someone choosing a shitty name for a function.

The real potential problems with operator overloading:
- compiler figuring out what the hell is going on
- operator precedence
>>
>>52040495
:=
=
i think you mean
>>
>>52039036
gtfo to india
>>
>>52040711
So if you have to look in the documentation either way, there is no more of a problem than using overloaded operators.

I'm not advocating that we start overloading operators with wild abandon, I'm just saying that operator overloading is simply syntactic sugar.
>>
>>52040731
You shouldn't overload any operators in any non logical ways anyway.
>>
could someone explain this?

>3rd function take as arguments the name of the target, source, pointer to the element following the last element of the source
>>
File: 1444254238605.jpg (48KB, 670x496px) Image search: [Google] [Yandex] [Bing]
1444254238605.jpg
48KB, 670x496px
What programming language is the most wu tang?
>>
>his favorite programming language doesnt do this
>>
>>52040768
>I'm just saying that operator overloading is simply syntactic sugar.
Me too, but it should only ever be used when what it will do is obvious. Only if you would be able to write a function that sums two objects together, and your object is at least one of them. Anything else, and you should have a regular function.

CarFactory.sum() is not something that would exist in a real code base.
>>
>>52040801
cobol
>>
>>52040794
function pointer?
>>
>>52040804
prints out [12] ?
>>
>>52040804
>his keyboard doesn't have lambda and identity symbols on it
>>
>>52040778
so you disagree with data streams as they are overloaded with bit shifting?
cout << object;
stringstream(myobj) >> foo;
>>
>>52040825
cmon man, how else would you have packed that many symbols into one line
>>
i want to learn c# and f# in the abstract, but drinking alcohol and listening to trance music seems more appealing right now
>>
>>52040837
to real
>>
>>52040804
main = print 12

i just lifehacked your program
>>
>>52040837
do both. It will make both things more fun.
>>
>>52040830
not him
could've been done better f.am
not opposed to using operators in random ways to create DSLs (or obviously if you're writing a new language) but at least make it look right
>>
File: hrm.jpg (22KB, 223x261px) Image search: [Google] [Yandex] [Bing]
hrm.jpg
22KB, 223x261px
>>52040830
>using data streams as an example of good overloading

Not sure if bait
>>
>>52040801
ruby
>>
>>52040812
still dont have a clue
>>
What's worse, node.js or python?
>>
how do you make blender render volumes
>>
>>52040804
>>
>>52040885
need less contrast, it's too hard on the eyes
>>
>>52040880
python is a langugae. Node.js is a server side web framework.

better to use node for web shit than python imo. At least you can share your code with your client side code.
>>
File: 2015-12-24_19-55-23.png (12KB, 463x384px) Image search: [Google] [Yandex] [Bing]
2015-12-24_19-55-23.png
12KB, 463x384px
ok, this is where i left off

what should i learn next

btw, for all you trance peeps, there's an online radio end of year countdown event going on http://jellysite.es/AH/EOYC15/EOYC2015.png
>>
>>52040885
>x FOR x IN
>RANGE(1, 100)
> >=
> LAMBDA Y :
> ==
PFHAHAHAHAHHAHAHAHA
>>
>>52040890
Not irl/on my screen/with the rest of my screen.
Or are you memeing about the contrast in the haskeller's term
>>
>>52040804

I'm not sure what's less readable, Perl or Haskell...
>>
>>52040912
i am memeing
>>
>>52040909
you could write something like

[120 .. 330]
|> List.iter describePost
>>
>>52040911
:_, )
Funny, I learned about list comprehensions when learning Haskell, then abandoned it because it's used far less in the industry and has far fewer libraries available compared to Python. (This was when I was searching for a quick-to-write language, as I'd only used C and C++ prior.)
Haha right back at you.
>>
>>52040928
hmm. that ran but it didn't print anything. is it just being lazy?
>>
>>52040933
it's also not a shit language, in contrast with python
>>
>>52040942
That's not what I'm worried about, friend.
>>
File: 2015-12-24_19-59-53.png (19KB, 431x766px) Image search: [Google] [Yandex] [Bing]
2015-12-24_19-59-53.png
19KB, 431x766px
>>52040928
>>52040941
nevermind, i am retarded and typed [120 .. 33]

anyone know where my extra new lines are coming from? or maybe it's just linqpad.
>>
>>52040941
eh... should have worked. Add it to the end of your code and re-run the whole thing
>>
>>52040950
what libraries do you need when you have eternal enlightenment?
>>
>>52040965
Hope that enlightenment can help you write libs real fast. Just as fast as I can use them, actually.

But idk tbqf, haven't used Python for more much more than a week, Haskell only a few days.
>>
>>52040885

So... this?
(1..100).select { |x| x >= 7 && (lambda { |y| y * y }).(x) == 144 }.each(&:display)
>>
>>52040955

{120 .. 330}
|> Seq.filter isDubs
|> Seq.iter describePost

could be fun too.

>or maybe it's just linqpad.
I'm guessing that. Can't think of another reason.
>>
i cant do the 3rd function, don't know what it means

  9    copy_ptrs - 3rd function take as arguments the name of the target, source, pointer to the element following the last element of the source
10
11 */
12
13 #include <stdio.h>
14
15 double copy_arr(double * target, double * original, int amount);
16 double copy_ptr(double * target, double * original, int amount);
17 double copy_ptrs(double * target, double * original, int last_el);
18 void print_arrays(double * to_print, char * message);
19
20 int main(void)
21 {
22 double source[5] = {1.1, 2.2, 3.3, 4.4, 5.5};
23 double target1[5], target2[5], target3[5];
24 copy_arr(target1, source, 5);
25 copy_ptr(target2, source, 5);
26 copy_ptrs(target3, source, source + 5);
27 print_arrays(source, "Source");
28 print_arrays(target1, "Target1");
29 print_arrays(target2, "Target2");
30 print_arrays(target3, "Target3");
31 return 0;
32 }
33
34 double copy_arr(double * target, double * original, int amount)
35 {
36 int itr;
37 for (itr = 0; itr < amount; itr++)
38 target[itr] = original[itr];
39 return *target;
40 }
41
42 double copy_ptr(double * target, double * original, int amount)
43 {
44 int itr;
45 for (itr = 0; itr < amount; itr++)
46 *(target + itr) = *(original + itr);
47 return *target;
48 }
49
50 double (*copy_ptrs)(double * target, double * original, int last_el)
51 {
52 int *ptr, itr;
53 ptr = target;
54
55
56 return *ptr;
57 }
58
59 void print_arrays(double * to_print, char * message)
60 {
61 int itr;
62 printf("\n %9s: ", message);
63 for (itr = 0; itr < 5; itr++)
64 printf("%.1lf ", (double)to_print[itr]);
65 putchar('\n');
66 }
>>
File: 2015-12-24_20-05-43.png (23KB, 441x644px) Image search: [Google] [Yandex] [Bing]
2015-12-24_20-05-43.png
23KB, 441x644px
>>52040995
nice
>>
>>52040858
I like this style. It's easier than C polyvariadic printf style.
>>
>>52040990
ruby and python are so similar in my head
>>
>>52041015
>222
>dubs

fixit m8
>>
>>52040999
and?
>>
>>52041015
and a little intro to function composition would be
{120 .. 330}
|> Seq.filter (isDubs >> not)
|> Seq.iter describePost
>>
>>52040915
not the other anon, but, how is that unreadable? that looks like math notation
>>
>>52041018

Ruby was designed with a number of influences, one of which being Python.
>>
Are you fags even trying?
>>
>>52041024
I managed to get the first 2 function (copy_arr and copy_ptr), but I don't know what they meant by the 3rd one
>>
>>52041044
is that in-place?
>>
>>52041051
ok and?
>>
>>52041063
and what?
>>
>>52041017
You'll never realise how much you love printf() until you use a language that either doesn't have it or doesn't implement it properly
>>
>>52041076
well you're too stupid to get the 3rd question but what of it? are we supposed to symphatize with your poor soul or what?
>>
>>52040999
do not make copy_ptrs a function pointer wtf
>>
>>52041024
>>52041063
>>52041085
I think he wants us to do his homework or something
>>
File: 2015-12-24_20-13-11.png (26KB, 477x758px) Image search: [Google] [Yandex] [Bing]
2015-12-24_20-13-11.png
26KB, 477x758px
>>52041023
done.

i have a scaling problem now, it doesn't detect quads or quints and i don't want to use the same strategy for those.

i need some sort of lookup table like
2 => dubs
3 => trips
4 => quads
5 => quints

and to build my logic around that
>>
>>52041037
>
|> Seq.filter (isDubs >> not)

I see that that works, but the >> notation is not intuitive to me at all
>>
I wanted to explore the idea of a meme app, so I built a meme except I wanted to do it without thinking about the stuff that matters.

It uses meme as the meme plus meme, meme Gateway, and memeDB for the server-like stuff. It also uses meme and meme, two official meme libraries.

I plan to post it to the meme to ask for feedback on my use of meme -- what I could have implemented more simply. Waiting until I finish the setup guide before posting it.

In general, I've been loving meme. It's really simple and quick to get started, but as you get deeper you find that many subtle design decisions were well thought out.

EDIT: This is my first venture in meme frameworks, having previously been overwhelmed by the learning curve of meme, meme, and meme.
>>
>used c++ throughout college
>switched to c# afterwards, havent seen any c++ in years
>refreshing on c++ for a project im supposed to maintain
>mfw i remember how unnecessarily convoluted and complicated c++ is
>>
>>52041172
c++ is dogshit
>>
>>52041149
(isDubs >> not) X
or (isDubs >> not)(X)

is the same as

not(isDubs(X))
>>
>>52041149
>>52041204
intuitive way of thinking about it is that it puts the left function inside the right function
>>
>reading f# book
>"Because tab characters can indicate an unknown number of space characters, they are prohibited in F# code."

my niggas.

meanwhile, python 2 silently converts tabs to 8 spaces. python 3 is smart, but still.
>>
>>52041149
>> is the function compositor. It basically just glues two function together.

So imagine you have
let isNotDubs =
fun isNotDubs i ->
isDubs i //returns a boolean
|> not //flips the value a boolean

you can make this short with
let isNotDubs = isDubs >> not


Not something i use often, but is sometimes really nice.
>>
>>52041172
Literally never any use for C++. If you want low level, you use C, if you want higher level, you use C#
>>
>>52041250
>python silently converts
maybe your shit ide lmao
>>
File: 2015-12-24_20-29-07.png (37KB, 1617x209px) Image search: [Google] [Yandex] [Bing]
2015-12-24_20-29-07.png
37KB, 1617x209px
>>52041267
ok, it's a little smarter but not very much.
>>
>>52041252
>C#
>higher level

oops
C is quite close to F on the keyboard
perhaps your finger slipped
>>
>ocaml first class modules
wtf am i reading?
And I thought monadic pipe endo-metafunctors were fly.
>>
>>52041282
Visual Studio (2015, not sure about earlier) when editing F# documents will automatically do spaces when you press tab
>>
>>52041250
If the person used tabs correctly, then it doesn't fucking matter how many spaces they represent.
That's the point your mongoloid, you get to fucking choose.

You're as bad as iOS users, too afraid to spend more than 5 seconds configuring an app.
>>
>>52041040

I actually find a lot of mathematical notation to be rather nonsensical compared to the kinds of notation used in most modern programming languages. Further, I should note that the use of the arrow operator in x | x ← [1..100] just feels off. Generally, a left arrow is either a reverse implication, or an assignment. If one wants to suggest that x is an element of [1..100], then the ∈ symbol should be used. Not that this is in any way more readable than the word "in".
>>
>>52041252
C++ is faster than C while also being higher-level.
>>
>>52041303
>C++ is faster than C
Yup, and santa is real, and the moon is made of cheese!
>>
>>52041303
java.bait.OutOfBoundsException
>>
>>52041250
Absofuckinglutely disgusting, I didn't know about that. That's it, F# belongs in the fucking trash and I'll legit never even try it.
>>
>>52041336
you still use tab characters? shaking my head to be honest family.
>>
>>52041331
>>52041333
Lmao butthurt cmen. Can't spell cuck without c!
>>
>>52041336

>>52041292


you can also switch to verbose F# where you have a whole bunch of "done" everywhere but indenting doesn't matter
>>
partial application is so cool

addTwoNumbers x y = x + y
adds2 = addTwoNumbers 2

Prelude> adds2 4

then you literally just copy paste what adds2 is equal to and you get
addTwoNumbers 2 4

genius
>>
>>52041250
meanwhile, gofmt does the formatting for you

>>52041298
I loved mathematical notation more than I love the mess that is programming languages, pseudo-code, etc. and I haven't learned anything about functional programming. perhaps I should try it...
>>
>>52041346
>I can shitpost all I want, nobody will ever call me out on my bullshit
>oh fuck, somebody noticed!

Go ahead and prove that C++ is faster, we'd all love to see evidence.
>>
>>52041353
Oh yeah? That's actually cool. I take back what I said, I might just try F#.
>>
>>52041298
I like reading <- in list comprehensions as ∈, or "is an element of."
>>
File: aes.png (31KB, 250x156px) Image search: [Google] [Yandex] [Bing]
aes.png
31KB, 250x156px
I'm making a command line password manager using AES encryption. Is it acceptable to use the master password as the AES key, or should I be adding a salt or something to the key? If so, then if the master password is longer than the maximum AES key size (32 bytes), is it acceptable to truncate it?
>>
>>52041382
verbose F# doesn't look very good

tbfham just use tabs in visual studio, it'll convert them to spaces
>>
I'm working on my unity game :))
>>
>>52041336
Why? it totally makes sense. The editors all convert tabs to 4 spaces, and will align them to the next indentation position.

Anyways, F# is just far to good for that to make much of a mark on it's incredible lead on all other languages.
>>
>>52041298
Agree with you about the <- vs the other symbol not on my keyboard; although it wouldn't be hard to write a preprocessor to find and replace such instances.
>>
multipliesBy10 = (*) 10
multipliesBy10' x = x * 10


Well? Which one's better?
>>
>>52041375
std::sort v.s. qsort
Checkmate. In general, C++ is faster in any non-trivial program, whereas (idiomatic) C will be faster than (idiomatic) C++ in trivial programs.
>>
>>52041421
the second
>>
>>52041393
>Is it acceptable to use the master password as the AES key, or should I be adding a salt or something to the key?
Depends, do you wan't it to be kinda secure, or actually secure?
Kinda secure as in leaving the key to your house under the doormat.

>If so, then if the master password is longer than the maximum AES key size (32 bytes), is it acceptable to truncate it?
Well either you limit password entry, or you truncate.
Just make sure there are no quirks in the truncation, weird things can happen if the key is not an exact multiple of bytes (utf-16 makes this a fucking nightmare).
>>
>>52041411
Confirmed for never having worked with anybody else on a project using a language with significant whitespace. The fact that tabs are forbidden just majorly exacerbates the issues.
>>
>>52041428
>saying things on the internet makes them true
This isn't >>>/lit/ you faggot
>>
File: 2015-12-24_20-46-03.png (19KB, 550x558px) Image search: [Google] [Yandex] [Bing]
2015-12-24_20-46-03.png
19KB, 550x558px
>>
>>52041462
neat
>>
>>52041462
you're having fun i see
(you can stop posting every fucking thing you do)
>>
>>52041453
I have actually. I worked on a large coffeescript project for over a year. The only issues I ever had was when using code by someone outside our team, then I got confused because they has real tabs instead of spaces in some of their code. This was only a problem because CoffeeScript allows both. Tabs in F# code will cause compilation to fail, so no one can add them in the first place. I also like that it makes it very clear to text editors what to do.
>>
>>52041434
>Kinda secure as in leaving the key to your house under the doormat.
Okay, yeah, it looks like I should not only be adding a salt but using a key derivation function that makes the key indistinguishable from a random stream. Should have Googled a bit harder about that.
>utf-16 makes this a fucking nightmare
I'll keep that in mind, thanks.
>>
So... while we're on a general discussion of how to format things in programming languages... can I just be an oddball and say I like using fn for anonymous functions (as say, Clojure uses)? The keywords lambda and function are both way too long for reasonable one liners, and the lambda symbol itself isn't on most keyboards and may confuse a few people. I mean, imagine more like this:

[x | (x in [1..100]) and (x >= 7) and (fn(y){ y*y })(x) == 144]
>>
>>52041530
>Tabs in F# code will cause compilation to fail, so no one can add them in the first place. I also like that it makes it very clear to text editors what to do.
exactly. that's why it is so great, and I can't believe someone would get mad at the policy. it's a great policy.
>>
>>52041462
>>52041462
functions are not an instance of Show. For an explination as to why, see https://wiki.haskell.org/Show_instance_for_functions#Theoretical_answer
To get the same effect, you could create a data structure to hold the function and a string representation of it. Then pass that into printTruthTable.
Consider making printTruthTable return a String and and print its result. That will keep your function out of the IO monad.
>>
>>52041547
It truly a god tier language.
>>
>>52041533
Bro this emacs package for Haskell turns \ (the Haskell character for lambda) into the lambda symbol as soon as I type it
>>
>>52041453
Actually, dictating one style is a really good option. The rule I use on my projects is tabs for semantic indentation and whitespace for alignment, but I would much rather a language was opinionated because it keeps useless debate from happening.

That being said, I think the way Go does it (including a tool that formats code to "Go style" including whitespace) is a better option than making it a compile failure.
>>
>>52041579
>F#
>haskell advice
>>
>>52041611
>The rule I use on my projects is tabs for semantic indentation and whitespace for alignment
That is the only sane option, ever
>>
>>52041602

Not bad. Also, the coffeescript way of doing lambdas is also nice...

console.log(x for x in [1..100] when (x >= 7) and ((y) -> y * y)(x) == 144)


If CoffeeScript could be made to compile down to something other than JavaScript, or be run without using JavaScript's type system, I'd be happy.
>>
>>52041547
What's wrong with tabs?

I hate that people shove their meme "best" practices down other people's throats tbqh.
>>
>>52041640
For a long while I was seriously looking into making a fork of coffeescript that supported type annotations and compiled to typescript...

That, would be fucking awesome. Still dearly hope someone else does it.
>>
>>52041640
F# isn't too far away from CoffeeScript syntactically, but is strongly typed.

the -> lambda notation is from ES7 as you may already know.
>>
>>52041643
they can be mixed easily with spaces and confused. and different text engines will render them differently.

>I hate that people shove their meme "best" practices down other people's throats tbqh.
It's called a language spec m8
>>
>>52041602
That's pretty sweet, I'll try to find (or write) one for Vim.

>>52041533
I don't like the idea of using the f(x){___}(a) syntax personally, if the language doesn't use it for normal functions. The lamda arg arg: func syntax is a little hard to follow, though.
>>
File: is this true.png (12KB, 606x128px) Image search: [Google] [Yandex] [Bing]
is this true.png
12KB, 606x128px
>>
>>52041530
>one person uses 3 spaces throughout
>another uses 4 spaces
Or better yet:
>spend 4 hours tracking down a bug which yields an undecipherable error message when it's actually because a single space is off somewhere

Think of it this way: space-based indentation is like sand, tab-based indentation is like water. You might say "but there is sand on beaches and people love beaches!" but significant indentation causes a desert effect, and tabs are its oases.
>>
>>52041695
>and different text engines will render them differently
Yes, that's the fucking idea.
>>
>>52041456
>oh no i got btfo wat do
>i know i pretend it not exist that show 'em.
>>
>>52041725
I didn't understand that analogy at all.
>>
>>52041725
>>spend 4 hours tracking down a bug which yields an undecipherable error message when it's actually because a single space is off somewhere
That won't produce a any issues. They'll be in the same scope, but there will be a compiler warning afaik. It's also really clear when something is misaligned by a space.

I don't follow your analogy.
>>
>>52038469
t-that's k-kawaii
>>
Shit, now I'm remembering a bot I made long ago and far away for Cookie Clicker. Not even sure if it still works, given possible API changes, but man, it had some weird looking functions...

choose_best_purchase = ->
purchasable = []
purchasable.push upgrade for own name, upgrade of Game.Upgrades when (
(2 * upgrade.basePrice < Game.cookiesEarned) and
(upgrade.unlocked isnt 0) and
(upgrade.bought is 0) and
(name isnt "Revoke Elder Covenant"))
# If no upgrade is available,
# purchase the cheapest building possible, but don't purchase
# buildings that aren't Cursors, Grandmas, Portals, or Antimatter condensers in excess of 200
if purchasable.length is 0
chosen = Game.Objects.Cursor
chosen = building for own name, building of Game.Objects when (
(chosen.price > building.price) and (
(name in ["Cursor", "Grandma", "Portal", "Antimatter condenser", "Prism"]) or
(building.amount < 200)))
chosen
# Otherwise, we chose the cheapest upgrade possible
else
chosen = purchasable[0]
chosen = upgrade for upgrade in purchasable when (upgrade.basePrice < chosen.basePrice)
chosen


make_purchases = ->
purchase = choose_best_purchase()
# Upgrades have basePrice attribute but not price attribute
# So we check to see if we're purchasing an upgrade or not.
if purchase.price?
purchase.buy() if purchase.price <= Game.cookies
else
purchase.buy() if purchase.basePrice <= Game.cookies
setTimeout make_purchases, purchase_timeout
>>
>>52041730
Why is that good? If you mix tabs and spaces, then things that are aligned in one editor, will not be aligned in another.
>>
>>52041736
Not only do you not provide any actual evidence, but you spout nonsense about sepples always being faster for complex problems and C being faster for trivial ones, whilst providing a trivial example.

Excuse me for not taking you seriously.
>>
>>52041611
Exactly who does the "useless" debate inconvenience again? Certainly not the people doing the actual programming. There is no reason for a language to enforce what IT THINKS is best for the programmers. Should goto and switch/case be removed from C, then? Should pointer arithmetic be banned? Should arrays be removed because off-by-one errors, even when they don't result in horrible C-style failures, are still common? Should we stop using turing-complete languages in case we make the mistake of writing functions that don't return?
Of fucking course not, this is all insane, and it yields java's and python's. The same applies obviously to any other aspect of the language. A language is a tool, it is meant to empower and certainly not to restrict on constrain (in the sense of making things impossible, not of making things harder to do, which is a valid approach to balancing danger and power).
>>
>>52041772
Because different engines render them differently, no matter what engine is used, all code that uses tabs will keep perfectly indented.
>>
>>52041772
Because you indent with tabs, and align with spaces.
Why do people struggle with this concept so much?
>>
>>52041810
yes, but not if they are mixed. That is my point.

>>52041815
because what aligns in one editor using that method will not align in another. Is that not obvious?
>>
why are you people so fucking dumb and autistic?

does anyone discuss actual programming here?
>>
>>52041753
It's impossible for a compiler to tell you where the incorrect indentation is for the obvious reason that the indentation changes the semantic in a valid way (resulting, or not, in a valid program, that's a second question; the transformation itself is valid though). The error typically appears nowhere near the point where the space is missing or extra. Sometimes it even causes errors in completely different modules (if coincidentally, the modified code remains valid; something similar to goto fail but using indentation instead of ; is another example).
>>
>>52041793
Could you be even more buttobliterated if an industrial drill got lodged up your ass? I doubt it.
>>
>>52041824
but it will fucking align you dense motherfucker.

If an already indented line needs alignment, you indent with tabs as usual then add spaces to align after.

You could set tabs to fucking 0 and it would still all be aligned, it would just have no indentation for code blocks.
If someone wants to use an editor that sets tabs to zero, and them complain their python doesn't work, well I kinda don't care if a retard can't use my code.
>>
>>52041839
Well, discussing tabs vs spaces is easier.
>>
>>52041824
>because what aligns in one editor using that method will not align in another.
But it fucking will, that's the whole fucking point of using tabs for indentation you fucking inbred.
>but not if they are mixed.
Then the point is moot because if someone uses 3 spaces one place and 4 another then they won't keep indented the same either you fucking tard.
>>
>>52041839
I know, I wanted to debate those idiots that think linked lists are slow
>>
>>52041685
>F# isn't too far away from CoffeeScript syntactically, but is strongly typed.
bullshit, F# is Ocaml, F# is not a functional/OO hybrid language like Scala or Dylan. Ocaml has OO, but its very different (arguably better) type of OO that are in conventional languages. The ML family of languages is great, but lets be honest about what it is and stop selling it as something its not
>>
>>52041855
I can't hear you over the vacuum of evidence
>>
>>52041893
>>52041893
>>52041893
>>52041893

NEW
>>
>>52038440
cant find the name of this. anyone know?
>>
>>52041870
and what if you end up indenting with spaces somewhere? Should that not compile? What should happen?
>>
>>52041839
There is nobody worthy in here to debate anything. It's full of imbeciles who believe C to be faster than C++ in the average case, who think linked lists are both useless and slow in all cases, and who'd rather use significant whitespace languages rather than powerful languages.
>>
>>52041892
Dylan's OO is also way different from regular languages, as it's smalltalk-based and not simula-based.

F# WISHES it was ocaml, but it never will be.
>>
>>52041892
>F# is not a functional/OO hybrid language like Scala or Dylan.
That's precisely what it is you retard. Do you know anything about F#? It's derived from ocaml, it's not the same fucking language.
>>
>>52041942
>F# WISHES it was ocaml, but it never will be.
nah. F# has a lot of nice features ocaml lacks
>>
>>52041943
its not 'derived' from Ocaml, most F# code will compile in Ocaml, its pretty much the same language with very minor differences
>>
>>52041952
F#'s nice features can be emulated in ocaml, but not the other way around. F# be mirin.
>>
>>52041913
I dunno, what if I randomly press any other key 4 times somewhere?
Why should that compile either?
>>
>>52041964
>most F# code will compile in Ocaml
Most, not all

> its pretty much the same language with very minor differences
Just stop

You can write literally anything you can write in C# using F# syntax.

>>52041967
Multicore support? Type Providers? Quotations? Computation expression and Async workflows?
>>
>>52042003
>what if I randomly press any other key 4 times somewhere?
compilation error obviously. Are you saying the same should happen if you use spaces to indent?
>>
>>52041722
>>IQ
>
>>
>>52041901
Dumbass
>>
>>52042016
No, but if your language is sensitive about whitespace then that is a good reason to fail compilation
>>
>>52042009
>Type Providers? Quotations? Computation expression and Async workflows?
All yes.
>Multicore support?
Will be available in 7 days.
Thread replies: 324
Thread images: 24
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK