Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2/?] Add ability to run code examples in the playground: Extend code samples to be runnable #545

Open
wants to merge 60 commits into
base: main
Choose a base branch
from

Conversation

shaedrich
Copy link
Collaborator

@shaedrich shaedrich commented May 20, 2024

See #340

As per #542 (comment)

Stats

  • runnable: 148
  • not runnable: 157
  • erroring: 6
  • open questions: 3

Files

Getting Started

  • hello-world-main.pony → prints
    Hello, world!
    • hello-world.md: --8<-- "hello-world-main.pony → runnable
    • how-it-works.md: --8<-- "hello-world-main.pony → runnable
    • how-it-works.md: --8<-- "hello-world-main.pony::1 → not runnable
    • how-it-works.md: --8<-- "hello-world-main.pony:2:2 → not runnable
    • how-it-works.md: --8<-- "hello-world-main.pony:3:3 → not runnable

Types

  • classes-swap-values-sugar.pony → prints
    a = 1, b = 2
    a = 2, b = 1
    • --8<-- "classes-swap-values-sugar.pony:6:6" → runnable
  • classes-swap-values.pony → prints
    a = 1, b = 2
    a = 2, b = 1
    • --8<-- "classes-swap-values.pony:6:8" → runnable
  • classes-wombat-constructor-invocation.pony (see classes-wombat.pony)
  • classes-wombat-constructors.pony → prints
    Your default wombat's name is "Fantastibat"
    Your hungry wombat's name is "Nomsbat"
    • --8<-- "classes-wombat.pony:8:18" → runnable
  • classes-wombat.pony → prints
    Fantastibat has a hunger level of 5
    Nomsbat has a hunger level of 12
    • --8<-- "classes-wombat.pony:1:19:9" → not runnable
    • --8<-- "classes-wombat.pony:1:39:11" → not runnable
    • --8<-- "classes-wombat-constructor-invocation.pony:3:4" → runnable
  • classes-zero-argument-constructors-invocation.pony (see classes-zero-argument-constructors.pony)
  • classes-zero-argument-constructors.pony → no output (is that desireble?)
    • --8<-- "classes-zero-argument-constructors.pony:9:16" → runnable
    • --8<-- "classes-zero-argument-constructors-invocation.pony:5:17" → runnable
  • primitives-doors.pony → prints
    Is door open? false
    2 + 3 = 5
    (Does it even make sense to have these two things together in one example?)
    • --8<-- "primitives-doors.pony" → runnable
  • actors-behaviors.pony (How to print anything useful?)
  • actors-sequential.pony → prints
    This is printed first
    This is printed last
  • traits-and-interfaces-marker-methods.pony
    • traits-and-interfaces.md: --8<-- "traits-and-interfaces-marker-methods.pony:1:1" → not runnable
    • traits-and-interfaces.md: --8<-- "traits-and-interfaces-marker-methods.pony" → not runnable
  • traits-and-interfaces-multiple-traits.pony → prints
    Their name is "Bob" and they are not bald
    • traits-and-interfaces.md: --8<-- "traits-and-interfaces-multiple-traits.pony:6:12" → runnable
  • traits-and-interfaces-nested-traits.pony → prints
    Their name is "Bob" and they are not bald
    • traits-and-interfaces.md: --8<-- "traits-and-interfaces-nested-traits.pony:6:12" → runnable
  • traits-and-interfaces-nominal-and-structural-subtyping.pony →
    Their name is "Bob"
    Their name is "Larry"
    • traits-and-interfaces.md: --8<-- "traits-and-interfaces-nominal-and-structural-subtyping.pony:8:14" → runnable
  • traits-and-interfaces-nominal-subtyping-in-pony.pony → prints
    Their name is "Larry"
    • traits-and-interfaces.md: --8<-- "traits-and-interfaces-nominal-subtyping-in-pony:6:7" → runnable
  • traits-and-interfaces-nominal-subtyping.pony → not runnable
  • traits-and-interfaces-open-world-enumerations.pony → not runnable
  • traits-and-interfaces-open-world-interface.pony (see traits-and-interfaces-marker-methods.pony)
  • traits-and-interfaces-open-world-typing.pony → prints
    size: 2, space: 8
    size: 2, space: 8
    size: 3, space: 8
    size: 3, space: 4
    • traits-and-interfaces.md: --8<-- "raits-and-interfaces-open-world-typing.pony:6:9" → runnable
  • traits-and-interfaces-private-methods.pony → runnable, fails with
    interfaces can't have private methods, only traits can
  • traits-and-interfaces-structural-subtyping-in-pony.pony → not runnable
  • traits-and-interfaces-structural-subtyping.pony → prints
    1 cannot be divided by 0

