[Vm-dev] Pony for Pharo VM (typo fix)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Vm-dev] Pony for Pharo VM (typo fix)

Shaping1

Hi Ken.

 

Not to discourage people, but I have not seen cases where a "strong"

type system would be able to scale for _real_ Smalltalk applications.

 

You’re right.  It doesn't.  I'm not suggesting that.

 

The type safety is not for app-level Smalltalk development.  It's for building the VM only.

 

I want to use the Pony concurrency model at the Smalltalk level.  That’s the gist of it.  Otherwise, I want a Smalltalk, not a statically compiled language.

 

Six ref-caps explicitly represent Pony’s concurrency model in code.  They are essentially type qualifiers related specifically to concurrency.  The plan is to reduce, if possible, the number of ref-caps the programmer must explicitly use/place in the code when coding a state-machine in Smalltalk, without producing a toy or straightjacket (without making it too simple or too rigid).  This may require implementing the VM more as a change to (fork of) Pony instead of using Pony to implement the VM.  I’m not sure yet.    

 

The six ref-cap ideas for sharing data reliably between actors are not hard to grasp, but they take some getting used to, and involve some mental load.  I don't want that much (concurrency-related or any other) implementation detail in the domain layer, much in the same vein as:  I don’t use Forth because I don’t want to see stack acrobatics (ROTs and DUPs, etc.) amidst domain-level state-changes (FirePhotonTorpedo).  It’s distracting.  It dilutes focus on the domain work/layer, and tends to cause mistakes there.

 

The programmer’s domain logic and the concurrency-integrity provided by the ref-caps are different layers of thought and structure.  The ref-caps are, however, mixed freely with domain logic in current Pony code.  I think that’s a mistake.  But that’s how it is now.  I think of this layer mixing as an intermediate design stage of Pony.  I want to abstract-out some or all ref-caps as the VM is built. 

 

Pony language is not the remarkable thing here. I see it as a better C or better Rust.  It’s very good (as Algol-60-ish-looking crap-syntaxes go), but that’s not what this is about.  It’s about the actor programming, the concurrency model, and the guarantees given by use of the ref-caps.  We would still obviously need to respect the Pony compiler’s determination of where ref-cap use is correct or not.  Your Pony program won’t compile if you don’t use the ref-caps correctly, and you don’t get the guarantees or a running program without the compile.  Much easier, therefore, might be to go the other way by changing Pony to support dynamic types without violating the invariants that allow the ref-caps (under the hood, abstracted out) to make the concurrency guarantees.  Work Smalltalk dynamism into Pony, instead of building a Smalltalk VM with Pony. 

 

 

Shaping

 

 

"Rational numbers"

(1/2) + (1/3) + (1/6). "--> 1 "

 

"Complex numbers"

[ :n | n * n] value: (-4 sqrt). "--> -4 "

 

"BigNums"

111 factorial. " -->

1762952551090244663872161047107075788761409536026565516041574063347346955087248316436555574598462315773196047662837978913145847497199871623320096254145331200000000000000000000000000

"

 

Just this is hugely complex to model in a "type safe" language.

 

Add metaprogramming (e.g. #doesNotUnderstand:), source level debugging of live stacks and GC of large object spaces and you have a very large

(space) and very slow (interlocking cache granularity) interpreter.

 

Please prove me wrong.

 

$0.02,

-KenD

 

Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] Pony for Pharo VM

Ben Coman
Hi Shaping,

Just to get in the right frame of mind, consider that because of the Blub Paradox (http://www.paulgraham.com/avg.html)
you are going to have a hard time convincing people to "change to this language because of Feature X"
just by saying so.  You need to dig deeper.  

Now I I took a quick look to see what I could learn about Pony
and the main interesting thing is its "Reference Capabilities".
Indeed, it seems Pony's purpose is the POC for that research.
I watched two videos...

[1] Øredev 2017 - Joe McIlvain - Pony - A Language for Provably Safe Lockless Concurrency
https://www.youtube.com/watch?v=9NH4bVfbvYI  

[2] Sophia Drossopoulou - Pony for Safe, Fast, concurrent programs - Codemesh 2017
https://www.youtube.com/watch?v=e_bES30tFqI  

So my "quick" assessment is to consider Reference Capabilities not a Type System
but a Meta-type System.  [2] says "They are not a property of an object, but define how I can look at an object."  To summarize the videos...

[1]@29:15...
image.png
image.png

[2]@13:40...
image.png

[2]@24:40...
image.png
 
[2]@28:30...
image.png




So you say...
> I want to use the Pony concurrency model at the Smalltalk level.  That’s the gist of it. 
> Otherwise, I want a Smalltalk, not a statically compiled language.

I believe you have the wrong end of the the stick promoting that the VM 
needs to be redeveloped using Pony to get the Reference Capabilities
at the Smalltalk level.  After you Ahead-Of-Time compile the VM, the compiler
is left behind.  The features of the compiler don't automatically flow through
to Smalltalk level. 

A third option could be to extend to the existing "Immutability capability" of the VM.  
The six Reference Capabilities might be stored in the Spur Object Header 
using a re-purposed Immutability bit plus the two free "green" bits.

"Reference Capabilities for Dynamic Languages" could be a strong PhD project.  

cheers -ben




On Fri, 10 Apr 2020 at 17:56, Shaping <[hidden email]> wrote:

>
> Hi Ken.
>
> Not to discourage people, but I have not seen cases where a "strong
> type system would be able to scale for _real_ Smalltalk applications.
>
> You’re right.  It doesn't.  I'm not suggesting that.
>
> The type safety is not for app-level Smalltalk development.  It's for building the VM only.
>
> The six ref-cap ideas for sharing data reliably between actors are not hard to grasp, but they take some getting used to, and involve some mental load.  I don't want that much (concurrency-related or any other) implementation detail in the domain layer, much in the same vein as:  I don’t use Forth because I don’t want to see stack acrobatics (ROTs and DUPs, etc.) amidst domain-level state-changes (FirePhotonTorpedo).  It’s distracting.  It dilutes focus on the domain work/layer, and tends to cause mistakes there.
>
>  
>
> The programmer’s domain logic and the concurrency-integrity provided by the ref-caps are different layers of thought and structure.  The ref-caps are, however, mixed freely with domain logic in current Pony code.  I think that’s a mistake.  But that’s how it is now.  I think of this layer mixing as an intermediate design stage of Pony.  I want to abstract-out some or all ref-caps as the VM is built.
>
> Pony language is not the remarkable thing here. I see it as a better C or better Rust.  It’s very good (as Algol-60-ish-looking crap-syntaxes go), but that’s not what this is about.  It’s about the actor programming, the concurrency model, and the guarantees given by use of the ref-caps.  We would still obviously need to respect the Pony compiler’s determination of where ref-cap use is correct or not.  Your Pony program won’t compile if you don’t use the ref-caps correctly, and you don’t get the guarantees or a running program without the compile.  Much easier, therefore, might be to go the other way by changing Pony to support dynamic types without violating the invariants that allow the ref-caps (under the hood, abstracted out) to make the concurrency guarantees.  Work Smalltalk dynamism into Pony, instead of building a Smalltalk VM with Pony.