Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
JewKiller 3000
Nov 28, 2006

by Lowtax

Socracheese posted:

my theory of computation class prof threatened to make us program stuff for one of these:

https://www.youtube.com/watch?v=E3keLeMwfHY&t=8s

that rig is pretty sw8 tho. it can compute anything that's computable :allears:

it's not a true universal turing machine because it doesn't have an infinite tape :colbert:

xf86enodev posted:

the only reason php is as popular as it is is apache mod_php

ftfy

Adbot
ADBOT LOVES YOU

JewKiller 3000
Nov 28, 2006

by Lowtax

Mr Dog posted:

JVM and the Java Standard Library just seem like a crappy fit for a LISP to me

scala is not a lisp. also if you want f# without all the .net faggotry, try ocaml! :)

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

i can't sleep so i'm being really anal about parsing

https://github.com/mojombo/toml/issues/42

laughing at how many of those questions would have been answered if he had just provided a grammar for his lovely "language"

JewKiller 3000
Nov 28, 2006

by Lowtax

Nomnom Cookie posted:

using arrays (especially primitive arrays) whenever reasonable

enjoy your extra runtime checks to compensate for broken (covariant) arrays

JewKiller 3000
Nov 28, 2006

by Lowtax

Otto Skorzeny posted:

the funny thing here is that all modern c compilers will optimize out range checks in the cases where they're expensive with no loss in safety. Sufficiently Smart JIT, folks

i'm not talking about range checks, these are runtime type checks, done because the static typing of arrays in java is unsound with respect to subtyping

JewKiller 3000
Nov 28, 2006

by Lowtax
there needs to be a required course in all college cs/ce/softeng/whatever degrees, where the entire content of the class is just reading and discussing key internet RFCs and ISO standards. it's easy to test, highly relevant, and would reduce some of this "everyone reinvents the world badly" bullshit

JewKiller 3000
Nov 28, 2006

by Lowtax
as long as they're implementing a standard, rather than creating their own without even the knowledge that one already exists, it's a step in the right direction

JewKiller 3000
Nov 28, 2006

by Lowtax
strong static typing with type inference or go gently caress your mother

JewKiller 3000
Nov 28, 2006

by Lowtax

gucci void main posted:

pattern matching unironically owns

cannot understand why people would accept using programming languages without it

JewKiller 3000
Nov 28, 2006

by Lowtax
that whole "assume the reader knows the rules of the programming language" guideline is meant to avoid useless COMMENTS, not dictate how you actually write the CODE

i mean you should know better than to abuse automatic compiler behaviors to write something that's deliberately tricky to follow, just because "hey c++ allows it heheheheheh"

JewKiller 3000
Nov 28, 2006

by Lowtax
like scott meyers says, c++ is a "federation" of four languages: c, the oop c-with-classes poo poo, template c++, and the stl

