MetaLinks for Dynamic Contracts

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

MetaLinks for Dynamic Contracts

Evan Donahue
Hello,

I am returning to some work in Pharo after about ~2.5 years and reminding myself of what I was working on before I got sidetracked. It appears

I had mostly finished for release a dynamic contracts library for run time type checking based on Racket's contract library.[1] However, it relied on some hackery to interact well with the TestCoverage class, since both the contract and the TestCoverage wanted to replace the method during the run of a test. However, since it seems in Pharo 8 the TestCoverage class is no longer present, this seems like a good time to re-evaluate the project before I go in to see what needs to be patched up. I therefore have three questions:

1) Are there now any existing libraries for dynamic contracts that I should use instead of patching my old library?

2) Is MetaLinks the preferred way to intercept messages, and if so can someone point me to the repo (I can't seem to find it on Github)?

3) If 2, does MetaLinks play well with whatever is the current TestCoverage alternative that I assume still does some form of message interception, e.g. will the test coverage function still work properly on a MetaLink'ed message, or will that require further hackery (I discovered MetaLinks after the first version, so I used the more basic message replacement apis)?

Thank you,
Evan


Reply | Threaded
Open this post in threaded view
|

Re: MetaLinks for Dynamic Contracts

Sven Van Caekenberghe-2
He Evan,

Can't answer your questions, but the contracts concepts sounds interesting !

Sven

> On 3 May 2020, at 23:18, Evan Donahue <[hidden email]> wrote:
>
> Hello,
>
> I am returning to some work in Pharo after about ~2.5 years and reminding myself of what I was working on before I got sidetracked. It appears
>
> I had mostly finished for release a dynamic contracts library for run time type checking based on Racket's contract library.[1] However, it relied on some hackery to interact well with the TestCoverage class, since both the contract and the TestCoverage wanted to replace the method during the run of a test. However, since it seems in Pharo 8 the TestCoverage class is no longer present, this seems like a good time to re-evaluate the project before I go in to see what needs to be patched up. I therefore have three questions:
>
> 1) Are there now any existing libraries for dynamic contracts that I should use instead of patching my old library?
>
> 2) Is MetaLinks the preferred way to intercept messages, and if so can someone point me to the repo (I can't seem to find it on Github)?
>
> 3) If 2, does MetaLinks play well with whatever is the current TestCoverage alternative that I assume still does some form of message interception, e.g. will the test coverage function still work properly on a MetaLink'ed message, or will that require further hackery (I discovered MetaLinks after the first version, so I used the more basic message replacement apis)?
>
> Thank you,
> Evan
>
>
> [1] https://docs.racket-lang.org/reference/contracts.html


Reply | Threaded
Open this post in threaded view
|

Re: MetaLinks for Dynamic Contracts

Ben Coman
In reply to this post by Evan Donahue


On Mon, 4 May 2020 at 05:19, Evan Donahue <[hidden email]> wrote:
Hello,

I am returning to some work in Pharo after about ~2.5 years and reminding myself of what I was working on before I got sidetracked. It appears

I had mostly finished for release a dynamic contracts library for run time type checking based on Racket's contract library.[1] However, it relied on some hackery to interact well with the TestCoverage class, since both the contract and the TestCoverage wanted to replace the method during the run of a test. However, since it seems in Pharo 8 the TestCoverage class is no longer present, this seems like a good time to re-evaluate the project before I go in to see what needs to be patched up. I therefore have three questions:

1) Are there now any existing libraries for dynamic contracts that I should use instead of patching my old library?

2) Is MetaLinks the preferred way to intercept messages,

 
and if so can someone point me to the repo (I can't seem to find it on Github)?

There is no repo for MetaLinks.  It comes batteries installed. (i.e. its in the image)

cheers -ben  
Reply | Threaded
Open this post in threaded view
|

Re: MetaLinks for Dynamic Contracts

Marcus Denker-4
In reply to this post by Evan Donahue


> On 3 May 2020, at 23:18, Evan Donahue <[hidden email]> wrote:
>
> Hello,
>
> I am returning to some work in Pharo after about ~2.5 years and reminding myself of what I was working on before I got sidetracked. It appears
>
> I had mostly finished for release a dynamic contracts library for run time type checking based on Racket's contract library.[1] However, it relied on some hackery to interact well with the TestCoverage class, since both the contract and the TestCoverage wanted to replace the method during the run of a test. However, since it seems in Pharo 8 the TestCoverage class is no longer present, this seems like a good time to re-evaluate the project before I go in to see what needs to be patched up. I therefore have three questions:
>
> 1) Are there now any existing libraries for dynamic contracts that I should use instead of patching my old library?
>
> 2) Is MetaLinks the preferred way to intercept messages, and if so can someone point me to the repo (I can't seem to find it on Github)?
>

The MetaLinks are in the release, no need to load anything.

> 3) If 2, does MetaLinks play well with whatever is the current TestCoverage alternative that I assume still does some form of message interception, e.g. will the test coverage function still work properly on a MetaLink'ed message, or will that require further hackery (I discovered MetaLinks after the first version, so I used the more basic message replacement apis)?
>

The test Coverage was re-implemented with MataLink, see the method #collectCoverageFor: in TestRunner.

This means that it should compose nicely with any other #before or #after MetaLink, without any need to take special care.


        Marcus