This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[warn(no_vecs_not_implicitly_copyable)]; | |
iface to_str { | |
fn to_str() -> str; | |
} | |
impl of to_str for int { | |
fn to_str() -> str { int::to_str(self, 10u) } | |
} | |
impl of to_str for str { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dvec::dvec; | |
iface core_iter<A> { | |
fn each2(blk: fn(A) -> bool); | |
} | |
impl core_iter<A> for option<A> { | |
fn each2(f: fn(A) -> bool) { | |
alt self { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Hacky script to assist in updating the snapshot files. | |
# Give it the log urls as arguments for the snap-stage3 builds and it | |
# will produce something to paste into snapshots.txt. | |
STRINGS=$(for URL in "$@" | |
do | |
FNAME=${URL/html/txt} | |
wget -q -O- "$FNAME" | sed 's/\\n/\n/g'| grep 'Public URL' | cut -d- -f5- | cut -d. -f1 | |
done) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iface builder<A> { | |
// This would have some methods | |
} | |
impl extensions<A: copy> of builder<A> for @[A] { } | |
// Pretend that these are static typeclass methods | |
fn new_container<A,IA:builder<A>>() -> IA { | |
fail "this is a dummy for type inference testing!" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iface builder<A> { | |
// These "static" methods ignore their self parameter | |
fn __new_container() -> self; | |
fn __push(&_v: self, +_x: A); | |
} | |
impl extensions<A: copy> of builder<A> for ~[A] { | |
fn __new_container() -> ~[A] { ~[] } | |
fn __push(&v: ~[A], +x: A) { vec::push(v, x); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Currently, all trait methods must take an implicit self parameter, | |
which is limiting in a lot of cases. | |
I propose that we add a notion of "static" trait methods (although I | |
don't really like that name). These are simply trait functions that do | |
not take a self parameter. These functions would be called like | |
regular functions, and the names would live in the module where the | |
trait is declared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod foo { | |
fn f() { } | |
} | |
mod bar { | |
import foo::f; | |
mod foo { | |
fn thing() { f(); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import task::{local_data_get, local_data_set}; | |
fn display_callback_tls_key(+_callback: @fn@()) { | |
// Empty. | |
} | |
fn display_callback() unsafe { | |
let callback = local_data_get(display_callback_tls_key).get(); | |
(*callback)(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Hacky script to assist in updating the snapshot files. | |
# Give it the log urls as arguments for the snap-stage3 builds and it | |
# will produce something to paste into snapshots.txt. | |
STRINGS=$(for URL in "$@" | |
do | |
FNAME=${URL/html/txt} | |
wget -q -O- "$FNAME" | sed 's/\\n/\n/g'| grep 'Public URL' | cut -d- -f5- | cut -d. -f1 | |
done) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GeneralizedNewtypeDeriving, GADTs #-} | |
data SameType a b where | |
Refl :: SameType a a | |
coerce :: SameType a b -> a -> b | |
coerce Refl = id | |
trans :: SameType a b -> SameType b c -> SameType a c | |
trans Refl Refl = Refl |
OlderNewer