these four all have their own conventions and interact badly. whenever you run into some stupid gotcha in c++, that tends to be the reason (otherwise it's manual memory management)

edit: boost probably qualifies as a fifth

JewKiller 3000
Nov 28, 2006

by Lowtax

Gazpacho posted:

do you wanna give just one concrete example

i'm saying that the guideline "if the language allows it, you're good bro" is not a good one... i could overload all the operators to do completely different things than their agreed-upon meanings, name all my functions and variables with one letter, etc... "it's valid c++ heheheh" is not a good excuse for this

if you want an actual example of some c++ i think is awful then my favorite one is: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Casting.h?view=markup

JewKiller 3000
Nov 28, 2006

by Lowtax

Gazpacho posted:

wow you're t. clueless

:thumbsup:

JewKiller 3000
Nov 28, 2006

by Lowtax
stay away from c++ and learn functional programming or something else interesting

JewKiller 3000
Nov 28, 2006

by Lowtax
also gazpacho you can stop posting now

JewKiller 3000
Nov 28, 2006

by Lowtax
the only good c++ references consist of lists of things you should not do in c++

this covers effective c++ and also the c++ fqa

JewKiller 3000
Nov 28, 2006

by Lowtax

Jerry SanDisky posted:

do (mostly) functional programming in c++ :q:

only in c++11 is that even a possibility

JewKiller 3000
Nov 28, 2006

by Lowtax
page 420 :420:

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

or: no-one should learn first aid because real medicine is hard.

maybe am I the only who thinks that maybe learning to code even a little might help people use computers effectively, even if it's just simple automation or scripting.


rather than just teaching monks how to illuminate scripts

look bro, us monks are making a poo poo ton of money right now illuminating those scripts. if the rest of the world figures out that programming isn't just arcane sperg wizardry, and they can do it too, we might have to get off our asses and Do Work, or accept lower salaries!

JewKiller 3000
Nov 28, 2006

by Lowtax
the reason web development sucks and will keep sucking is that everyone who knows what they're doing gets away from it as soon as they possibly can

also the web is a pile of stupid hacks

JewKiller 3000
Nov 28, 2006

by Lowtax

Tiny Bug Child posted:

lol what are you talking about

jesus christ just stop posting everyone is tired of you

JewKiller 3000
Nov 28, 2006

by Lowtax

Tiny Bug Child posted:

maybe when people stop being wrong and stupid about programming. variable variables are very useful

it may be the case that they are "useful" in an html templating language for functional retards. but fyi there are still environments where compiling to efficient machine code matters, and it is not acceptable to implement variables as "one giant global dynamic associative array"

i can't believe i'm seriously responding to a tbc post

JewKiller 3000
Nov 28, 2006

by Lowtax
yeah if you have absolutely no skill at encoding your specifications into the type system, then you'll think about types as just "true" vs True or 5 vs "5" and never Get It

it's not entirely your fault though, many programming languages don't have the tools you really need in their type systems

JewKiller 3000
Nov 28, 2006

by Lowtax

rotor posted:

yeah i just dont get it jewkiller3k

seriously you don't. i don't care how old and "experienced" you are, if that's your seriouspost about type systems, try reading a book about them published after 1970

JewKiller 3000
Nov 28, 2006

by Lowtax

rotor posted:

i dont really find myself needing to "encode" my "specifications" into code because I dont write libraries any more. back when i did, I didn't find that "byte, int, char*, char*, byte" was significantly clearer that "var, var, var, var, var", you either have them descriptively named or you have docs.

jesus christ how dense are you? my entire point is that you can do more with type systems than "byte, int, char*, char*, byte", and you might appreciate this if you learned about types beyond C

or, you know, you can just reject a useful tool because you never learned how to use it properly. most programmers do too!

JewKiller 3000
Nov 28, 2006

by Lowtax
and of course you assume i'm talking about oop. respond to my loving post not whatever motivations you suppose i have

i'm not saying that absolutely every program must be written in a language with a static type system, i never said that. you originally posted that type safety wasn't useful because of the sort of errors it catches. i'm disagreeing with that, it can catch much more important bugs than "true" vs True, if you have a powerful enough type system (not c) and you learn how to use it well enough (not tbc)

JewKiller 3000
Nov 28, 2006

by Lowtax

rotor posted:

types for everything makes refactoring harder, so you do it less.

we're through the rabbit hole here folks

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

Well, no, this is not true, and the only people who say this have heads so broken they can't imagine otherwise.

bob harper disagrees with you

JewKiller 3000
Nov 28, 2006

by Lowtax

Bream posted:

Is my naivete revealing itself when I say that I can't think of an example where a runtime error would be preferable to a compiler error?

actually it's your common sense

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

i believe the post that I wrote already explained this

"Well, no, this is not true, and the only people who say this have heads so broken they can't imagine otherwise."

i'd put you on two for two on not reading my post or his strawman

normally i respect your opinion because you seem well educated, but i'm gonna have to defer to professor harper on this one, sorry. whatever lame excuses you might use against me ("hurrrr learn logic") surely do not apply to him. i doubt you understood his post if you think it's just a strawman

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

I'd really like to be able to write code and then introduce annotations that could be optionally checked by runtime, but not have the program be constrained by the checking, or my types to be limited in the same way.

so you want an assertion?

tef posted:

That I can't add a type for a string of a certain format, and handle validation cleanly, in almost any language static or dynamic, means I'm always forced to check things at runtime.

are you serious? using ML as an example: create a module containing a type validated_string which is abstract to the outside world. in this module's interface, provide a function to create a validated_string from a plain string, which checks for the formatting you wanted. your interface should export no other way to create a validated_string. now make all the necessary functions require a validated_string as input, and the compiler will ensure it is always the case :confused:

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

i'm waiting for the classic scoff where someone indicates how not understanding hm type inference is a valid reason to make programs hard to debug, and then ignore that haskell has allowed you to defer errors to runtime for months now, to aid debugging and prototyping

here you go then:

if a person does not understand hindley-milner type inference, that is a valid reason to tell him to choose another career path. i'm serious, if you cannot grok a simple unification algorithm that basically boils down to "the caller must be consistent with the callee", you belong as far away from source code as society can possibly place you

JewKiller 3000
Nov 28, 2006

by Lowtax

MononcQc posted:

Does Haskell suddenly become unityped? Has the language definition drastically changed? Is the level of typedness decided by the compiler's type checker or by the language specification?

hmm that's an interesting question! i'm not sure, but because harper likes standard ML, i suspect he would defer to the language specification, which might "prevent" you from deferring type checks until runtime

JewKiller 3000
Nov 28, 2006

by Lowtax

MononcQc posted:

But Haskell allows to defer type errors to the run-time on GHC! Is Haskell sometimes unityped now?

basically i think harper is arguing that, since a language like haskell can be made "dynamically typed" when necessary as you describe, but in addition it also supports other static types, there is no reason to use so-called dynamic languages where the unitype is the only one available

JewKiller 3000
Nov 28, 2006

by Lowtax
well harper is an academic, so if your response is of the form "yes that's TECHNICALLY true but it's still a pain in the rear end in the programming language my boss lets me use", i doubt he cares.

there are people out there whose job is to think beyond what is allowed by php and java, and we need these people! :)

