Last active
August 29, 2015 14:04
-
-
Save dhh1128/2ca442f3e7f28705ef28 to your computer and use it in GitHub Desktop.
python-like pseudocode for marks that implement
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
# Implementation of a mark that precludes gpl license | |
class no_gpl: mark | |
propagation = propagation_types.called_code or propagation_types.contained_code | |
# Override mark.can_bind(). Return reason why binding is | |
# impossible, or None on success. | |
def can_bind(site, attachment): | |
if attachment == mark_types.explicit_affirmative: | |
if site.type.scope >= scope_types.code_block: | |
if site.get_call_tree().is_marked('gpl', mark_types.explicit_affirmative): | |
return "Is not compatible with GPL'ed code: %s" % site.get_url() | |
return "Can only bind to code blocks or broader constructs." | |
# Implementation of the mark for a gpl license | |
class gpl: mark | |
propagation = propagation_types.contained_code | |
def can_bind(site): | |
if attachment == mark_types.explicit_affirmative: | |
if site.type.scope < scope_types.code_block: | |
return "Can only bind to code blocks or broader constructs." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment