Some languages don't really care about types and allow to write something like (define (w x) (x x)) or even worse stuff.
Are there any statically-typed languages that allow to mock the mockingbird?
Name:
Anonymous2013-03-05 14:56
MOCK MY ANUS
Name:
Anonymous2013-03-05 15:02
>>1 ocaml -rectypes
You can define the mockingbird as let w x = x x which has the type ('a -> 'b as 'a) -> 'b.
Name:
Anonymous2013-03-05 15:06
perl6
Name:
Anonymous2013-03-05 15:15
>>3
Thanks. But ocaml fails instantly: # ((fun x -> x x) id) 1;;
Error: This expression has type int but an expression was expected of type
'a -> 'a as 'a >>4
When did it became statically typed?
# The multi keyword is for overloading functions
multi func ($val) {
say "untyped '$val'"
};
multi func (Int $val) {
say "Integer $val"
};
func('a'); # Prints the message: untyped 'a'
func(1); # Prints the message: Integer 1
It can check other conditions also:
# %% is the 'divisible by' operator
sub func (Int $x where $x %% 2) {
say "even number"
};
func (2); # Prints the message even number
func (1); # Gives you an error
Name:
62013-03-05 15:41
I might have answered a different thing, OP: check this code too
my Int $num = 123;
my Str $name = "Baka-san";
my @array_of_shit = ($num, $name);
say @array_of_shit.perl;
say @array_of_shit[0].WHAT, @array_of_shit[1].WHAT;
This code will print
«Array.new(123, "Baka-san")
(Int)(Str)»
Name:
Anonymous2013-03-05 15:44
>>6,7
Looks more like a simple dynamic dispatch with contracts.
If it allows to write Int $foo = "bar" and fails at run-time only, don't call it statically typed language.
Name:
Anonymous2013-03-05 15:58
>>8
In fact, that line you posted Int $foo = "bar"; does fail at compile time.
Name:
Anonymous2013-03-05 16:12
Algol 68 has equi-recursive types but no polymorphism. In Algol 68, the types P, PROC(P)P, PROC(P)PROC(P)P, PROC(PROC(P)P)P, and so on are equivalent. They're all different ways to denote the equi-recursive type α -> α.
>>7
One thing I am always concerned with is quality of Java code compared with
Perl, which runs rock solid, but isn't strictly typed. While these days
Java crashes much less and developers do predominately good job handling
memory.. for a mission critical server, you'd hope they don't rely on
something heavily in a plugin which requires a lot of constant tweaking to
remain stable.
Name:
Anonymous2013-03-05 17:09
The Develop rock-solid code in PHP series is about solving practical real-life problems in medium- to large-scale applications. With a sharp focus on new features available in PHP 4, the articles shed light on numerous tips and tricks that make life easier. Inside, you will find plenty of examples and techniques to learn, with lots of sample code. In this first article, PHP veteran Amol Hatwar gives a higher perspective for designing and writing bug-free, maintainable code for medium- to large-scale Web applications.
Coding in PHP is very much like coding in a language like C. They are syntactically similar which can also lead to similar code maintenance problems. When large-scale applications have to be developed, large quantities of code may be written. Over time, this code may become unmanageable and soon bugs creep in. Wherever you heard this, it is untrue -- at least partly. But the bigger truth is that if you find yourself maintaining your code too often, your application was probably poorly designed in the first place.
Name:
Anonymous2013-03-05 17:10
>>13 the bigger truth is that if you find yourself maintaining your code too often, your application was probably poorly designed in the first place.
You see? The problem isn't the PHP, the problem is YOU!
Name:
Anonymous2013-03-05 17:16
>>12 for a mission critical server [MISSION CRITICAL SERVER
>>23
Why would you need them when stuff like >>17 can already be done?
Name:
Anonymous2013-03-06 2:11
>>24
The same reason as the other GHC type extensions: because it's possible. Also because all expressions in the untyped lambda calculus can be typed.
Name:
Anonymous2013-03-06 3:34
Some language designers when confronted with a problem think, "I know, I'll introduce another binary operator!" Now they have created Haskell.
>>17
Unsafe stuff is and obvious hack that shows type system's impotence instead of it's power.
Furthermore: Prelude Unsafe.Coerce> let w x = unsafeCoerce x x
Prelude Unsafe.Coerce> w id
Segmentation fault: 11
>>34
Fuck off and die in a vat of boiling cum you cock sucking anus penetrating orifice filling lispy talking fashionable dressing feminine walking faggot.
Name:
Anonymous2013-04-04 23:31
>>31
pesudo-Ocaml: type omega = omega
pseudo-Haskell: type Omega = Omega
pseudo-Algol 68: MODE OMEGA = OMEGA >>35
Ocaml -rectypes: type p = p ref
pseudo-Haskell: type P = IORef P
pseudo-Algol 68: MODE P = REF P
Name:
Anonymous2013-04-05 0:22
>>35 Fuck off and die in a vat of boiling cum you cock sucking anus penetrating orifice filling lispy talking fashionable dressing feminine walking faggot.
Such is the mating call of the Haskeller, a rare subspecies of exclusively homosexual (and quite flamboyantly so) of homo faggotus.
Bow down to the superiority of LISP and untyped lambda calculus, you fucking Fagotron-3000.
Name:
Anonymous2013-04-05 1:10
>>37
More like bow down to Java 8 when it's released.
Support for lambdas and closures.
Better get some shades, 'cause the future's bright.
Name:
Anonymous2013-04-05 1:15
>>38
whoa, lambdas an closurus?! Whaterthehell mann! X>
Name:
Anonymous2013-04-05 2:15
>>39
please stop patronising me
I know I'm stupid and just another /b/rogrammer, but at least I'm trying, right?
>>47
Stop le mocking me illogical shitstain I FUCKING HATE YOU!!! DIE IN A FUCKING FIRE YOU COCK-SNIFFING ASS PIECE OF SHIT LE ANGLO ENCULER FAIRE SHIT SHIT PISS OUT MY ASS LE MOCKING ME AWFDS FSDFSDF ASSDAFDAFA DFJHG FGJSDFSFS ARGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH