Skip to content

Instantly share code, notes, and snippets.

@dhh1128
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhh1128/2ca442f3e7f28705ef28 to your computer and use it in GitHub Desktop.
Save dhh1128/2ca442f3e7f28705ef28 to your computer and use it in GitHub Desktop.
python-like pseudocode for marks that implement
# 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