It's been over a decade that I really worked with Tk, but here some
meditation on the subject.
I'll address it to you since I know that you are quite an expert on this subject.
so IMHO
- Tk heavily relies on callbacks.
- The aim of those callbacks is located somewhere between 2 extremes4
- a) manipulating the GUI (e.g reordering elements)
- b) interacting with the application. (e.g. access DB)
- Since Perl doesn't run within browsers, there are 2 options for those callbacks
- A) porting to JS
- B) tunneling callbacks via http to the server¹
- For different reasons one would mainly like to go
- a -> A # performance
- b -> B # complexity, server bound
- While it certainly is possible to mimic most (or all) Tk-widgets in HTML&JS, it's pretty unlikely to have an AI which analyzes the code to split it into a) and b) parts.
- The most likely solution is to design a meta-language (maybe even a DSL) which is already addressing these needs.
- This meta approach would create the necessary output in either Perl/Tk or Perl+JS/HTML²
- having a restricted sub-dialect (intersection) which reliably translates Perl <-> JS shouldn't be impossible.³
What ya think, did I miss something?
footnotes
¹) with different possible approaches for client-server communication:
- classic http
- AJAX
- Web-Sockets (bidirectional)
²) or even other targets like Perl/Tkx or Perl/Wx or even Lisp/Emacs or whatever
³) But this restricted "Perl" could look very strange, e.g. only allowing scalars and hence only array-refs and hash-refs like
$array->push($a,$b) <-> array.push(a,b)
... or only allowing function scopes and no block scopes (JS does hoisting of lexicals)
Cheers Rolf
( addicted to the Perl Programming Language)
updates
moved side-notes to footnotes.
more footnotes
4) somehow analogous to the MVC paradigm, making a distinction between template code (View) and pure Perl code (Controller).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.