<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16688</bug_id>
          
          <creation_ts>2012-04-10 16:40:11 +0000</creation_ts>
          <short_desc>Consider rewriting algorithms as full algorithms so variables don&apos;t appear as if they&apos;re globals</short_desc>
          <delta_ts>2014-03-27 16:49:43 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>Encoding</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 3.1</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          <blocked>23155</blocked>
    
    <blocked>23927</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Anne">annevk</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>jsbell</cc>
    
    <cc>mike</cc>
    
    <cc>pub-w3</cc>
    
    <cc>simon.sapin</cc>
          
          <qa_contact>sideshowbarker+encodingspec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66574</commentid>
    <comment_count>0</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-04-10 16:40:11 +0000</bug_when>
    <thetext>Global variables such as &quot;iso-2022-kr state&quot; seem to have unnecessarily long names (shortening, e.g, &quot;euc-kr lead&quot; to &quot;lead&quot; would make it confusingly similar to the local variable &quot;lead&quot;, but that can be fixed differently).  The use of the definite article with global variables is not consistent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81332</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-01-14 11:26:08 +0000</bug_when>
    <thetext>Do you have specifics on incorrect usage of the definite article? That seems like something that should be fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81351</commentid>
    <comment_count>2</comment_count>
    <who name="">pub-w3</who>
    <bug_when>2013-01-14 19:42:16 +0000</bug_when>
    <thetext>A clear example of inconsistent (not necessarily incorrect) article usage is ‘set iso-2022-kr state to’ alongside ‘[s]et the iso-2022-kr state to’.

More generally, it is not entirely clear why global variables tend to be used with a definite article in phrases like ‘the zxc is initially...’ but not elsewhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81386</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-01-15 10:28:35 +0000</bug_when>
    <thetext>So what I think I should actually do is make the encoder/decoder algorithms self-contained and inline the &quot;global variables&quot;.

In addition I need to design some kind of stream object concept and an operation that can inject units into that stream object (for the error conditions).

Need to think about this some more.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92758</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-08-30 18:28:56 +0000</bug_when>
    <thetext>A stream consists of unit sequence ended with EOF. 

A stream&apos;s next operation either returns the next unit, EOF, or PENDING if neither unit nor EOF available.

TODO: Add a concept of &quot;buffer&quot; or a prepend operation.

Need to think about output of encoder/decoder operation. Want to have either all units until PENDING (API), all units including EOF (sequence), or next unit (parsers).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92987</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-09-04 16:21:59 +0000</bug_when>
    <thetext>Alternative plan for inlining the variables. We do something like:

The utf-8 decoder is utf-8&apos;s encoder. The utf-8 encoder is utf8&apos;s decoder. The utf-8 decoder and utf-8 encoder have an associated utf-8 code point, utf-8 bytes seen, ...

The utf-8 decoder&apos;s inner loop is: &lt;current algorithm&gt;


So basically we turn it into a clearer class system and then we can also define in a more clear way how the inner loop is invoked and when variables associated with the encoder/decoder are reset.

Combined with the abstract stream concept above does that make sense?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92988</commentid>
    <comment_count>6</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2013-09-04 16:26:59 +0000</bug_when>
    <thetext>SGTM</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102937</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-03-26 18:35:33 +0000</bug_when>
    <thetext>https://github.com/whatwg/encoding/commit/dc8e4c10c9b4a91f188f3145c2e31ddec4d52a78

This is a massive change. Review appreciated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102944</commentid>
    <comment_count>8</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2014-03-26 19:33:02 +0000</bug_when>
    <thetext>The new TextEncoder/TextDecoder &quot;serialized stream&quot; algorithms appear to be unreferenced. They need to be integrated into the encode()/decode() method descriptions.

(Also, there&apos;s a harmless typo in the source nearby: &lt;/codE&gt;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102945</commentid>
    <comment_count>9</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2014-03-26 19:34:03 +0000</bug_when>
    <thetext>(In reply to Joshua Bell from comment #8)
&gt; The new TextEncoder/TextDecoder &quot;serialized stream&quot; algorithms appear to be

^^ &quot;serialize stream&quot;

&gt; unreferenced. They need to be integrated into the encode()/decode() method
&gt; descriptions.
&gt; 
&gt; (Also, there&apos;s a harmless typo in the source nearby: &lt;/codE&gt;)

^^ Not harmless, mucks up the formatting on the TextEncoder&apos;s description.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102997</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-03-27 12:25:49 +0000</bug_when>
    <thetext>I fixed the typo. The algorithm is cross-referenced. If you go to http://encoding.spec.whatwg.org/#concept-td-serialize and click the bold term you will find where it is referenced from. I do not always reuse the exact term as it does not always make sense in context.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103028</commentid>
    <comment_count>11</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2014-03-27 16:49:43 +0000</bug_when>
    <thetext>(In reply to Anne from comment #10)
&gt; I fixed the typo. The algorithm is cross-referenced. If you go to
&gt; http://encoding.spec.whatwg.org/#concept-td-serialize and click the bold
&gt; term you will find where it is referenced from. I do not always reuse the
&gt; exact term as it does not always make sense in context.

Got it. 

That looks good to me. I haven&apos;t noticed any other glitches apart from the BOM handling ones mentioned in the other bug. Nice job on the refactor!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>