Live data from Hacker News

Why I chose Lua for this blog

andregarzia.com

41–50 of 159 posts

Re: Why I chose Lua for this blog

#41
I've been thinking of how to make a blog simple recently, and I came across xslt. It looks really cool and seems pretty set in stone, so I thought I'd ask, what are the advantages/drawbacks of making your own tech stack versus xslt? At first glance, it seems perfectly able to handle rss and other simple linking patterns, and pretty much anything can easily be turned into an xml then xslt could be used to generate an html (server-side, or rather writer-side, not like the blog is gonna change) that you serve?

Re: Why I chose Lua for this blog

#42
post #41

I've been thinking of how to make a blog simple recently, and I came across xslt. It looks really cool and seems pretty set in stone, so I thought I'd ask, what are the advantages/drawbacks of making your own tech stack versus xslt? At first glance, it seems perfectly able to handle rss and other simple linking patterns, and pretty much anything can easily be turned into an xml then xslt could be used to generate an…

XSLT might be removed from the HTML spec soon, see discussion here: https://news.ycombinator.com/item?id=44952185

Re: Why I chose Lua for this blog

#44
post #42
post #41

I've been thinking of how to make a blog simple recently, and I came across xslt. It looks really cool and seems pretty set in stone, so I thought I'd ask, what are the advantages/drawbacks of making your own tech stack versus xslt? At first glance, it seems perfectly able to handle rss and other simple linking patterns, and pretty much anything can easily be turned into an xml then xslt could be used to generate an…

XSLT might be removed from the HTML spec soon, see discussion here: https://news.ycombinator.com/item?id=44952185

that would be client side if it happens, though, I'm talking about server side generation

xsltproc was preinstalled on my machine actually, the fact I could just run it without installing anything is pretty cool

Re: Why I chose Lua for this blog

#45
post #41

I've been thinking of how to make a blog simple recently, and I came across xslt. It looks really cool and seems pretty set in stone, so I thought I'd ask, what are the advantages/drawbacks of making your own tech stack versus xslt? At first glance, it seems perfectly able to handle rss and other simple linking patterns, and pretty much anything can easily be turned into an xml then xslt could be used to generate an…

XSL is neat, and it is a functional language, but between XSL and XPath, it is quite verbose. Here's a small section of XSL I use to generate my website (not my blog):

    
    
      
      
      
        
          
            
              
            
            
              
            
            
            
          
   
          
            
              
            
            
              
            
            
            
          
        
      

      
    
And yes, there is other code I've omitted for brevity. This is used to generate the navigation links for the site. I initially write this ... prior to 2009 (that's when I moved it into git). There have been some minor fixes to the XSL over the years, but it's largely unchanged (for a reason that I hope is obvious). Yes, I still use it, because it still works, and it's for a static website.

Re: Why I chose Lua for this blog

#46
post #37

Earlier quoted context omitted.

Everything web-facing, if it's not a static website delivered by a well-tested web server, happens in a high-risk environment. And doubly so, if, like in this case, stuff like custom cgi libraries are involved. One has to be either very confident in their skills to do that or very, very brave.

What? Are you serious? If you roll your own little cgi-bin perl script behind Apache you're far from vulnerable compared to, say, a WordPress website.

In any web application all data that comes from the outside world is potentially hostile. A decent web framework takes care of basic security measures, does input sanitation, provides referer checking and csrf for forms, etc. When you roll your own, your _are_ on your own to do that all properly yourself, if you even know all the potential pitfalls. And if you write your own cgi library like the op even more so. I'm not advocating for using WordPress either. I'm advocating for either having a static blog or using a decent, tested web framework or the the very least cgi module that provides tested implementations of common security features that in my experience are typically missed in self-made cgi scripts.

Re: Why I chose Lua for this blog

#50

Earlier quoted context omitted.

it's easy, but the 1 indexes and global by default suck

The 1 indexes are only a difference from what you're used to. Lua was made by mathematicians, who of course wanted to address the first element as 1, the second element as 2, etc. 0-indexing makes sense in the context of C where the index operator is syntactic sugar for pointer arithmetic. In higher-level languages like C# and Python and others, it's pretty much just a leftover habit from C devs that we all got used…

And a lot of the time it makes the syntax more compact than it would be with 0-indexing.

  for i=1,#arr do
    foo(arr[i])
  end
I don't feel that strongly for or against either way of indexing though, they both have their pros and cons.
Post reply on HN