JewKiller 3000
Nov 28, 2006

by Lowtax

Cocoa Crispies posted:

programming doesn't have to be a career path, it's also used by people who want to automate a boring part of their actual job

it shouldn't be some high priesthood of types and inference, sometimes people just want to mangle some csvs or screen scrape a web site

that's absolutely fine with me, not that anyone needs my permission. to give a silly engineering analogy, if you are building a bridge across the 2 foot wide creek in your backyard, nobody minds if you use old rotting boards and superglue. but if we're talking about the bay bridge, i don't wanna see any loving php

JewKiller 3000
Nov 28, 2006

by Lowtax

MononcQc posted:

But then the opposite idea is also true (see the list of optional typing systems I've posted on last page). You can turn dynamic languages -- at least some of them -- into static ones if you want. It's just a question of where you run the type checking, and if it's blocking compilation or not.

i think the key here is the caveat "some of them". there are definitely programs you can write in dynamically typed languages which will not statically type check without a more advanced type system than is tractable to run, if they type check at all. statically type checking dynamic languages is an active research area, but all systems i know of that handle real programs contain a catchall dynamic type to fall back on

JewKiller 3000
Nov 28, 2006

by Lowtax

Cocoa Crispies posted:

that's a poo poo analogy though, because one of the nice parts about modern programming is most things scale horizontally to a point, and you can replace parts cheaply and easily

i don't think that's really true. take facebook as an example, they started with some dirty php code, then needed to scale up. to do this, they first spent a shitload of money on hardware. then, when that wouldn't help anymore, they hired some very expensive developers to write a custom compiler (with jit!) from their busted-rear end php to c++. they also hired up all the "decent" php programmers to fix the code so their custom compiler can handle it efficiently. and facebook is still slow and it sucks. none of this sounds cheap or easy.

if you are doing a little basic automation for your job that is not oriented around computers and providing services through them, do it however you want! otherwise i really believe it makes sense to plan for the future

JewKiller 3000
Nov 28, 2006

by Lowtax
the upside down A means forall, go read the wikipedia page on first order logic, it will take you 10 minutes.

for some reason people present hindley-milner type inference in a much more complicated way than it needs to be presented imo. it's just unification, checking for consistency of types

Adbot
ADBOT LOVES YOU

JewKiller 3000
Nov 28, 2006

by Lowtax
edit: this post is for jonny 290 :)

assumption for this post: the * operator takes two integers and returns an integer

let's say you have a function square, that takes an argument x and returns x * x

now you want to set the variable y = square 2. what is the type of y? obviously it's int, because square 2 returns int. so why should you have to specify the type of y? just write "let y = square 2" and then use y. the compiler knows y is an int. if you do something with y that is not supported on ints, like string concatenation, you get an error like: "here you used y as a string, but y is an int"

extrapolate that principle to the rest of the programming language. that's literally all there is to it. does this post seem retarded simple??? that's because it is!!!

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply