Changes between Initial Version and Version 1 of SemanticQuery/SpecParamEntity


Ignore:
Timestamp:
Feb 27, 2015, 1:57:30 PM (10 years ago)
Author:
manualwiki
Comment:

sq spec-param entity added

Legend:

Unmodified
Added
Removed
Modified
  • SemanticQuery/SpecParamEntity

    v1 v1  
     1= Spec-param entity = 
     2 
     3Spec-param entities correspond to parameters of a ''-spec'' attribute. Typically these only contain type expressions related to the expected types of parameters in the referenced function's applications, however names can also be specified for parameters in a ''-spec'' attribute. Please note that "-spec" definitions can have multiple clauses, and the index property refers to the parameter's index in the containing clause, so there will be multiple spec-param entities with the same index for any such spec-entity.  
     4 
     5== Selectors == 
     6 
     7''The type of the result elements are indicated in parenthesis.'' 
     8 
     9* {{{type}}} (''type''): The type expression of the spec-parameter. 
     10 
     11== Properties == 
     12 
     13The following properties are defined for spec-param entities: 
     14 
     15* {{{name}}} (''atom''): Name of the spec-parameter. 
     16* {{{index}}} (''int''): Index of the spec-parameter in the corresponding clause. 
     17* {{{text}}} (''string''): String representation of the spec-parameter. 
     18 
     19== Textual output format == 
     20 
     21When using any of our interfaces, other than [ScriptableInterface ris], this entity will be represented in the output as a string with the same format as it was described in the ''-spec'' form. (Including whitespaces.) 
     22 
     23{{{ 
     24ri:q("mods.spec.params"). 
     25-spec io:format(Format :: string(), list()) -> string(). 
     26    Format :: string() 
     27     list() 
     28}}} 
     29 
     30== Review of non-trivial selectors == 
     31For some of the selectors it may not be initially clear how and what would they return. A description of these can be found here:  
     32 
     33=== Specparam.type: === 
     34Returns the type or type expression of the given specparam. (Single-atom type expressions are filtered.) 
     35{{{ 
     36ri:q("mods.spec").            
     37a.erl 
     38    -spec io_lib:format(Format :: io:format(), list(term())) -> [char]. 
     39... 
     40ok 
     41ri:q("mods.spec.param.type"). 
     42Format :: io:format() 
     43    Format :: io:format() 
     44 list(term()) 
     45    erlang:list/1 
     46... 
     47}}} 
     48 
     49=== Specparam.name: === 
     50Returns the name of the specparam as a string. If the name was omitted, returns "undefined". 
     51{{{ 
     52ri:q("mods.spec").            
     53a.erl 
     54    -spec io_lib:format(Format :: io:format(), list(term())) -> [char]. 
     55... 
     56ok 
     57ri:q("mods.spec.param.name"). 
     58Format :: io:format() 
     59    name = "Format" 
     60 list(term()) 
     61    name = "undefined" 
     62... 
     63}}}