[swift-evolution] Code Contracts

Developer devteam.codafi at gmail.com
Thu Jan 14 22:42:29 CST 2016


Mhm, -1 for this reason.  If there were richer preconditions (say, a refinement typing scheme) here rather than C0-style contracts it'd be worth the extra syntax.

~Robert Widmann

2016/01/14 23:36、Javier Soto via swift-evolution <swift-evolution at swift.org> のメッセージ:

> Is this something that in your opinion is worth extra, special syntax? Those examples could be implement easily like:
> 
> didSet {
> precondition(score <= 100)
> }
> 
> 
>> On Thu, Jan 14, 2016 at 8:32 PM Suminda Dharmasena <sirinath1978m at gmail.com> wrote:
>> E.g. 
>> 
>> var @where("myVariable <= 100 && myVariable >= 0") myVariable = 42
>> 
>> 
>> @where("myVariable <= 80 && myVariable >= 50")
>> {
>>     ...
>> }
>> 
>> 
>> @where("score <= 100 && score >= 0")
>> for score in individualScores {
>>     ...
>> }
> 
> -- 
> Javier Soto 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160114/dade407d/attachment.html>


More information about the swift-evolution mailing list