traits-and-interfaces-structural-subtyping.pony:18:19
--8<-- → runnable

  • traits-and-interfaces-trait.pony → prints
    Their name is "Bob"
    • traits-and-interfaces.md: --8<-- "traits-and-interfaces-trait.pony:20:36" → runnable
  • traits-and-interfaces-type-union.pony → not runnable
  • structs-constructors.pony → not runnable
  • structs-fields.pony
  • type-aliases-complex-types-interface.pony → prints
    Bob, aged 42, feels "Great!"
    • type-aliases.md: --8<-- "type-aliases-complex-types-interface.pony:6:15"` → runnable
  • type-aliases-complex-types-trait.pony
    • type-aliases.md: --8<-- "type-aliases-complex-types-trait.pony:6:15"` → runnable
  • type-aliases-enumerations-apply.pony → prints
    red: #FF0000FF
    green: #FF00FF
    blue: #FFFF
    • type-aliases.md: --8<-- "type-aliases-enumerations-iteration.pony:15:19" → runnable
    • type-aliases.md: --8<-- "type-aliases-enumerations-iteration.pony"--8<--
      type-aliases-enumerations-apply.pony:21:23
      type-aliases-enumerations-apply.pony:11:13
      --8<--
  • type-aliases-enumerations-iteration.pony (see type-aliases-enumerations-apply.pony)
  • type-aliases-enumerations-namespace.pony → not runnable
  • type-aliases-enumerations.pony → not runnable
  • type-aliases-hash-set.pony → not runnable
  • type-aliases-map.pony → not runnable
  • type-aliases-set-is.pony → not runnable
  • type-expressions-combined.pony → not runnable
  • type-expressions-intersection.pony → not runnable
  • type-expressions-tuple-declaration.pony → not runnable
  • type-expressions-tuple-destructuring.pony → not runnable
  • type-expressions-tuple-direct-access.pony → not runnable
  • type-expressions-tuple-reassignment.pony → not runnable
  • type-expressions-type-alias.pony → not runnable
  • type-expressions-union.pony → not runnable

