[{"data":1,"prerenderedAt":403},["ShallowReactive",2],{"project-14896455":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":36,"aspects":37,"strip":45,"post_text":46,"what":47,"said":69,"maker_in_thread":154,"shape":163,"grid":167,"attempts":366,"same_week":367,"maker_shows":43,"maker_hidden":396,"reader_version":397,"card":398},"14896455","see-phit","Compile-time HTML parsing in C++14","title","Show HN: Compile-time HTML parsing in C++14","https:\u002F\u002Fgithub.com\u002Frep-movsd\u002Fsee-phit","github.com","rep_movsd",1501540265,2017,175,81,201,2242,9,"notable","languages","html parsing library","library",[24,25,26,27,28],"c++14","compile-time","html parser","constexpr","templates","curious",-0.19,{"positive":32,"neutral":33,"mixed":34,"critical":35},0,11,2,4,17,{"performance":38,"idea":39,"execution":41,"design":42,"docs":44},{"positive":32,"critical":32},{"positive":32,"critical":40},3,{"positive":32,"critical":32},{"positive":32,"critical":43},1,{"positive":32,"critical":32},[32,32,32,32,32,32,32,40,43,40,40,32,40,40,32,32,32,32,32,32,32,43,43,40,32,40,40,40,32,40,32,32,32,32,32,32,32,32,32,32],null,{"problem":48,"audience":46,"pricing":46,"motivation":58,"time_to_build":46,"stack":62,"openness":68,"stage":68,"team_size":68},{"value":49,"source":50,"evidence":51},"Parsing HTML templates at compile time instead of runtime.","maker",[52,55],{"id":53,"by":11,"text":54},"14898208","Yes - D is what C++ should have been. By C++ 23, we will be about 80% there :| Considering that one of the greatest C++ programmers of all time (Andrei) is now a D person, that's…",{"id":56,"by":11,"text":57},"14896701","constexpr is a subset of what you can do at runtime. So my way of debugging is #define constexpr Which makes all the code plain code that executes at runtime, then you can put…",{"value":59,"source":50,"evidence":60},"Fun with compile-time metaprogramming; the maker finds such C++ satisfying.",[61],{"id":53,"by":11,"text":54},[63],{"value":64,"source":50,"evidence":65},"C++14",[66],{"id":67},"post","unknown",{"praise":70,"objections":83,"requests":106,"questions":122,"alternatives":131},[71],{"value":72,"source":73,"evidence":74},"Impressive work and a cool idea","commenter",[75,79],{"id":76,"by":77,"text":78},"14898215","Mmrnmhrm","I am very disappointed with constexpr in C++14 and C++17. The work shown here is impressive, but the point is that it should not be. D has shown that variable initialization at…",{"id":80,"by":81,"text":82},"14896704","cletus","I have nothing to add other than that's both cool and scary.",[84,88,95],{"value":85,"source":73,"evidence":86},"constexpr compile times are very slow and memory hungry",[87],{"id":76,"by":77,"text":78},{"value":89,"source":73,"evidence":90},"Error messages from template-based code are incomprehensible",[91],{"id":92,"by":93,"text":94},"14899149","setzer22","Sadly, the thing that stood out the most to me is the sentence We attempt to make the compiler generate the most sensible error message, followed by an incomprehensible error…",{"value":96,"source":73,"evidence":97},"Malformed HTML rules are unclear and HTML5 is complex",[98,102],{"id":99,"by":100,"text":101},"14896839","kbenson","The program will fail to compile if the HTML is malformed By malformed are we talking about incorrectly closed, or actual invalid HTML? HTML doesn't require all tags be closed...",{"id":103,"by":104,"text":105},"14896965","lucideer","> The HTML that browsers accept is loosely defined This has changed since the advent of the HTML5 specification, the primary purpose of which was to retroactively describe…",[107,118],{"value":108,"source":73,"evidence":109},"Support for debugging compile-time code",[110,114],{"id":111,"by":112,"text":113},"14896652","tlb","Wow. How does one debug complex constexpr code? I assume there's no printf. It'd be really cool if it supported some kind of interpolation, like Jinja templates, so it could…",{"id":115,"by":116,"text":117},"14910838","fooker","I mean through an actual debugger, not printf debugging.",{"value":119,"source":50,"evidence":120},"Constexpr printf support",[121],{"id":56,"by":11,"text":57},[123,127],{"value":124,"source":73,"evidence":125},"Whether it implements HTML5 parsing",[126],{"id":103,"by":104,"text":105},{"value":128,"source":73,"evidence":129},"How to debug complex constexpr code",[130],{"id":111,"by":112,"text":113},[132,143],{"value":133,"source":73,"evidence":134},"D compile-time HTML\u002FJSON parsing",[135,139],{"id":136,"by":137,"text":138},"14897170","mhh__","For reference: In D, you could just take a HTML parser then run it at compile time without writing any new code.",{"id":140,"by":141,"text":142},"14900757","p0nce","Yes. We parse JSON at compile-time with std.json (in D standard library). It probably wasn't even designed with that goal. From a D point of view, compile-time parsers are almost…",{"value":144,"source":73,"evidence":145},"Common Lisp eval-when and macros",[146,150],{"id":147,"by":148,"text":149},"14897319","reikonomusha","Likewise in Common Lisp, arguably much more easily.",{"id":151,"by":152,"text":153},"14897462","stevelosh","Vanilla macros are one option. ``` (defmacro html (string) (some-html-parser-library:parse string)) ``` Or you could use a function and a compiler macro to make it more of an…",{"comments":33,"answered":35,"key":155},[156,159,162],{"id":157,"text":158},"14898340","It's coming soon, as always. A lot of the STL is already being constexpr-ized (as Stephen T Lavalej has mentioned) This code i wrote takes about 5 seconds on gcc and 1.5 seconds…",{"id":160,"text":161},"14898213","Well LISP has no distinction between meta-programming and programming. so as long as you like parens, you can do anything",{"id":53,"text":54},{"commenters":164,"max_depth":33,"maker_replies":33,"first_comment_mins":165,"lifespan_hours":166},40,38,86,[168,172,175,179,181,183,186,188,190,192,194,196,199,202,205,207,209,211,212,216,217,220,222,225,227,230,232,233,236,237,240,243,247,249,251,253,257,260,263,265,268,271,272,274,277,280,283,285,287,289,292,294,296,299,301,304,307,310,313,315,318,321,322,326,329,331,333,335,337,339,341,343,345,348,350,352,354,357,359,362,364],[169,32,32,170,171,32],"14897364","other\u002Fneutral\u002Fnone","Iv",[173,32,32,170,174,32],"14898321","pcwalton",[176,32,32,177,178,32],"14898460","commenter\u002Fneutral\u002Fnone","unkown-unknowns",[180,32,32,177,174,32],"14898560",[182,32,32,177,171,32],"14898599",[184,32,32,177,185,32],"14898660","pjmlp",[187,32,32,177,171,32],"14898741",[189,32,32,177,185,32],"14898790",[191,32,32,177,171,32],"14898596",[193,32,32,177,174,32],"14901728",[195,32,32,177,185,32],"14898672",[197,32,32,177,198,32],"14899045","fulafel",[200,32,32,170,201,32],"14899963","ericfrederich",[203,32,32,170,204,32],"14900916","sqeaky",[76,43,40,206,77,32],"project\u002Fmixed\u002Fperformance",[157,43,32,208,11,43],"maker\u002Fneutral\u002Fperformance",[136,34,43,210,137,32],"project\u002Fcritical\u002Fidea",[147,34,43,210,148,32],[213,34,40,214,215,32],"14897351","project\u002Fneutral\u002Fidea","systems",[151,34,40,214,152,32],[218,34,40,214,219,32],"14898422","TeMPOraL",[221,34,32,170,137,32],"14897795",[223,34,32,170,224,32],"14898429","junke",[160,34,32,226,11,43],"maker\u002Fneutral\u002Fnone",[228,34,40,229,116,32],"14897385","project\u002Fneutral\u002Fexecution",[231,34,40,229,137,32],"14897786",[115,34,40,229,116,32],[234,34,40,214,235,32],"14897402","giancarlostoro",[53,34,32,170,11,43],[238,34,32,170,239,32],"14898456","int_19h",[241,34,32,170,242,32],"14898679","dawg",[244,34,32,245,246,32],"14898872","other\u002Fcritical\u002Fnone","tjoff",[248,34,32,177,137,32],"14905955",[250,34,32,177,246,32],"14908424",[252,34,32,177,137,32],"14913970",[254,34,32,255,256,32],"14899567","other\u002Fcritical\u002Fperformance","imtringued",[258,34,32,259,141,32],"14900808","commenter\u002Fneutral\u002Fperformance",[261,34,32,262,239,32],"14905930","other\u002Fcritical\u002Fidea",[264,34,32,170,137,32],"14906068",[266,34,32,170,267,32],"14899143","otabdeveloper1",[269,34,32,170,270,32],"14899725","gpderetta",[140,34,32,170,141,32],[92,40,43,273,93,32],"project\u002Fcritical\u002Fdesign",[275,40,32,276,11,43],"14899265","maker\u002Fneutral\u002Fdesign",[278,40,43,210,279,32],"14900273","avar",[281,40,32,282,11,43],"14918299","maker\u002Fneutral\u002Fidea",[284,40,32,177,279,32],"14928231",[80,35,40,286,81,32],"project\u002Fmixed\u002Fidea",[288,35,32,226,11,43],"14896718",[290,35,32,170,291,32],"14897717","MrMorden",[111,293,40,229,112,32],5,[56,293,32,295,11,43],"maker\u002Fneutral\u002Fexecution",[297,293,40,214,298,32],"14896779","dom0",[300,293,32,282,11,43],"14896797",[302,293,40,229,303,32],"14896719","Jeaye",[305,293,32,170,306,32],"14897614","ubadair",[308,293,32,170,309,32],"14896993","ehliu",[311,293,32,170,312,32],"14897022","VHRanger",[314,293,32,170,137,32],"14897161",[99,316,40,317,100,32],6,"project\u002Fneutral\u002Fdocs",[319,316,32,320,11,43],"14896859","maker\u002Fneutral\u002Fdocs",[103,316,32,177,104,32],[323,316,32,324,325,32],"14897332","commenter\u002Fcritical\u002Fnone","taeric",[327,316,32,170,328,32],"14898096","tannhaeuser",[330,316,32,177,104,32],"14899073",[332,316,32,177,325,32],"14901734",[334,316,32,170,328,32],"14902488",[336,316,32,177,325,32],"14904538",[338,316,32,170,328,32],"14906109",[340,316,32,177,325,32],"14908446",[342,316,32,177,104,32],"14899048",[344,316,32,324,325,32],"14901716",[346,316,32,170,347,32],"14903200","bzbarsky",[349,316,32,177,325,32],"14917078",[351,316,32,177,347,32],"14919884",[353,316,32,177,325,32],"14920810",[355,316,32,356,11,43],"14898182","maker\u002Fpositive\u002Fexecution",[358,316,32,295,11,43],"14898190",[360,316,32,177,361,32],"14898791","gsnedders",[363,316,32,177,328,32],"14899015",[365,316,32,177,347,32],"14898038",[],[368,373,378,382,387,392],{"id":369,"name":370,"points":371,"category":372},"14894653","TensorFire",564,"ai",{"id":374,"name":375,"points":376,"category":377},"14865043","The JavaScript Way",545,"learning_science",{"id":379,"name":380,"points":381,"category":20},"14911372","Bt",254,{"id":383,"name":384,"points":385,"category":386},"14869138","EchoMods",227,"hardware",{"id":388,"name":389,"points":390,"category":391},"14865666","Nuclino",133,"productivity",{"id":393,"name":394,"points":395,"category":377},"14865184","A 2D Physics Simulator in JavaScript",126,false,"v2",{"id":399,"name":5,"line":6,"ai":396,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":30,"top":18,"kw":400,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":401,"url":9,"mix":402,"praise":72,"objection":85,"sub":21},14896455,[24,25,26,27,28],"0000000313303300000001130333030000000000",[32,33,34,35],1794036557817]