5 ms·
Sergio here, the creator of Vely. Go ahead and roast it. Here's a brief from the front page: Vely is an embedded programming language with C as a host language
by dsvr 4y ago
Sergio here, the creator of Vely. Go ahead and roast it. Here's a brief from the front page:
Vely is an embedded programming language with C as a host language. It's precompiled into C, creating a native executable.
Vely empowers C with rich features, simplicity and enhanced safety. It is general-purpose and well-suited for web applications.
Use Vely to rapidly develop high-performance and low-footprint applications
- tsegratis 4y agoI like the premise of embedded generating inline c. Kinda like php for c, rather than html I'm not sure of custom BNF per generating command. I notice they're mostly order independent, which makes it a little easier to learn, but what's the advantage over c syntax? Is it roughly that pointers etc are impossible. Maybe a c-esque syntax would be more learnable How does the existing syntax compose, i.e. can the user run away with writing tcl-style scripts If you don't get a lot of feedback, I would guess it is inpart due to custom syntax being an entry barrier to understanding I don't know, I think html is easy, so people want power with php. On the other hand for an audience that is using c, by the time I'm doing that, does Vely's custom syntax give me more than a set of convenient c library calls... such as https://kristaps.bsd.lv/kcgi/ https://kristaps.bsd.lv/kcgi/ In any case, I like the apis, and aim, and I think the premise has legs
- tsegratis 4y agoMaybe, rather than php, a "reactjs for c" is the direction you're heading
- dsvr 4y agoInteresting thought. Yes, it makes writing applications, easier, it inherits the top performance of C, it's got a lot of rich functionality. Vely is also a thin framework that mostly helps with building apps by not having to write Makefile, it will pickup any .v files you got. And it will generate a dispatcher for requests. But the framework doesn't do much, only the essentials, and that's by design. After all, C is all about flexibility, and that stays.
- dsvr 4y agoThanks for the feedback. The clauses in statements are not order dependent, so they can be specified in any order. No need to remember what goes where, just splatter your thoughts out. Vely is meant to be more human-readable than APIs; it leans more declarative than API. Each statement typically does what a number of C API calls would do, so the idea is to save time by saying what you need done rather than placing a number of API calls. At the same time, it's safer because it handles all the details and has a memory garbage collector. For instance, web-call does all kinds of GET and POST calls. run-query does SQL queries. write-string composes complex strings. Etc. Vely is also a thin framework. You can fire up FastCGI application server in minutes, and use the same program to run a command-line program.
- dsvr 4y agoI looked at kcgi and it's pretty cool for CGI/FastCGI if you want a-la-carte and then you use separate libraries for everything else. Vely has FastCGI built in by default (you can start FastCGI server in seconds with vv/vf), and the output statements (such as @ or p-out) do output to the web (i.e. to the Apache or Nginx reverse proxy) by default. So you could say in terms of functionality, kcgi is built into Vely transparently. In terms of additional functionality beyond kcgi, Vely offers - web constructs (getting input parameters from GET/POST, uploading files, sending files to client with send-file, cookie handling, output to web etc.), - safer and easier string manipulation, - database access (mariadb, mysql, postgresql, sqlite) with prepared statements and persistent connections, - regex (match-pattern), - exec-program for executing programs, - file operations, - encryption/encoding/hashing. I agree there's a learning curve. I can't say how would people see that, though the idea is to be easier than a traditional API, simply on the account of writing a single statement instead of say 5-10 C API calls.
- pvg 4y agoand roast it hopefully not although Slor HN could be a variant of Show HN but for roasting.
- throwawaymaths 4y agoI think I like the idea but I have a really hard time figuring out what exactly the code is doing. This is in contrast to say (in my experience), jsx - where what's going on is quite obvious, or zig, where for the most part it's clear what "the equivalent c would be". I apologize, I don't have specific feedback beyond a vague sense of mild confusion or constructive ideas on how to make it better, hopefully someone else brighter than I can take a crack at it?
- dsvr 4y agoThanks for your feedback. You can see the equivalent C code for any statement pretty easy. For example, if you go to "tutorials", then "tutorial-stock_app", and follow the tutorial instructions, you can always see the generated C code, which would be in: /var/lib/vv/bld/stockapp/__stock.o.c (so here "stock" is the application name and there's "stock.v" file). For example, when you see this Vely statement in stock.v (which obviously obtains input parameters from either GET or POST request): input-param stock_name this is line 9 in stock.v. All you need to do is look for: #line 9 "stock.v" in the generated code (which is /var/lib/vv/bld/stock/__stock.o.c), in this case it's: char *stock_name = vey_get_input_param (vey_get_config()->ctx.req, "stock_name") So in this case, it's just one line of C code. In other cases, it may be many lines. For example, Vely statement which apparently runs the INSERT SQL query: run-query#add_data@db = "insert into stock (stock_name, stock_price) vaues ('%s', '%s') on duplicate key update stock_price='%s'" : stock_name, stock_price, stock_price This is on line 12 in stock.v, and you can simply search for #line 12 "stock.v" in /var/lib/vv/bld/stock/__stock.o.c file. In this case, the generated code looks like: VV_UNUSED (_column_count_add_data); vely_get_config()->ctx.db->ind_current_db=0; static void *_sql_prep_add_data_stock_v_649 = NULL; _is_input_used_add_data[0]=1; _is_input_used_add_data[1]=1; _is_input_used_add_data[2]=1; add_data = "insert into stock (stock_name, stock_price) values ('%s', '%s') on duplicate key update stock_price='%s'"; const char *fname_loc_add_data = "stock.v"; num lnum_add_data = 12; vely_location (&fname_loc_add_data, &lnum_add_data, 1); vely_make_SQL (&_sql_buf_add_data, 3, add_data , _is_input_used_add_data[0]==1 ? (stock_name) : NULL , _is_input_used_add_data[1]==1 ? (stock_price) : NULL , _is_input_used_add_data[2]==1 ? (stock_price) : NULL ); if (_qry_executed_add_data == 1) {vely_report_error("Query [add_data] has executed the second time; if you want to execute the same query twice in a row without a loop-query, use different queries with the same query text (or variable) if that is your intention, file [stock.v], line number [12] ");} _qry_executed_add_data = 1; vely_execute_SQL (_sql_buf_add_data, &_arow_add_data, (const char**)&_err_add_data, (const char**)&_errm_add_data, 0, 1, 0, &_sql_prep_add_data_stock_v_649, _sql_paramcount_add_data, _sql_params_add_data); _nrow_add_data=0; vely_db_free_result (); vely_free (_sql_buf_add_data); so about 16 ines of code. This way you can see what actual C code is generated for any Vely code. And you can also step through this code in gdb by using --c-lines option in vv.
- oefrha 4y agoPlease change code { font-family: 'DejaVu Sans Mono'; } in your CSS to code { font-family: 'DejaVu Sans Mono', monospace; } For people without DejaVu Sans Mono installed (or for browsers doing a good job at defeating font fingerprinting), which would be most people, the code sample is rendered in the default proportional font, which is very ugly.
- kazinator 4y agoHow about: font-family: monospace; and that's it.
- dsvr 4y agoI found DejaVu Sans Mono to be a bit thinner and easier on the eyes. Either way is fine really. One of those whimsical decisions, I guess.
- blep_ 4y agoSo change the monospace font in your browser.
- dusted 4y agoWhile I'm totally on board with you on the principle that a website should inform the browser what is, not how to show it, that particular site is hardly the place for this discussion... _ANY_ article about CSS and client side javascript however.. go go go! :)
- scoopertrooper 4y agoCould this not be said about any stylistic choice though? Why should websites pick their own heading weight? What's wrong with the default text colour? Who are you to tell the browser not to use the default padding? People have been mucking about with typography since Gutenberg's day and they're not going to stop now. I'm personally 'font blind', but I don't have a problem with people being creative and making aesthetic choices.
- branko_d 4y ago> It's precompiled into C, creating a native executable. This reminds me of Bjarne Stroustrup's original implementation of C++ which was also transpiled to C. That was known as "Cfront" compiler at the time.
- jasfi 4y agoNim does the same thing.
- MaxBarraclough 4y agoThe less celebrated Vala language, too. https://en.wikipedia.org/wiki/Vala_(programming_language) https://en.wikipedia.org/wiki/Vala_(programming_language)
- dsvr 4y agoYes, kind of, you're right. C++ though went on for a roller-coaster of complexity, at least that's how I see it. I think of Vely as staying simple, declarative, and C all the way for performance reasons. More of a collection of practical things you'd want to do.