Hacker Newsnew | past | comments | ask | show | jobs | submit | more phpnode's commentslogin

html5 iframe allows this [0], but i think it'll be difficult to shim in browsers that don't support it.

[0] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/if...


Thanks. I had a vague memory that there was something that did it, but couldn't remember what.


it's annoying that it can't be used more than once per page. It would be useful to also have a <content> element, e.g.

    <article>
        <header>...</header>
        <content>...</content>
        <footer>...</footer>
    </article>



W3C states explicitly that it can't so this is yet another instance where whatwg and w3c disagree leaving developers wondering what to do. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ma...


Maybe using section there would be acceptable, it's the closest thing I can think of at least.


I found your post interesting (just like all your other posts), but for me where this one falls short is the lack of real life examples. I mean I understand why this would be good for calculating factorials and other kinds of recursive math, but how often does the average javascript programmer need to do that anyway? How can I benefit from this to write better code in practise, and not just in theory? To me this is far less obvious than with, for example, your article on decorator functions [0].

[0] http://raganwald.com/2013/01/03/function_and_method_decorato...


Trampolining is one way to implement "tail call optimisation". This basically means that when the last instruction (the "tail") of a function is a call to another function (possibly the same one, recursively), then we can perform an optimisation: rather than "going down" into the function (adding a new stack frame) we can run it where we already are (in our current stack frame). This optimisation is possible because we know that we don't need our current stack frame anymore, since this is the last instruction.

Ever find yourself writing a "main loop" full of unrelated code which only appears in the same place because you're forced to keep it all between the loop's braces? That's a prime candidate for mutual recursion, made safe using tail-call optimisation:

  var foo = function() {
    //
  };
  var bar = function() {
    //
  };
  var baz = function() {
    //
  };
  var main = function() {
    while (true) {
      foo();
      bar();
      baz();
    }
  };
  main();
Can be replaced with:

  var foo = function() {
    //
    bar();
  };

  var bar = function() {
    //
    baz();
  };

  var baz = function() {
    //
    foo();
  };
  foo();
This is how I tend to write Javascript; although I generally handle tail-call optimisation by using setTimeout(foo, 0), which has the same effect.


Not the same effect. setTimeout() will execute the callback after the main event loop has completed, potentially allowing the browser to reflow the page, etc. Doing that will slow things down considerably with lots of callbacks.


You handle TCO by making it asynchronous? WTF.


and in fact that particular bustle link you posted is a perfect example of where using HTML5 + microdata would be not only faster to render and crawlable but also allow the underlying data structure to be consumed by javascript. There's no reason why

    Bustle.pageData.article.title
couldn't have been extracted from

    <article itemscope itemtype="/article">
        <h1 itemprop="title">Why We Should Root for Lamar Odom</h1>
        ...
    </article>


It's a real bitch to implement when your use case is complicated and nested. From experience, I have no idea how to mark up a document "correctly" because of like recursive definitions of some microdata. Like flingy can contain thingy. A thingy can contain flingy.

Should I mark my concrete item as flingy where some elements are thingies or should that be a thingy with some subelements as flingies?

I just did my best and called it a day. Then spend a lot of time debugging it in the microdata analyzer tool.


you can mark sub-scopes with their own itemscope property, so you could have this:

    <article itemscope itemtype="/article">
        <h1 itemprop="title">My Title</h1>

        <div class="related-thing" itemscope itemtype="/author" itemprop="author">
            <h1>
                <span itemprop="firstName">John</span>
                <span itemprop="lastName">Smith</span>
            </h1>
        </div>
        
        <aside class="incidental-unrelated-thing" itemscope itemtype="/sausage">
            <span itemprop="type">Cumberland</span>
            <span itemprop="ingredients">Mystery Meat</span>
        </aside>
    </article>

in the example above, we define an article that has a related author property, that author property is its own scope so has firstName and lastName properties of its own. We also define an unrelated itemscope (unrelated because it has no itemprop) that happens to be nested in the same element, so this would parse to:

    [
        {
           "type": "/article",
           "properties": {
               "title": ["My Title"],
               "author": [{
                   "type": "/author",
                   "properties": {
                       "firstName": ["John"],
                       "lastName": ["Smith"]

                   }
               }]
 
           }
        },
        {
            "type": "/sausage",
            "properties": {
                "type": ["Cumberland"],
                "ingredients": ["Mystery Meat"]
            }
        }
    ]


FAO: iamgopal - your account has been dead for over a year for no discernible reason, only people with showdead on can see your posts.


a lot of different standards cover it, this is the one the UK's HMRC require submissions in - http://en.wikipedia.org/wiki/XBRL


if they do business in the UK (which they do), they are subject to UK laws. Quite simple, no?


Can an UK citizen sue an US citizen if the latter broke former's window? Not sure, but guess they can.

If that's true, then UK citizens should be able to use US company (Google). I'm afraid the rulings may be somehow problematic to enforce, though.

But I suspect all things change because there's Google UK Ltd.


I don't understand what you're getting at. If a US citizen broke my window (i live in the UK), i'd report it to the police and the criminal would be subject to UK law at all times while here (unless he has diplomatic immunity or something). What does that have to do anything with your 2nd point? Do you mean "sue", or do you really mean "use" like you wrote? If you meant sue, then of course we can, Google has a presence in the UK and thus is subject to UK law (not saying all of Google might be subject to UK law, but at least its UK arm).


My bad, I mistyped that word. Yes, I meant "sue", not "use".


sickening to see the negativity here, I just bought a copy because this thing looks great and because I want to support the team.


yeesh, I respect Mozilla for their true open-source-everything-all-the-time philosophy but this is an example where I think it backfires - it's too early! Even if these really are awesome components it's really hard to see past the lack of polish. People are fickle and you only get one chance to make a first impression, it's important that these things look good


I dont believe it backfires. People are fickle, you get lots of chances to make a first impression.

I think the key is clarity in your communication, doing a lot of polish on top of unstable software and advertising it as stable causes people to waste time using it, advertising as beta / for early adopters lets the early adopters pick it up and the people who just want it to 'just work' can wait. If you lose a few people who dont understand the benefits still far outweight the negatives.

This is mostly just a disclaimer for people who are waiting to open source their software until 'its ready', its never ready, do it now.


We were torn whether to call the current state of things alpha or beta, but yes, these are not ready for prime time. Where we and some other orgs disagree is that things should be kept secret until they're 'ready', when outside contributions could help you get them ready!


It's never too early. Develop in the open. Make an official release when it's ready. The site makes it perfectly clear that it's in a Beta state.


you probably mean a Lisp Machine - http://en.wikipedia.org/wiki/Lisp_machine


Found what I meant: B5000 directly supported higher level languages.


Thanks, that (http://en.wikipedia.org/wiki/Burroughs_large_systems#B5000) seems like a very interesting processor. A few tidbits that caught my eye:

    - All code automatically reentrant
    - Partially data-driven tagged and descriptor-based design
    - First commercial implementation of virtual memory


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: