-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Use stdlib examples directly from ponylang/ponyc repository"
This reverts commit 0f8e225.
- Loading branch information
Showing
12 changed files
with
65 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
use @frexp[F64](value: F64, exponent: Pointer[U32]) | ||
// ... | ||
var exponent: U32 = 0 | ||
var mantissa = @frexp(this, addressof exponent) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
primitive NetAuth | ||
new create(from: AmbientAuth) => | ||
None | ||
|
||
primitive DNSAuth | ||
new create(from: (AmbientAuth | NetAuth)) => | ||
None | ||
|
||
primitive UDPAuth | ||
new create(from: (AmbientAuth | NetAuth)) => | ||
None | ||
|
||
primitive TCPAuth | ||
new create(from: (AmbientAuth | NetAuth)) => | ||
None | ||
|
||
primitive TCPListenAuth | ||
new create(from: (AmbientAuth | NetAuth | TCPAuth)) => | ||
None | ||
|
||
primitive TCPConnectAuth | ||
new create(from: (AmbientAuth | NetAuth | TCPAuth)) => | ||
None |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
recover | ||
var s = String((prec + 1).max(width.max(31))) | ||
var value = x | ||
|
||
try | ||
if value == 0 then | ||
s.push(table(0)?) | ||
else | ||
while value != 0 do | ||
let index = ((value = value / base) - (value * base)) | ||
s.push(table(index.usize())?) | ||
end | ||
end | ||
end | ||
|
||
_extend_digits(s, prec') | ||
s.append(typestring) | ||
s.append(prestring) | ||
_pad(s, width, align, fill) | ||
s | ||
end |
24 changes: 8 additions & 16 deletions
24
code-samples/traits-and-interfaces-structural-subtyping.pony
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
actor Main | ||
new create(env: Env) => | ||
let divident: U8 = 1 | ||
let divisor: U8 = 0 | ||
let result = div_by_zero(divident, divisor) | ||
match result | ||
| let res: U8 => env.out.print(divident.string() + "/" + divisor.string() + " = " + res.string()) | ||
| let err: ExecveError => env.err.print(divident.string() + " cannot be divided by " + divisor.string()) | ||
end | ||
|
||
fun div_by_zero(divident: U8, divisor: U8): (U8 | ExecveError) => | ||
try divident / divisor | ||
return divident /? divisor | ||
else | ||
return ExecveError | ||
end | ||
interface box Stringable | ||
""" | ||
Things that can be turned into a String. | ||
""" | ||
fun string(): String iso^ | ||
""" | ||
Generate a string representation of this object. | ||
""" | ||
|
||
primitive ExecveError | ||
fun string(): String iso^ => "ExecveError".clone() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type SetIs[A] is HashSet[A, HashIs[A!]] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var _array: Array[((K, V) | _MapEmpty | _MapDeleted)] |
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
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
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
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
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
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