Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Mockingbird

Name: Anonymous 2013-03-05 14:55

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: Anonymous 2013-03-05 14:56

MOCK MY ANUS

Name: Anonymous 2013-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: Anonymous 2013-03-05 15:06

perl6

Name: Anonymous 2013-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?

Name: Anonymous 2013-03-05 15:32

>>5
Perl6 can be extremely typed, or not


# 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: 6 2013-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: Anonymous 2013-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: Anonymous 2013-03-05 15:58

>>8
In fact, that line you posted Int $foo = "bar"; does fail at compile time.

Name: Anonymous 2013-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 α -> α.

Name: Anonymous 2013-03-05 16:19

>>2
Your anus smells like shit.

Name: Anonymous 2013-03-05 17:07

>>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: Anonymous 2013-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: Anonymous 2013-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: Anonymous 2013-03-05 17:16

>>12
for a mission critical server
[MISSION CRITICAL SERVER

Name: Anonymous 2013-03-05 17:22

>>15
That is why you need Perl 6.

Name: Anonymous 2013-03-05 22:39

f = (\x -> unsafeCoerce x x) :: a -> a

Name: Anonymous 2013-03-05 23:14

>>17

/thread

Name: Anonymous 2013-03-06 0:13

>>17
f 10 crashes GHC.

Name: Anonymous 2013-03-06 0:23

>>19
Change the type to (a -> a) -> a -> a if you're too stupid to be trusted with the godlike powers of unsafeCoerce.

Name: Anonymous 2013-03-06 0:32


._._._._, .     .  .,,,.,,,.........
|| ._. |||`|: :|'|| ,__ ./|  ..,.,,/
|| | | ||| |: :| || | /./ |  \----~
|| | | ||| |: :| || |//   '\  \
|| |/ //'| |: :| || . \.   \\  \
|| / //' | |: :| || |\ |    \\  \
||  //'  | |: :| || | \ \    \\  \
|| //'   `| \_/ |'| |__\ \ ...!\  \
||//'      \   /  |_'___`')|_______')
`''         ```    `'`''`` ''`'"`'~"`

Name: Anonymous 2013-03-06 0:49

So is this a Haskell thread?

Name: Anonymous 2013-03-06 0:57

>>22
We should start a petition to add infinite types to Haskell.

Name: Anonymous 2013-03-06 1:01

>>22
Every thread is a Haskell thread.

>>23
Why would you need them when stuff like >>17 can already be done?

Name: Anonymous 2013-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: Anonymous 2013-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.

Name: Anonymous 2013-03-06 3:52

(define (w x) (x x))
What's so bad about this?

Name: Anonymous 2013-03-06 5:30

It bothers me that I am unable to create recursive types in C.

Time to make a new language.

Name: Anonymous 2013-03-06 5:47

>>28
It's bothering me a lot.
A lot.

Name: Anonymous 2013-03-06 13:46

>>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

Name: Anonymous 2013-03-07 0:49

>>25
Type my Omega.

Name: Anonymous 2013-04-04 21:50

amazing dubs, >>33

Name: Anonymous 2013-04-04 22:02

>>28
Recursive types wouldn't make sense. What's wrong with pointers?

Name: Anonymous 2013-04-04 22:27

if you even had a clue what you were talking about you'd realize these things can't be typed

Name: Anonymous 2013-04-04 23:16

>>33
Type this! p = &p;

>>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: Anonymous 2013-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: Anonymous 2013-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: Anonymous 2013-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: Anonymous 2013-04-05 1:15

>>38
whoa, lambdas an closurus?! Whaterthehell mann! X>

Name: Anonymous 2013-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?

Name: Anonymous 2013-04-05 2:20

>>40
Please understand, I am not making fun of you. I am making fun of java.

Name: Anonymous 2013-04-05 3:55

If it's java, it's shit.
If it's javascript, it's a turd.

Name: Anonymous 2013-04-05 13:05

>>38
50 shades of java.

Name: Anonymous 2013-04-05 15:02

mocking dubs
jajajajajaja XD

Name: Anonymous 2013-04-05 23:59

>>44
>jajajajaja

Le unfunny beaner

Name: Anonymous 2013-04-06 1:47

>>45
Le mainstream racism.

Name: Anonymous 2013-04-06 12:07

To Mock a Mocking Nerd xD

Name: Anonymous 2013-04-06 12:18

>>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

Name: Anonymous 2013-04-06 13:23

>>48
Typical anglophone monkey.

Name: Anonymous 2013-04-06 13:49

I realized how to fix lisp and make it popular, ust change the notation to f(x,y,z) instead of (f x y z).

Name: Anonymous 2013-04-06 13:56

>>50
define(reverse(l),
       if(null?(l),
          list(),
          cons(reverse(cdr(l)),
               car(l))))

pig disgusting

Name: Anonymous 2013-04-06 14:02

>>51
It looks Prolog-ish.

Name: Kim Jong Un !!U+/WhdIY7jOc6fW 2013-04-06 14:04

no

Name: Anonymous 2013-04-06 14:45

>>51
Symta:
reverse [X@Xs] = [@reverse.Xs X]



Lisp:
define(reverse(l),
       if(null?(l),
          list(),
          cons(reverse(cdr(l)),
               car(l))))

Name: Anonymous 2013-04-06 15:26


reverse([],Acc,Acc).
reverse([X|Xs],Acc,Res) :- reverse(Xs,[X|Acc],Res).
reverse(Xs,Res) :- reverse(Xs,[],Res).

Name: Anonymous 2013-04-06 16:19

Le lamduh calculus

Don't change these.
Name: Email:
Entire Thread Thread List