[ 
http://dev.sourcefabric.org/browse/LS-123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15658#action_15658
 ] 

David Baelde commented on LS-123:
---------------------------------

This goes hand in hand with another warning that we don't issue very precisely: 
only unit and outputs should be ignored.

For example the other day I wrote the one-line 'input.harbor(%mp3)' and 
liquidsoap didn't complain, just said that no output was defined. Stupidly I 
thought the harbor input was (incorrectly) not active, but in fact I had just 
forgotten the mount parameter, so the application was partial. If this confused 
me, it really needs a warning.

The first problem here is that the ignored expression is not in a sequence so 
the warning is not issued. The second problem with that warning is that we 
don't know statically if a source is active or not, and therefore if it makes 
sense to ignore it. One solution I considered is to change all outputs to 
(...)->unit instead of (...)->source, but this would make it impossible to pass 
an output to functions such as source.id() or source.shutdown(). An obvious 
solutions (too simple to be true, there must be something wrong with it) is to 
add a subtype of source for outputs, or for active sources in general. We can 
perfectly inform the type system about that, it doesn't depend on parameters or 
anything as far as I can see.

I think that a subtype for outputs makes more sense: even if it makes sense to 
ignore an active input (or something like a strip_blank) it's generally weird. 
Then our warning could be issued when something else than unit and outputs is 
ignored, and if the subtyping/inference algorithm is not too stupid the same 
code as before could be written. (We could even consider outputs as a subtype 
of unit, making the warning more uniform but probably more obscure to most 
people.)

> Unused variables
> ----------------
>
>                 Key: LS-123
>                 URL: http://dev.sourcefabric.org/browse/LS-123
>             Project: Liquidsoap
>          Issue Type: New Feature
>          Components: Liquidsoap
>            Reporter: David Baelde
>            Assignee: David Baelde
>
> Add a warning for unused variables. This would be useful for users who don't 
> understand the let-in style of definitions. One problem is that the warning 
> would be issued a lot for utils.liq.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://dev.sourcefabric.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Savonet-devl mailing list
Savonet-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-devl

Répondre à