Expressions

  • literals-array-literals.pony → prints
    first, second, third one on a new line
    first
    second
    third one on a new line
    first, second, third one on a new line
    first, second, third one on a new line
    first
    second
    third one on a new line
    • literals.md: --8<-- "literals-array-literals.pony:3:7"` → runnable
  • literals-as-expression.pony → not runnable
  • literals-character-literals.pony → prints
    "A" (char 65) = "A" (char 65) = "
    " (char 10)
    • literals.md: --8<-- "literals-character-literals.pony:3:5"` → runnable
  • literals-floats.pony → not runnable
  • literals-multi-line-string-literals.pony → not runnable
  • literals-multibyte-character-literals.pony → not runnable
  • literals-number-types.pony → prints
    1024 = 1024 = 1024
    • literals.md: --8<-- "literals-number-types.pony:3:5"` → runnable
  • literals-numeric-typing.pony → not runnable
  • literals-string-literals-encoding.pony → runnable
    • literals.md: --8<-- "literals-string-literals-encoding.pony:3:3"`
    • + literals-string-literals-encoding-latin-1.pony
  • literals-string-literals-instances.pony → prints
    Same pony
    • literals.md: --8<-- literals-string-literals-instances.pony:3:6 literals-string-literals-instances.pony:10:10 --8<--
  • literals-string-literals.pony → runnable, prints
    🐎 pönÿ 🐎
    0xF0
    0x9F
    0x90
    0x8E
  • literals-triple-quoted-string-literals.pony → not runnable
  • literals-type-inference-coercion.pony → not runnable
  • literals-type-inference-reference-capabilities.pony → not runnable
  • literals-type-inference-union.pony → not runnable
  • variables-fields-constructor-assignment.pony → prints
    Fantastibat has a hunger level of 5
    • variables.md: --8<-- "variables-fields-constructor-assignment.pony:6:12"` → runnable
  • variables-fields-definition-assignment.pony → prints
    Fantastibat has a hunger level of 0
    • variables.md: --8<-- "variables-fields-definition-assignment.pony:6:8"` → runnable
  • variables-fields-implicit-assignment.pony → ⚠️ fails with
    receiver type is not a subtype of target type
  • variables-fields-let-reassignment.pony → fails with
    can't assign to a let or embed definition more than once
    • variables.md: --8<-- "variables-fields-let-reassignment.pony:5:17"` → runnable
  • variables-let-reassignment.pony → fails with
    can't declare a let local without assigning to it
    • variables.md: --8<-- "variables-let-reassignment.pony:3:5"` → runnable
  • variables-local-variables.pony → not runnable
  • variables-scope.pony → fails with
    can't find declaration of 'x'
    • variables.md: --8<-- "variables-scope.pony:6:11"` → runnable
  • variables-var-vs-let.pony → fails with
    can't reassign to a let local
    • variables.md: --8<-- "variables-var-vs-let.pony:3:6"` → runnable
  • operators-add.pony → prints
    (4, 6)
    • operators.md: --8<-- "operators-add.pony"--8<--
      operators-add.pony:8:19
      operators-add.pony:23:29
      --8<--
      → runnable
  • operators-infix-operator.pony → not runnable
  • operators-operator-aliasing.pony → not runnable
  • operators-precedence-infix-and-unary-operators-with-parentheses.pony
  • operators-precedence-infix-and-unary-operators-without-parentheses.pony
  • operators-precedence-single-operator.pony → not runnable
  • operators-precedence-unary-operator-with-parentheses.pony → fails with
    Operator precedence is not supported. Parentheses required.
    • operators.md: --8<-- " operators-precedence-unary-operator-with-parentheses.pony:3:3"` → runnable
  • operators-precedence-with-parentheses.pony → not runnable
  • operators-precedence-without-parentheses.pony → fails with
    Operator precedence is not supported. Parentheses required.
    • operators.md: --8<-- "operators-precedence-without-parentheses.pony:3:3"` → runnable
  • operators-unary-operators.pony → not runnable
  • arithmetic-default-integer-arithmetic.pony → ⚠️ not runnable, fails with
    Operator precedence is not supported. Parentheses required.
  • arithmetic-explicit-numeric-conversion.pony → not runnable
  • arithmetic-partial-and-check-arithmetic.pony → prints
    overflow detected
    overflow detected
    • arithmetic.md: --8<-- "arithmetic-partial-and-check-arithmetic.pony"--8<--
      arithmetic-partial-and-check-arithmetic.pony:7:14
      arithmetic-partial-and-check-arithmetic.pony:16:20
      arithmetic-partial-and-check-arithmetic.pony:22:22
      arithmetic-partial-and-check-arithmetic.pony:24:26
      --8<--
      → runnable
  • arithmetic-unsafe-conversion.pony → not runnable
  • control-structures-conditionals-expression-implicit-none.pony → prints
    None
    • control-structures.md: --8<-- "control-structures-conditionals-expression-implicit-none.pony:4:7"` → runnable
  • control-structures-conditionals-expression-union-type.pony → prints
    false
    • control-structures.md: --8<-- "control-structures-conditionals-expression-union-type.pony:4:9"` → runnable
  • control-structures-conditionals-expressions.pony → prints
    x = 101—that's lots
    • control-structures.md: --8<-- "control-structures-conditionals-expressions.pony:5:5"` → runnable
  • control-structures-conditionals-if-else.pony → prints
    a is not bigger
    • control-structures.md: --8<-- "control-structures-conditionals-if-else.pony:5:9"` → runnable
  • control-structures-conditionals-if-elseif-else.pony → prints
    a is bigger
    • control-structures.md: --8<-- "control-structures-conditionals-if-elseif-else.pony:5:11"` → runnable
  • control-structures-conditionals-if.pony → prints
    a is bigger
    • control-structures.md: --8<-- "control-structures-conditionals-if.pony:5:7"` → runnable
  • control-structures-conditionals-nested-if-else.pony → prints
    they are the same
    • control-structures.md: --8<-- "control-structures-conditionals-nested-if-else.pony:5:13"` → runnable
  • control-structures-iterator-methods.pony → not runnable;
  • control-structures-loop-expression-else.pony → runnable, prints
    x is no names!
  • control-structures-loop-expression-none.pony → runnable, prints
    x is None
  • control-structures-loop-expression.pony → runnable, prints
    x is Sarah
  • control-structures-loops-for-while-comparison.pony → prints
    Bob
    Fred
    Sarah
    • control-structures.md: --8<-- "control-structures-loops-for-while-comparison.pony:4:8"` → runnable
  • control-structures-loops-for.pony → prints
    Bob
    Fred
    Sarah
    • control-structures.md: --8<-- "control-structures-loops-for.pony:3:5"` → runnable
  • control-structures-loops-repeat.pony → runnable,
    hello!
    hello!
    hello!
    hello!
    hello!
    hello!
    hello!
  • control-structures-loops-while-break-else.pony → prints
    name = Jack
    • control-structures.md: --8<-- "control-structures-loops-while-break-else.pony:10:19"` → runnable
  • control-structures-loops-while.pony → prints
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    • control-structures.md: --8<-- "control-structures-loops-while.pony:3:8"` → runnable
  • match-expression.pony → ⚠️ not runnable, fails with
    Multiple possible types for literal
  • match-capabilities-only.pony → no output (is that desireble?)
  • match-capabilities.pony → no output (is that desireble?)
  • match-captures.pony → prints
    two
    other integer
    • match.md: --8<-- "match-captures.pony:6:13"` → runnable
  • match-custom-eq-operand.pony → no output (is that desireble?)
  • match-guards.pony → prints
    one other small integer
    two other big integer
    • match.md: --8<-- "match-guards.pony:6:15"` → runnable
  • match-tuples-ignore-elements.pony → prints
    one other integer
    • match.md: --8<-- "match-tuples-ignore-elements.pony:5:13"` → runnable
  • match-tuples.pony → prints
    one two
    • match.md: --8<-- "match-tuples.pony:5:13"` → runnable
  • match-type-and-value.pony → prints
    two
    something else
    • match.md: --8<-- "match-type-and-value.pony:6:14"` → runnable
  • match-value-pattern-matching-vs-type-check.pony → no output (is that desireble?)
  • match-values.pony → prints
    two
    something else
    • match.md: --8<-- "match-values.pony:6:14"` → runnable
  • as-operator-array-literal.pony → not runnable
  • as-operator-match-statement-comparison.pony → prints
    I'm a clean wombat!
    I feel squeaky clean!
    • as.md: --8<-- "as-operator-match-statement-comparison.pony:11:23"` → runnable
  • as-operator-match-statement-without-try.pony → prints
    I'm a clean wombat!
    I feel squeaky clean!
    • as.md: --8<-- "as-operator-match-statement-without-try.pony:11:19"` → runnable
  • as-operator-more-specific-interface-with-reference-capability.pony → prints
    I'm a clean wombat!
    I feel squeaky clean!
    • as.md: --8<-- "as-operator-more-specific-interface-with-reference-capability.pony:11:18"` → runnable
  • as-operator-more-specific-interface.pony → runnable, prints
    I'm a clean wombat!
    I feel squeaky clean!
    I'm swimming like a fish!
  • as-operator-more-specific-type.pony → ⚠️ error is silently discarded
  • as-operator-unrelated-type.pony → fails with
    Dog is alive but not well
    • as.md: --8<-- "as-operator-unrelated-type.pony:1:10"` → runnable
  • methods-anonymous-methods.pony → runnable, prints
    1
    3
  • methods-chaining-return-value.pony → ⚠️ fails with "can't find definition of 'Option'"
  • methods-chaining.pony → not runnable
  • methods-constructors-calling-on-expression.pony → not runnable
  • methods-constructors-calling-reuse-variable-name.pony → not runnable
  • methods-constructors-calling.pony → not runnable
  • methods-constructors.pony → prints
    create: 0
    from_int: 42
    • methods.md: --8<-- "methods-constructors.pony:6:13"` → runnable
  • methods-default-arguments.pony → not runnable
  • methods-functions-calling-implicit-this.pony → not runnable
  • methods-functions-calling.pony → not runnable
  • methods-functions.pony → prints
    add: 3
    nop: None
    • methods.md: --8<-- "methods-functions.pony:6:11"` → runnable
  • methods-named-and-positional-arguments-combined.pony → not runnable
  • methods-named-arguments.pony → not runnable
  • errors-dispose-multiple.pony → not runnable
  • errors-dispose.pony → not runnable
  • errors-partial-functions.pony → prints
    factorial(5) results in 120
    , fails with
    factorial(-5) failed
    • errors.md: --8<-- "errors-partial-functions.pony:16:22"` → runnable
  • errors-try-else.pony → fails with
    callB() resulted in an error
    • errors.md: --8<-- "errors-try-else.pony:9:15"` → runnable
  • errors-try-then.pony → prints
    I don't know whether callB() was executed successfully ¯_ (ツ)_/¯ I get executed either way
    , fails with
    callB() resulted in an error
    • errors.md: --8<-- "errors-try-then.pony:9:17"` → runnable
  • errors-try-without-else.pony → not runnable
  • errors-with-blocks.pony → not runnable
  • equality-equatable-default-implementation.pony → not runnable
  • equality-identity-equality.pony → not runnable
  • equality-primitives.pony → not runnable
  • equality-structural-equality.pony → runnable
  • sugar-apply-explicit.pony → not runnable
  • sugar-apply-implicit.pony → not runnable
  • sugar-apply-with-arguments-explicit.pony → not runnable
  • sugar-apply-with-arguments-implicit.pony → not runnable
  • sugar-create-apply-combined-explicit.pony
  • sugar-create-apply-combined-implicit.pony
  • sugar-create-explicit.pony → not runnable
  • sugar-create-implicit.pony → not runnable
  • sugar-create-with-arguments-explicit.pony → not runnable
  • sugar-create-with-arguments-implicit.pony → not runnable
  • sugar-update-additional-parameters.pony → prints
    foo = 5
    foo1 = 23
    foo2 = 0
    foo3 = 379.5
    • sugar.md: --8<-- "update-additional-parameters.pony:18:18"` → runnable
  • sugar-update-explicit.pony → prints
    foo = 10
    foo = 370
    • sugar.md: --8<-- "sugar-update-explicit.pony:18:18"` → runnable
  • sugar-update-implicit.pony → prints
    foo = 10
    foo = 370
    • sugar.md: --8<-- "sugar-update-implicit.pony:18:18"` → runnable
  • object-literals-actor-literal.pony → prints
    hi
    • object-literals.md: --8<-- "object-literals-actor-literal.pony:4:6"` → runnable
  • object-literals-closing-over-values.pony
    • object-literals.md: --8<-- "object-literals-fields-assignment.pony:1:8"` → runnable
  • object-literals-fields-assignment.pony → prints
    hello world: 14657180516326564906
    • object-literals.md: --8<-- "object-literals-fields-assignment.pony:1:9"` → runnable
  • object-literals-lambda-as-explicit-object-literal.pony → prints
    lambda: hello world
    • object-literals.md: --8<-- "object-literals-lambda-as-explicit-object-literal.pony:4:6"` → runnable
  • object-literals-lambda-capture-and-rename-values.pony → prints
    Hello World
    • object-literals.md: --8<-- "object-literals-lambda-captur-eand-rename-values.pony:6:7"` → runnable
  • object-literals-lambda-capture-values.pony → prints
    Hello World
    • object-literals.md: --8<-- "object-literals-lambda-capture-values.pony:5:10"` → runnable
  • object-literals-lambda-reference-capabilities-2.pony → runnable, prints
    hello
    world
    Count: 0
  • object-literals-lambda-reference-capabilities.pony → runnable, prints
    Result: 100
  • object-literals-lambda-with-reference-capability-as-explicit-object-literal.pony → prints
    lambda: hello world
    • object-literals.md: --8<-- "object-literals-lambda-with-reference-capability-as-explicit-object-literal.pony:4:6"` → runnable
  • object-literals-lambda-with-reference-capability.pony → prints
    lambda: hello world
    • object-literals.md: --8<-- "object-literals-lambda-as-with-reference-capability.pony:4:4"` → runnable
  • object-literals-lambda.pony → prints
    lambda: hello world
    • object-literals.md: --8<-- "object-literals-lambda.pony:5:5"` → runnable
  • object-literals-object-literal-with-interface.pony → prints
    hi: 7970167862792651685
    • object-literals.md: --8<-- "object-literals-object-literal-with-interface.pony:6:9"` → runnable
  • object-literals-object-literal.pony → prints
    hi
    • object-literals.md: --8<-- "object-literals-object-literal.pony:4:6"` → runnable
  • object-literals-reference-capability.pony
    • object-literals.md: --8<-- "object-literals-fields-assignment.pony:1:9"` → runnable
  • partial-application-callback-function-with-all-arguments-bound.pony → not runnable;
  • partial-application-callback-function-with-no-arguments-bound.pony → not runnable;
  • partial-application-callback-function-with-out-of-order-arguments.pony → not runnable;
  • partial-application-callback-function-with-some-arguments-bound.pony → not runnable;
  • partial-application-partially-applying-a-partial-application.pony → not runnable;

Reference capabilities

  • reference-capabilities-constructors-for-different-capabilities.pony → not runnable
  • reference-capabilities-default-vs-explicit.pony → not runnable
  • reference-capabilities-string-capabilities.pony → not runnable
  • reference-capabilities-string-default.pony → not runnable
  • reference-capability-specificy-a-capability-other-than-the-default.pony → not runnable
  • consume-and-destructive-read-consuming-a-variable-and-change-its-reference-capability.pony → not runnable
  • consume-and-destructive-read-consuming-a-variable.pony
    • consume-and-destructive-read.md --8<-- "consume-and-destructive-read-consuming-a-variable.pony:15:26" → runnable, prints nothing
    • consume-and-destructive-read.md --8<-- "consume-and-destructive-read-consuming-a-variable-failure.pony:5:7" → runnable, fails with
      can't use a consumed local or field in an expression
  • consume-and-destructive-read-moving-a-value.pony → not runnable
  • recovering-capabilities-format-int.pony → not runnable
  • recovering-capabilities-ref-to-iso.pony → not runnable
  • recovering-capabilities-string-append.pony → prints
    hi
    • recovering-capabilities.md: --8<-- "recovering-capabilities-string-append.pony:3:4"
  • recovering-capabilities-with-explicit-reference-capability.pony → prints
    key: Lorem
    • recovering-capabilities.md: --8<-- "recovering-capabilities-with-explicit-reference-capability.pony:5:5" → runnable
  • aliasing-alias-types.pony → not runnable
  • aliasing-ephemeral-types.pony → not runnable
  • aliasing-iso-to-tag.pony → prints nothing
    • aliasing.md: --8<-- "aliasing-iso-to-tag.pony:5:6" → runnable
  • aliasing-multiple-references-to-an-iso-object.pony → fails with
    right side must be a subtype of left side
    • aliasing.md: --8<-- "aliasing-multiple-references-to-an-iso-object.pony:5:6" → runnable
  • aliasing-trn-to-box.pony → prints nothing
    • aliasing.md: --8<-- "aliasing-trn-to-box.pony:5:6" → runnable
  • arrow-types-box.pony → not runnable
  • arrow-types-this.pony → not runnable
  • arrow-types-type-parameter.pony → not runnable

Object capabilities

  • derived-authority-authority-hierarchies.pony → not runnable
  • derived-authority-delegating-and-restricting-authority.pony → prints
    connect_failed
    • derived-authority.md: --8<-- "derived-authority-delegating-and-restricting-authority.pony" → runnable
    • derived-authority.md: --8<-- "derived-authority-delegating-and-restricting-authority.pony:18:18" → not runnable
  • derived-authority-restrict-then-delegate-your-authority.pony → fails with
    try expression never results in an error
    • derived-authority.md: --8<-- "derived-authority-restrict-then-delegate-your-authority.pony:16:22"

Generics

  • generics-and-reference-capabilities-accept-any-reference-capability.pony → runnable, fails with
    right side must be a subtype of left side</blockquote
  • generics-and-reference-capabilities-capability-generic-class.pony → runnable, prints
    Hello
    World
    42
  • generics-and-reference-capabilities-default-capability-and-constraint.pony → not runnable
  • generics-and-reference-capabilities-explicit-constraint-and-default-capability.pony → not runnable
  • generics-and-reference-capabilities-foo-iso-consume-iso-constructor-parameter.pony → ⚠️ prints essentially nothing. Is that desired?
  • generics-and-reference-capabilities-foo-iso-consume-iso-function-parameter.pony → ⚠️ Probably a ref missing, could then just be a snippet of generics-and-reference-capabilities-foo-iso
  • generics-and-reference-capabilities-foo-iso.pony → runnable, fails with
    right side must be a subtype of left side
  • generics-and-reference-capabilities-foo-ref-and-this-ref.pony → ⚠️ prints essentially nothing. Is that desired?
  • generics-and-reference-capabilities-foo-ref.pony → runnable, fails with
    function body isn't the result type
  • generic-constraints-foo-any-read.pony → runnable, prints
    hello
    World
  • generics-foo-non-generic.pony → runnable, prints
    42
    21
  • generics-foo-string.pony → prints
    Hello
    • generics.md: --8<-- "generics-foo-string.pony:1:9" → runnable
  • generics-foo-with-any-val.pony → runnable, prints
    42
    21
    1.5
    Hello
  • generics-generic-class-initialization.pony (see generics-foo-with-any-val.pony)
  • generics-generic-methods.pony → runnable, prints
    10
    Hello
  • generics-type-parameter-defaults-definition.pony → ⚠️ fails with
    type argument is outside its constraint
    • generics.md: --8<-- "generics-type-parameter-defaults<del>-definition</del>.pony:1:9"
    • generics.md: --8<-- "generics-type-parameter-defaults<del>-initialization</del>.pony:13:15"
  • generics-type-parameter-defaults-initialization.pony (see generics-type-parameter-defaults-definition.pony)

Packages

  • use-statement-collections.pony → not runnable?
  • use-statement-scheme-indicators-optional-package-scheme-specifier.pony → not runnable
  • use-statement-scheme-indicators-required-package-scheme-specifier.pony → not runnable
  • use-statement-time-now.pony → not runnable
  • use-statement-time.pony → not runnable take from time.pony
  • use-statement-use-names-conflict.pony → not runnable
  • use-statement-use-names-resolution-alternative.pony → not runnable
  • use-statement-use-names-resolution.pony → not runnable

Testing

  • ponycheck-ponytest-for-all.pony → not runnable, ⚠️ fails with
    argument not assignable to parameter
  • ponycheck-ponytest.pony (see ponycheck-usage.pony)
  • ponycheck-usage-quickcheck.pony → not runnable, ⚠️ fails with
    argument not assignable to parameter
  • ponycheck-usage.pony → prints
    1 test started, 0 complete: my_first_property started
    1 test started, 1 complete: my_first_property complete
    �[92m---- Passed: my_first_property
    ----
    ---- 1 test ran.
    �[92m---- Passed: 1
    • ponycheck.md: --8<-- "ponycheck-usage.pony:2:12" → runnable
    • ponycheck.md: --8<-- "ponycheck-ponytest.pony"--8<--
      ponycheck-usage.pony:1:3
      ponycheck-usage.pony:14:19
      --8<--
      → runnable
  • ponytest-aggregation.pony → not runnable
  • ponytest-example.pony → runnable, prints
    1 test started, 0 complete: addition started
    2 tests started, 0 complete: subtraction started
    2 tests started, 1 complete: addition complete
    2 tests started, 2 complete: subtraction complete
    �[92m---- Passed: addition
    �[92m---- Passed: subtraction
    ----
    ---- 2 tests ran.
    �[92m---- Passed: 2

C-FFI

  • c-ffi-callbacks-bare-functions-pass-to-c-api.pony → not runnable
  • c-ffi-callbacks-bare-functions.pony → not runnable
  • c-ffi-callbacks-bare-lambda-callback.pony → not runnable
  • c-ffi-callbacks-bare-lambda-struct.pony → not runnable
  • c-ffi-callbacks-sqlite3-callback-2.pony → not runnable
  • c-ffi-callbacks-sqlite3-callback.pony → not runnable
  • c-abi-jump-consistent-hashing.pony → prints
    -2
    • c-abi.md: --8<-- "ac-abi-jump-consistent-hashing.pony:5:18" → runnable
  • c-abi-pony-use-native-jump-consistent-hashing-c-implementation.pony → not runnable, ⚠️ fails with
    undefined reference to 'jch_chash'
    Do we need the C script to make this one run? Can we do that?
  • calling-c-access-list-entry-with-explicit-return-type.pony → not runnable, ⚠️ fails with
    undefined reference to 'list_create'
  • calling-c-access-list-entry-without-return-type.pony → not runnable, ⚠️ fails with
    can't find declaration of 'point'
  • calling-c-addressof.pony → not runnable, fails with
    unexpected token var after use command
  • calling-c-default-method-in-primitive.pony → runnable, prints
    Hello from trait Foo
  • calling-c-default-method-in-trait.pony → runnable, fails with
    Can't call an FFI function in a default method or behavior
  • calling-c-different-types-of-lists.pony → not runnable, ⚠️ fails with
    undefined reference to 'list_create'
  • calling-c-ffi-functions-raising-errors.pony → not runnable, ⚠️ compilation silently fails
  • calling-c-file-path.pony → not runnable, 💡 use file_path.pony
  • calling-c-from-c-struct.pony → prints
    This rect is 2 cm x 3 cm
    • calling-c.md: --8<-- "calling-c-from-c-struct.pony:1:5"
  • calling-c-generic-list.pony → not runnable, ⚠️ fails with
    undefined reference to 'list_create'
  • calling-c-ioctl-struct.pony → prints
    0
    • calling-c.md: --8<-- "calling-c-ioctl-struct.pony"--8<--
      calling-c-ioctl-struct.pony:1:8
      calling-c-ioctl-struct.pony:11:15
      --8<--
      → runnable
  • calling-c-memcpy.pony → not runnable, ⚠️ fails with
    can't use an undefined variable in an expression
  • calling-c-pointer-to-opaque-c-type.pony → not runnable, ⚠️ fails with
    expected mandatory type declaration on field after x_dpy
  • calling-c-type-signature-compatibility.pony → not runnable, ⚠️ compilation silently fails
  • calling-c-variadic-c-functions.pony → prints
    Elapsed: 4,10500000000
    • calling-c.md: --8<-- "calling-c-variadic-c-functions.pony"--8<--
      calling-c-variadic-c-functions.pony:1:2
      calling-c-variadic-c-functions.pony:10:12
      --8<--
      → runnable
  • calling-c-writev-struct.pony → prints
    Hello from Pony!
    • calling-c.md: --8<-- "calling-c-writev-struct.pony"--8<--
      calling-c-writev-struct.pony:1:12
      calling-c-writev-struct.pony:15:19
      --8<--
      → runnable
  • calling-c-writev-tuple.pony → prints
    Hello from Pony!
    • calling-c.md: --8<-- "calling-c-writev-tuple.pony"--8<--
      calling-c-writev-tuple.pony:1:2
      calling-c-writev-tuple.pony:5:7
      --8<--
      → runnable
  • linking-c-use-lib-foo.pony → not runnable
  • linking-c-use-with-condition.pony → not runnable, fails with
    undefined reference to 'SSL_load_error_strings'

Gotchas

  • divide-by-zero-floats.pony → prints
    1.5÷0.5 = 3
    • divide-by-zero.md → --8<-- "divide-by-zero.pony:4:4"" → runnable
  • divide-by-zero-partial.pony → not runnable
  • divide-by-zero-unsafe.pony → ⚠️ silently fails
  • divide-by-zero.pony → prints
    1÷0 = 0
    • divide-by-zero.md → --8<-- "divide-by-zero.pony:3:3"" → runnable
  • garbage-collection.pony → not runnable
  • scheduling.pony → not runnable
  • function-call-side-effects.pony → runnable, prints
    42
  • recursion.pony → prints
    0
    0
    • recursion.md → --8<-- "recursion.pony:7:19"" → runnable

Appendices

  • appendices-annotations-empty-with-nosupertype-annotation.pony → prints
    None
    • annotations.md: --8<-- "appendices-annotations-empty-with-nosupertype-annotation.pony:1:7" → runnable
  • appendices-annotations-empty-without-nosupertype-annotation.pony → runnable, fails with
    this capture violates capabilities, because the match would need to differentiate by capability at runtime instead of matching on type alone
  • appendices-annotations-likely-and-unlikely-annotations.pony → prints
    res = foo
    • --8<-- "appendices-annotations-likely-and-unlikely-annotations.pony"--8<--
      appendices-annotations-likely-and-unlikely-annotations.pony:12:14
      appendices-annotations-likely-and-unlikely-annotations.pony:17:19
      appendices-annotations-likely-and-unlikely-annotations.pony:22:24
      appendices-annotations-likely-and-unlikely-annotations.pony:27:30
      --8<--
      → runnable
  • appendices-annotations-nodoc-annotation.pony → not runnable
  • appendices-annotations-packed-annotation.pony → prints
    {
    "x": 0,
    "y": 1
    }
    • annotations.md: --8<-- "appendices-annotations-packed-annotation.pony:1:3" → runnable
  • appendices-annotations-syntax.pony → not runnable
  • appendices-examples-access-command-line-arguments.pony → runnable, prints
    1
    ./main
    ./main
  • appendices-examples-create-arrays-with-values.pony → prints
    You rolled a six
    You rolled a three
    You rolled a four
    You rolled a five
    You rolled a two
    You rolled a one
    • examples.md: --8<-- "appendices-examples-create-arrays-with-values.pony:5:9" → runnable
  • appendices-examples-empty-class-functions.pony → not runnable
  • appendices-examples-enumeration-with-values-with-namespace.pony → prints
    black: #FF000000
    red: #FFFF0000
    • examples.md: --8<-- "appendices-examples-enumeration-with-values-with-namespace.pony:4:6" → runnable
  • appendices-examples-enumeration-with-values.pony → prints
    black: #FF000000
    red: #FFFF0000
    • examples.md: --8<-- "appendices-examples-enumeration-with-values.pony:4:5" → runnable
  • appendices-examples-iterable-enumerations.pony → not runnable
  • appendices-examples-modify-a-lexically-captured-variable-in-a-closure.pony → runnable, prints
    15
    35
  • appendices-examples-operator-overloading.pony → not runnable
  • appendices-examples-pass-array-of-values-to-ffi.pony → ⚠️ fails with
    syntax error: expected mandatory type declaration on field after a
  • appendices-examples-test-helper.pony → not runnable
  • appendices-examples-use-cli-package-to-parse-command-line-arguments.pony → fails with
    Error: missing value for required option at: 'output'
    (desired?)
  • appendices-examples-write-tests.pony → runnable, prints
    1 test started, 0 complete: u32/add started
    1 test started, 1 complete: u32/add complete
    �[92m---- Passed: u32/add
    ----
    ---- 1 test ran.
    �[92m---- Passed: 1
  • appendices-platform-dependent-code.pony → not runnable
  • appendices-serialization-compare-original-object-with-deserialized-object.pony → runnable, prints
    serialised representation is 60 bytes long
    (foo1 == foo2) is true
  • appendices-serialization-custom-serialization.pony → ⚠️ Do we need the C script to make this one run? Can we do that?
  • appendices-whitespace-comments.pony → not runnable
  • appendices-whitespace-do-a-then-do-a-unary-negation-of-b.pony → prints
    1
    • whitespace.md: --8<-- "appendices-whitespace-do-a-then-do-a-unary-negation-of-b.pony:14:15" → runnable
  • appendices-whitespace-docstrings.pony → not runnable
  • appendices-whitespace-subtract-b-from-a.pony → prints
    -2
    • whitespace.md: --8<-- "appendices-whitespace-subtract-b-from-a.pony:14:14" → runnable
  • error-messages-left-side-is-immutable.pony → runnable, fails with
    left side is immutable
  • error-messages-left-side-must-be-something-that-can-be-assigned-to.pony → runnable, fails with
    can't assign to a let or embed definition more than once
  • error-messages-receiver-type-is-not-a-subtype-of-target-type.pony → runnable, fails with
    receiver type is not a subtype of target type

shaedrich and others added 28 commits April 21, 2024 05:35
to mark array entry as object rather than a string
Co-authored-by: jemc <joe.eli.mac@gmail.com>

As requested in #544 (comment)
Copy link

netlify bot commented May 20, 2024

Deploy Preview for pony-tutorial ready!

Name Link
🔨 Latest commit f3c5552
🔍 Latest deploy log https://app.netlify.com/sites/pony-tutorial/deploys/665f5b08f477050008365761
😎 Deploy Preview https://deploy-preview-545--pony-tutorial.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label May 20, 2024
@shaedrich
Copy link
Collaborator Author

shaedrich commented May 27, 2024

Guide on how to read the PR description and what we might want to do with it

  • ⚠️ items are snippets that either need to be fixed or a working implementation needs to be discussed
  • "not runnable" is assigned to the best of my knowledge, but your opinion on this might differ. If you don't mind the number of "not runnable" snippets, that's fine with me
  • Some snippets are turned into multi-line snippets using the block format—while this is not inherently bad, some examples might be over-complicated
  • "fails with" can be intended, excepted when it isn't
  • strikethrough top-level items with a (see xyz.pony) comment are merged with other snippets, because both parts are needed to be runnable, and therefore should be fine

@shaedrich shaedrich marked this pull request as ready for review May 29, 2024 08:34
@shaedrich
Copy link
Collaborator Author

fyi: The deploy preview only fails due to flaky connectivity.

@SeanTAllen
Copy link
Member

Error from the last build log:

12:41:17 PM: ERROR - Error reading page 'c-ffi/calling-c.md': Snippet at path 'https://raw.githubusercontent.com/ponylang/ponyc/main/packages/builtin/float.pony' could not be found

@SeanTAllen
Copy link
Member

This is an impressive amount of work. Thank you @shaedrich.

docs/c-ffi/calling-c.md Outdated Show resolved Hide resolved
@SeanTAllen SeanTAllen removed the discuss during sync Should be discussed during an upcoming sync label Jun 4, 2024
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Jun 4, 2024
@shaedrich
Copy link
Collaborator Author

shaedrich commented Jun 5, 2024

This is an impressive amount of work. Thank you @shaedrich.

@SeanTAllen Thanks a lot 😊

Error from the last build log:

12:41:17 PM: ERROR - Error reading page 'c-ffi/calling-c.md': Snippet at path 'https://raw.githubusercontent.com/ponylang/ponyc/main/packages/builtin/float.pony' could not be found

@SeanTAllen This is fixed by the revert requested by @jemc

@jemc
Copy link
Member

jemc commented Jun 11, 2024

Is this PR meant to be in a ready for review/merge state?

I ask because it's not marked as a draft, but there are unchecked checkboxes in the PR description.

It isn't clear to me whether we should be giving this a final review yet.

@shaedrich
Copy link
Collaborator Author

shaedrich commented Jun 11, 2024

@jemc Please read the PR description as well as my previous comments. If none of them require any action in your opinion, the PR is indeed ready to be merged. The unchecked checkboxes mean, these code snippets are not runnable and might not have been changed in this PR, but this doesn't necessarily need to be a problem.

Copy link
Member

@jemc jemc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I would not have advocated doing some of the extra work that has been done here to make most of the examples print something specific to have its output tested, as I think that is the scope of language tests in the ponyc repo rather than tutorial content checks.

However, as long as future our tutorial CI system has a mechanism for merely testing that an example compiles (and not all examples must be runnable with specific output), then I don't think this approach brings extra maintenance cost for the work that is already done.

Any other thoughts from @SeanTAllen or others?

@shaedrich
Copy link
Collaborator Author

Well, what use is it to have an example being run by the playground and it just doesn't fail? When I use the playground, I want it to output something. Otherwise the tutorial can simply talk about code and I have to accept that it does what the text says.

@jemc
Copy link
Member

jemc commented Jun 11, 2024

I think what you've done here does add value to the kind of user who wants to click through on these code samples and run them in the playground. I don't think that will be a high volume of users, but I agree your work here adds value for them (which is why I marked it as approved).

However, I don't want to create new requirements for tutorial content that raise the bar for what needs to be created there. That's why I want to ensure that the future mechanism which tests these samples can run at least some samples in a mode where we're only verifying that they compile (which should be part of the minimum bar for tutorial content contribution - that the code samples compile if expected to compile, or fail with specified errors if they are expected to fail to compile).

In short, we have to balance the needs of both the tutorial reader and the tutorial contributor. The more friction we add to the tutorial contribution process, the harder it becomes to get volunteers to do the work.

@shaedrich
Copy link
Collaborator Author

shaedrich commented Jun 11, 2024

fail with specified errors

This one is a bit puzzling to me. So, in essence, you want failure to be more defined than success? That doesn't make sense to me. You don't want to test beyond compilation, okay, but why bother with error codes/messages? Why not just make a *.txt file with one exception per line that isn't tested and be done with it? Low maintenance, exactly what you want.

@jemc
Copy link
Member

jemc commented Jun 11, 2024

I'm trying to engage in a good faith exchange of opinions and arguments/reasoning here, but it becomes hard to justify continuing that engagement when comments like this appear to be strawmanning me with an apparent petulant tone.

Why not just make a *.txt file with one exception per line that isn't tested and be done with it? Low maintenance, exactly what you want.

We've talked at length in this PR and elsewhere about "what I want" and that isn't it.

So, no.

@shaedrich
Copy link
Collaborator Author

shaedrich commented Jun 12, 2024

I'm trying to engage in a good faith exchange of opinions and arguments/reasoning here, but it becomes hard to justify continuing that engagement when comments like this appear to be strawmanning me with an apparent petulant tone.

It's right when they say, the internet doesn't do a good point of getting one's point across in terms of the message's notions. If you indeed read my message in good faith, there is nothing that would objectively hint at a petulant tone.

What I'm trying to do is merely to understand your position, which I'm struggling to do, as I tried to convey in my last message. If you're willing to make this clear, I'm interested in your explanation. If you don't want to and still take this personally, there's not much I can do.

In more than one comment, I explicitly stated that I hope, I'm not speaking out of line by just stating my different opinion on the matter at hand because I thought, this perspective would be beneficial for the project.

I just listened to your sync recording, and I think, I understand one of your concerns better, concerning using stderr to determine if the code snippet run failed accordingly. Yeah, error messages could change, so something else should be used. Meaning, the problem is not with wanting to determine the reason of the run failing but the way of achieving that. However, this is complicated in itself, but might become easier if ponylang/rfcs#76 got implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss during sync Should be discussed during an upcoming sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants