|
if ( (input == 0) || (input == null) || (input == int('0')) || (input == false) || (input == "") || (input == " ") ) {
|
# ? Jan 25, 2014 02:33 |
|
|
# ? Jun 8, 2024 21:00 |
|
Sagebrush posted:if ( (input == 0) || (input == null) || (input == int('0')) || (input == false) || (input == "") || (input == " ") ) { yes, exactly. this is what you have to do in bad languages with bad type systems, instead of just being able to say "if (!$input)".
|
# ? Jan 25, 2014 02:35 |
|
Tiny Bug Child posted:the proper way to do things is to write your code so that it means the same thing whether something is null or false or "" or "0" or 0, and then just go "if ($butt)" or "if (!$butt)" in some people's jobs which don't involve making porn sites, the distinction between "0" and "" may be quite important distinguishing the others should be taken care of for you automatically by the type system, of course
|
# ? Jan 25, 2014 02:36 |
|
for sure. that's when you gotta special case it. save_butt($butt === '' ? null : $butt). spergequals is always there for when you actually need to care about the difference, you just have to be able to be able to recognize those situations. ppl who use strongly typed languages aren't smart enough to do that so they have to have a compiler to hold their hand.
|
# ? Jan 25, 2014 02:42 |
|
tbc was right, you want very broad booleans in a dynamically typed languagecode:
code:
|
# ? Jan 25, 2014 02:46 |
|
FamDav posted:its good for dumb langs that do it but the problem is nullable should never be the default. what's weird is that well-written c++ actually does this p well with references and such, you can take an object reference as one of your parameters and it's impossible for it to refer to null this feels extremely strange to me, being used to stuff like c# where nearly everything is a reference and can be null i kind of like it, though you know, in among the "your code doesn't compile? sprinkle some &s and std::move()s around until everything works" ing
|
# ? Jan 25, 2014 02:54 |
|
i think i'm starting to acquire stackholm syndrome, someone help me
|
# ? Jan 25, 2014 02:54 |
|
yeah of all things loving Vala gets nullability right you get string? vs string where the latter is never-null and it's enforced by the type system. (well and of course every pattern-matching lang with Maybe and Just but nobody uses those)
|
# ? Jan 25, 2014 04:33 |
|
http://en.wikipedia.org/wiki/Cyclone_%28programming_language%29
|
# ? Jan 25, 2014 04:53 |
|
i like Maybe, its a good monad. maybe the only good one
|
# ? Jan 25, 2014 06:12 |
|
lol whats more important than porn. (I heard porn killed it during the storms) please stop arguing about how languages pass nulls and learn your language instead and talk about the merits of higher level stuff. I'm trying to learn. I'd like a tef post tbh he gets you guys going in the right direction
|
# ? Jan 25, 2014 06:24 |
|
Tavistock posted:lol whats more important than porn. Just curious why you would want nulls? Either you want your objects to have some object defined zero value, and I'm using zero loosely here as I know we don't always work with numbers. But this object you're working with, does it belong to some mathematical group? Can you think of a way it should? Can you make it belong to some analogous group, like an additive or multiplicative group? If you can force this constraint null values really don't make any sense at all and only force more type checking which is pretty loller.
|
# ? Jan 25, 2014 06:39 |
|
Nomnom Cookie posted:i like Maybe, its a good monad. maybe the only good one yeah lists are freakin' stupid
|
# ? Jan 25, 2014 06:51 |
|
Sorry, I didn't mean to stoke the fire further. I'm just back seat modding. I'd like to learn more about why the object paradigm is so bad. I've heard a lot about the greatness about functional languages without side-effects(idk what a side-effect is) as being good, but why cant functional and oop exists together (are they opposed)? does it have to do with typing (non-keyboard)? sorry if that's too much and not yospos'y nuff friday night biiiches
|
# ? Jan 25, 2014 07:01 |
|
fuzzy booleans are poo poo is it that hard to type equal signs and a keyword?
|
# ? Jan 25, 2014 08:36 |
|
Tavistock posted:Sorry, I didn't mean to stoke the fire further. I'm just back seat modding. they arent oppose my brudda an object is just data plus functions that act upon them functional programming is arguably mostly about no side eeffects a side effect s like you get the output of a unctiuon but the function actually did something you didnt know about so when you call the function somethng else changes? another example is that when you do io the result is always different because people are capricious and suck.
|
# ? Jan 25, 2014 08:53 |
|
I think the best way to learn what's the deal with side effects is to just try to do anything in some functional language. I mean really, try doing something silly like a counter function.
|
# ? Jan 25, 2014 08:57 |
|
layout-wise fp and oop are kind of opposite when you look at the decomposition in a table if you organize your program into functions doing operations you'll get one function per column if you break your program into classes dictating behavior you'll get one class per row
|
# ? Jan 25, 2014 09:28 |
|
closure objects are the poor man's object closures etc etc
|
# ? Jan 25, 2014 09:28 |
|
functional programming seems pretty useless. "side effects" are the actual useful things a computer does. woo i can push numbers around how exciting
|
# ? Jan 25, 2014 10:07 |
|
Tiny Bug Child posted:functional programming seems pretty useless. "side effects" are the actual useful things a computer does. woo i can push numbers around how exciting cept it turns out that most things arent side effecting fagggot
|
# ? Jan 25, 2014 10:22 |
|
Tiny Bug Child posted:functional programming seems pretty useless. "side effects" are the actual useful things a computer does. woo i can push numbers around how exciting side effects as in showing things on the screen or w/e are good and useful side effects as in randomyl making GBS threads global state all over the place and then depending on that exact configuration of poo poo to work consistently is not the second one is what functional languages attempt to prevent, sometimes this makes the first one a little harder
|
# ? Jan 25, 2014 10:23 |
|
Tiny Bug Child posted:woo i can push numbers around how exciting also this is literally all computers ever do so
|
# ? Jan 25, 2014 10:27 |
|
tbc do you work with other ppls code or is it all yr own
coffeetable fucked around with this message at 10:31 on Jan 25, 2014 |
# ? Jan 25, 2014 10:28 |
|
Arcsech posted:side effects as in showing things on the screen or w/e are good and useful Yeah FP means you have to think a lot harder about where you have state in your program, but it makes it an awful lot easier to maintain the functional parts once they're done. You get the knowledge that values go in and results come out, and manage to rule out a bunch of possible errors in the process.
|
# ? Jan 25, 2014 11:24 |
|
Tavistock posted:Sorry, I didn't mean to stoke the fire further. I'm just back seat modding. F#, C# with LINQ, clojure, scala are all oop langs that are pretty functional.
|
# ? Jan 25, 2014 12:18 |
|
Haskell sounds cool, lemme go develop some web apps in it *puts "Expert Loli developer" on his resume* seriously who comes up with this poo poo, the same people who decided to call a Photoshop clone "the GIMP"?
|
# ? Jan 25, 2014 12:39 |
|
haskell is basically just something programmers came up with so they wouldn't have to use the software they're writing
|
# ? Jan 25, 2014 12:42 |
|
http://www.haskell.org/haskellwiki/What_a_Monad_is_notquote:This shouldn't be too surprising, though, as >> isn't the binary operation of some monoid: the algebraic properties of join are very close to those of + and incidentally, join is also the operation true category theorists tend to work with. They also know of bind, but don't use it a lot because, unlike programmers, they don't do any actual productive work.
|
# ? Jan 25, 2014 12:49 |
|
i could maybe deal with c++11 as a language to program in but is there any part of the standard library that is not utterly terrible? DON'T WRITE YOUR OWN STRING CLASS YOU IDIOT STD::STRING WAS IMPLEMENTED BY SOMEBODY MUCH SMARTER THAN YOU even then std::exception is still baked into the language because std::bad_cast is baked into the language
|
# ? Jan 25, 2014 15:48 |
|
Deus Rex posted:yeah lists are freakin' stupid list monad is. so are linked lists
|
# ? Jan 25, 2014 16:00 |
|
You know what my least favourite monad is? ((->) a) so many dumb and unintelligible hacks because of that one. hey i can save 3 characters and force somebody to spend 5 minutes figuring out what this line does?? e: i guess this is what all of haskell is like to tbc gonadic io fucked around with this message at 16:20 on Jan 25, 2014 |
# ? Jan 25, 2014 16:15 |
|
the difference between functional and object oriented languages is that in oo langs you docode:
and in functional languages you do code:
|
# ? Jan 25, 2014 16:34 |
|
AlsoD posted:You know what my least favourite monad is? reader monad is super lol
|
# ? Jan 25, 2014 16:38 |
|
"OOP" is wishy washy grab bag of fashionable programming language features that doesn't have a well-defined meaning beyond "the word 'object' is used to refer to at least some things that would otherwise be called 'values'". PL features that do have well-defined meanings include subtyping, dynamic dispatch, overloading, coercion, strong/dynamic/weak typing, access control, and operator overloading. Any given PL may have any combination of these features, some of which might be considered to be "object-oriented".
|
# ? Jan 25, 2014 16:44 |
|
yes, stromg/weak typing. the most well-defined of terms
|
# ? Jan 25, 2014 17:47 |
|
actually yeah I suppose you're right still better defined than "OOP" though.
|
# ? Jan 25, 2014 18:14 |
|
Strong typing: References are typed (but values can coerce a bit?) Dynamic typing: References have no type, values can coerce a bit but only between numeric types. Weak typing: References are untyped, Strings coerce to and from things on the numeric tower and ah who the gently caress cares just make semantics up as you go along. ...except by that logic C++ is both strongly and weakly typed, since I can declare a FuckedString class that has an operator int, a FuckedString(int) ctor, and a FuckedString operator+(int rhs) so yeah you're right strong/weak typing isn't particularly well defined.
|
# ? Jan 25, 2014 18:17 |
|
strong/weak is unrelated to static/dynamic static/dynamic is whether or not the types are checked/discarded at compile time or kept at runtime (also tends to be compiled vs interpreted but this obviously isn't true all the time) weak/strong is generally whether or you can implicitly coerce things or if you're forced to do any coercions explicitly
|
# ? Jan 25, 2014 18:25 |
|
|
# ? Jun 8, 2024 21:00 |
|
Mr Dog posted:i could maybe deal with c++11 as a language to program in but is there any part of the standard library that is not utterly terrible? i don't ever want to have to write another stack/queue/map/etcetcetc again
|
# ? Jan 25, 2014 19:45 |