Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech

On templates and programming languages

 

 

First page Previous page 1 2 3 4 5 Next page Last page  View All Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded


william.allen.simpson at gmail

Jul 1, 2009, 11:08 AM

Post #76 of 116 (1534 views)
Permalink
Re: On templates and programming languages [In reply to]

Hay (Husky) wrote:
> I'm sorry that you seem to have such bad experiences with JavaScript.
> Still, i don't think your comments are really valid in today's world.

You mean like the {{hidden}} template series? How long that took to
finally work?

Worse, folks trying to use the classes directly, resulting in the contents
being centered, with the bullets and numbering removed:
<div class="NavFrame collapsed">
<div class="NavHead">Categories</div>
<div class="NavContent">

https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Wikipedia:Categories_for_discussion/Log/2009_June_6&diff=294783332&oldid=294782497
or
http://en.wikipedia.org/w/index.php?title=Wikipedia:Categories_for_discussion/Log/2009_June_6&diff=294783332&oldid=294782497

Believe me, user edits relying on JS, even where the JS isn't directly
accessible, are not really ready for prime time today.


> Take a look at 'web 2.0-style' applications, such as Gmail or Google
> Maps. Stuff like that would simply be impossible in a web browser
> without depending on proprietary technology such as Flash.

Sure, and do you know how many months it took to get that to work, or
how many folks from the application security group to review?

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Simetrical+wikilist at gmail

Jul 1, 2009, 12:15 PM

Post #77 of 116 (1532 views)
Permalink
Re: On templates and programming languages [In reply to]

On Wed, Jul 1, 2009 at 12:26 AM, Gregory Maxwell wrote: > Is execution in
enviroments where c modules are not possible actually > a hard requirement?
Even exec() apparently is no good, let alone C modules. > If it is I think
this is a non-starter. Seems so.
[]
_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


ssanbeg at ask

Jul 1, 2009, 12:43 PM

Post #78 of 116 (1536 views)
Permalink
Re: On templates and programming languages [In reply to]

On Wed, 01 Jul 2009 09:42:31 +0400, Dmitriy Sintsov wrote:


> XSLT itself is a way too much locked down - even simple things like
> substrings manipulation and loops aren't so easy to perform. Well, maybe
> I am too stupid for XSLT but from my experience bringing tag syntax in
> programming language make the code poorly readable and bloated. I've
> used XSLT for just one of my projects.
>

I'd assume we want locked down. Loops would be hard in any locked-down
environment; I don't recall seeing any recommendation in this thread on
how that wold be done. Recursion is much simpler, just track the depth,
and throw an exception if it goes to deep; emacs lisp already uses this
mechanism.

Some of those things may not be as easy as other lanugages, but the string
functions that this thread was started over are built into XPath 2.0, so
it would solve the problem at hand.

> Deeply nested braces of lisp remind me of current MediaWiki parser.
>

Superficially, sure; but IMHO the real problem with the current parser is
the ambiguity, that when you see a construct begin like {{{{{something...
you need to keep reading before you can parse it. With lisp, it's trivial
to parse, so we could do our own parsing if needed.


> Lua was highly valued here at computer lab, also Ocaml (not sure of
> proper spelling).
> Dmitriy

It seems like there are benefits there, but it's less clear how to
implement that sufficiently locked down, and how that would interface with
the rest of the parser, for callbacks, magic words, etc.



_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


ssanbeg at ask

Jul 1, 2009, 12:47 PM

Post #79 of 116 (1531 views)
Permalink
Re: On templates and programming languages [In reply to]

On Tue, 30 Jun 2009 22:53:36 +0100, Thomas Dalton wrote:

> 2009/6/30 Steve Sanbeg <ssanbeg [at] ask>:
>> On Tue, 30 Jun 2009 21:38:07 +0100, Thomas Dalton wrote:
>>
>>> 2009/6/30 Michael Daly <michael.daly [at] kayakwiki>:
>>
>>> How does that work with anonymous variables? Are all $[NUMBER] style
>>> names count as auto-declared?
>>>
>>
>> They're not anonymous, they're just named sequentially.
>
> They are anonymous when you call the template, though. The names are
> determined by the order in the call rather than written explicitly.
> They do need to be considered separately.

Anonymous would mean they don't have names, which isn't the case. They
are named, but those names may, or may not, be implicit. Currently, they
aren't handled separately; the parser names any unnamed arguments prior to
calling the template, which has no way of knowing how they were named; to
the template, they're all just named arguments {{t|a|b}} is the same as
{{t|2=b|1=a}} or even {{t|2=a|b}}.



_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


tim at tim-landscheidt

Jul 2, 2009, 3:14 AM

Post #80 of 116 (1526 views)
Permalink
Re: On templates and programming languages [In reply to]

Michael Daly <michael.daly [at] kayakwiki> wrote:

> [...]
> Since $ doesn't have a close, that makes things like {{{xxx|default
> value}}} slightly problematic, since "$xxx|$default_value" is slightly
> more awkward to parse. But that only shows how templates are also
> overly reliant on the pipe (|) symbol - as anyone who has tried to use
> tables in templates has discovered.
> [...]

bash (don't know if standard POSIX) has:

- ${parameter}
- ${parameter:-default}
- ${parameter:?error}

and even string functions:

- $#{parameter}
- ${parameter:offset:length}
- etc.

Personally, whatever programming language would be chosen,
I really like Aryeh's approach to sanitize and "compile" the
template to PHP. It could be used everywhere MediaWiki runs,
it is no hassle to set up compared to installing other in-
terpreters and the performance should be the top of what PHP
has to offer (and *all* templates could be compiled to that
code). From a distance, I think it would even be easier to
have the file/memory/CPU restrictions hacked into the main
PHP interpreter rather than to cook our own soup.

Tim


_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


brion at wikimedia

Jul 2, 2009, 10:08 AM

Post #81 of 116 (1517 views)
Permalink
Re: On templates and programming languages [In reply to]

Brian wrote:
> There are lots of usability improvements that can be made to the
> templating system. First and foremost the new system should allow
> advanced wiki users to perform programmatic operations on article data
> without the requirement that the data in the article be made
> unreadable.
>
> If we only focus our efforts on making the template namespace more
> complicated by giving it a more advanced programming language and we
> leave the article namespace as it is then we have not even touched the
> usability issue. We have just made it worse.

These are totally orthogonal issues, and paying attention to one doesn't
mean ignoring the other.


The ideal markup situation for the article namespace is that markup
shouldn't even *be* exposed to most users. A long-term goal is migration
to a more WYSIWIG-like editing experience -- to which one of the
potential stumbling blocks has been "but how will we do templates, which
currently are built with our horrifying wiki markup?"

Most editors will never know or care about the internal implementation
of templates, just as they don't know or care about it today. Cleaning
them up to allow the power-users who *write* templates to make them
functional and useful *and* maintainable is a win for template writers,
while having no direct impact on general editors.

(Indirectly, it will mean they're provided with better tools to use in
their articles.)


<not the subject of this thread>
For the general article editing experience, the issues are very
different, and that's the area the Wikipedia Usability Initiative is
concentrating on.

In the very short term, we're working on general look & feel, workflow,
and making it easier to figure out what you're supposed to do (such as
making the markup cheat-sheet available without leaving the editing window).

In the medium term, we hope to be able to "fold up" things that are
particularly ugly in markup such as images/media, template invocations
and tables, and provide friendlier widgets for adding and editing them.

In the long term, we might hope to be able to drop the front-end markup
entirely... but that's still a harder problem with several possible
trade-offs.
</not the subject of this thread>

-- brion

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


brion at wikimedia

Jul 2, 2009, 10:11 AM

Post #82 of 116 (1525 views)
Permalink
Re: On templates and programming languages [In reply to]

Michael Daly wrote:
> Chad wrote:
>
>> Unless we plan on trying to mass-convert not only years of old revisions
>> but change years-old behavior that millions of users have come to expect?
>> I would expect _any_ change to keep {{sometemplate}} always working,
>> even if the mechanics behind it change.
>
> Why not switch the template syntax for articles to match the syntax for
> tags (which in turn is based on XML or whatever syntax that comes from
> ultimately)?

For the meantime, assume there will be no changes whatsoever in how
markup in article space is written. A hypothetical change to template
invocation syntax is unrelated to how templates are implemented, and
clouds the current discussion.

-- brion

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


brion at wikimedia

Jul 2, 2009, 10:18 AM

Post #83 of 116 (1518 views)
Permalink
Re: On templates and programming languages [In reply to]

Aryeh Gregor wrote:
> I was assuming it would just return wikitext, and that would be
> integrated into the page and parsed, following all limits on wikitext
> (including size) -- just as with current parser functions.

That's one simple way to implement, but we may wish to consider working
with a document tree structure instead to help future-proof it against
future syntax changes (or dropping out the wiki syntax entirely). Things
to consider... :)

-- brion

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


tim at tim-landscheidt

Jul 2, 2009, 10:26 AM

Post #84 of 116 (1515 views)
Permalink
Re: On templates and programming languages [In reply to]

I wrote:

> [...]
> Personally, whatever programming language would be chosen,
> I really like Aryeh's approach to sanitize and "compile" the
> template to PHP. It could be used everywhere MediaWiki runs,
> it is no hassle to set up compared to installing other in-
> terpreters and the performance should be the top of what PHP
> has to offer (and *all* templates could be compiled to that
> code). From a distance, I think it would even be easier to
> have the file/memory/CPU restrictions hacked into the main
> PHP interpreter rather than to cook our own soup.

Come to think of it, it would also fit very well with pro-
filing individual templates.

Tim


_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


brion at wikimedia

Jul 2, 2009, 10:27 AM

Post #85 of 116 (1515 views)
Permalink
Re: On templates and programming languages [In reply to]

Tim Starling wrote:
> I think Rhino would be an easier path to JavaScript execution than
> SpiderMonkey. You can pass an -Xmx option to the java VM, and it'll
> throw an OutOfMemory exception when it hits that limit, allowing you
> to implement per-snippet memory limits without killing the
> interpreter. You could do wall-clock time limits using
> java.util.Timer, or CPU time limits using a JNI hack to poll clock().
> You could turn off LiveConnect by making your own ClassShutter,
> leaving what (on initial impressions) is a reasonably secure sandbox.

Freebase is apparently doing their server-side JS work with Rhino and
have actually modified their JVM to handle some of the resource limiting.

> Running scripts in the Java VM has the advantage that you don't have
> to rely on the security of the collection of amateurish C code that is
> PHP. Remember those PCRE crash bugs that went unfixed for years,
> before someone finally demonstrated elevation to arbitrary execution?

*shudder*

-- brion

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


brion at wikimedia

Jul 2, 2009, 10:32 AM

Post #86 of 116 (1522 views)
Permalink
Re: On templates and programming languages [In reply to]

Gregory Maxwell wrote:
> So— Any thoughts on how you address the universal problem of the DOS
> attack script?
[snip]
> I'm of the impression that simply setting a limits on CPU and memory
> isn't sufficient to address this, because the reasonable limit will be
> high enough to be dangerous when the object is added to 100k pages,
> while a limit low enough to be safe everywhere will be far too
> constraining and likely to fail at random depending on overall system
> load.

It's never an easy problem. :)

But there are some interesting potential things to poke at, such as
having per-template limits, per-cluster limits, etc -- we could in
theory shut down some template rendering while still spitting out the
rest of a page on a timely basis.

>> Disadvantage: Like PHP, Python is difficult to lock down securely.
>
> I don't know that difficult is really the right description here.
> People willing to spend far more effort on this than you probably are
> have tried to sandbox python and failed. I don't believe there is any
> real production grade support for the level of lockdown required for
> either PHP or Python. And I'd worry that any PHP implementations of
> the sandboxed languages might lose the battle tested sandboxing.
>
> It's acceptable for mediawiki to fall back to lower performing
> alternatives when c modules can't be used, but I doubt its acceptable
> to fall back to less secure ones!

Indeed. :)

> Is execution in enviroments where c modules are not possible actually
> a hard requirement? If it is I think this is a non-starter.

Since requiring custom PHP modules would pretty much rule out all casual
third-party use of MediaWiki, that would definitely be a hard
requirement to not require it. :)

I'd really _like_ to be able to avoid having to require external
executables either, if it can be managed, but that's harder since it
means having a pure PHP implementation of the scripting language. (ouch!)

-- brion


_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


questpc at rambler

Jul 2, 2009, 10:48 AM

Post #87 of 116 (1523 views)
Permalink
Re: On templates and programming languages [In reply to]

> I'd really _like_ to be able to avoid having to require external
> executables either, if it can be managed, but that's harder since it
> means having a pure PHP implementation of the scripting language.
> (ouch!)
>
Maybe translating only a subset of JS or Lua to PHP. The engine itself
is written in PHP, anyway. Moving to C/Java modules would dramatically
reduce the popularity of engine. For example, right now I am having
difficulties compiling ffmpeg at old FreeBSD host. I imagine custom php
module can have similar difficulties.
Dmitriy

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


vasilvv at gmail

Jul 2, 2009, 12:03 PM

Post #88 of 116 (1526 views)
Permalink
Re: On templates and programming languages [In reply to]

Brion Vibber wrote:
> I'd really _like_ to be able to avoid having to require external
> executables either, if it can be managed, but that's harder since it
> means having a pure PHP implementation of the scripting language. (ouch!)
>
> -- brion

I've rewritten abuse filter parser so its scripts (language differs
though) may now be embedded in wikitext. The extension is called
InlineScripts (sorry, haven't invented any better name) and it's
working, although many functions are not implemented and test suite is
missing.

Also, there's a problem for all such embedded languages proposals: we
don't have an appropriate parser hook type.
* Function hooks (like {{#if}}) will have their code preprocessed
(that's undesirable)
* Tag hooks don't have access to PPFrame, and therefore they don't have
access to template arguments, they are not expanded by
Special:ExpandTemplates etc.

--vvv

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


michael.daly at kayakwiki

Jul 2, 2009, 1:39 PM

Post #89 of 116 (1514 views)
Permalink
Re: On templates and programming languages [In reply to]

Brion Vibber wrote:

> The ideal markup situation for the article namespace is that markup
> shouldn't even *be* exposed to most users. A long-term goal is migration
> to a more WYSIWIG-like editing experience -- to which one of the
> potential stumbling blocks has been "but how will we do templates, which
> currently are built with our horrifying wiki markup?"

Since templates forbid looping, whatever manages it can't be considered
a programming language (missing iteration in {sequence, selection,
iteration}).

Perhaps we should consider this a markup problem and not a programming
problem. If templates have styles (not to be confused with CSS concepts
necessarily) then we just describe the template instead of program the
template. {{{var}}} can become something like content: in CSS.
Conditionals are... interesting. Apply style x if the condition
satisfied else apply style y (.e.g display: "nicely"; vs display: none;)

Just an idea...

Mike


_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


gmaxwell at gmail

Jul 2, 2009, 2:34 PM

Post #90 of 116 (1524 views)
Permalink
Re: On templates and programming languages [In reply to]

On Thu, Jul 2, 2009 at 4:39 PM, Michael Daly<michael.daly [at] kayakwiki> wrote:
> Brion Vibber wrote:
>
>> The ideal markup situation for the article namespace is that markup
>> shouldn't even *be* exposed to most users. A long-term goal is migration
>> to a more WYSIWIG-like editing experience -- to which one of the
>> potential stumbling blocks has been "but how will we do templates, which
>> currently are built with our horrifying wiki markup?"
>
> Since templates forbid looping, whatever manages it can't be considered
> a programming language (missing iteration in {sequence, selection,
> iteration}).

You can clone a template multiple times to effectively create
recursion of a finite maximum depth.

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


brion at wikimedia

Jul 2, 2009, 2:38 PM

Post #91 of 116 (1514 views)
Permalink
Re: On templates and programming languages [In reply to]

Michael Daly wrote:
> Brion Vibber wrote:
>
>> The ideal markup situation for the article namespace is that markup
>> shouldn't even *be* exposed to most users. A long-term goal is migration
>> to a more WYSIWIG-like editing experience -- to which one of the
>> potential stumbling blocks has been "but how will we do templates, which
>> currently are built with our horrifying wiki markup?"
>
> Since templates forbid looping,

Since iteration over a set is frequently desired/needed, assume it will
exist in a sensible programming language.

As already noted in this thread, horrible hacks for limited-depth
looping are already in use.

-- brion

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


stevagewp at gmail

Jul 2, 2009, 7:18 PM

Post #92 of 116 (1508 views)
Permalink
Re: On templates and programming languages [In reply to]

On Fri, Jul 3, 2009 at 7:38 AM, Brion Vibber<brion [at] wikimedia> wrote:
> Since iteration over a set is frequently desired/needed, assume it will
> exist in a sensible programming language.
>
> As already noted in this thread, horrible hacks for limited-depth
> looping are already in use.

So:
1) The chosen language will support iteration over finite sets
2) Could it support general iteration, recursion etc?
3) If so, are there any good mechanisms for limiting the
destrutiveness of an infinite loop?

That is, is it practical to say "you can iterate all you like, but
you're only getting 10ms to do it"? Sounds like it could be an
interesting property of a template, where a suitably authorised person
could allow certain templates longer execution times.

Steve

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Simetrical+wikilist at gmail

Jul 2, 2009, 7:22 PM

Post #93 of 116 (1509 views)
Permalink
Re: On templates and programming languages [In reply to]

On Thu, Jul 2, 2009 at 10:18 PM, Steve Bennett<stevagewp [at] gmail> wrote:
> So:
> 1) The chosen language will support iteration over finite sets
> 2) Could it support general iteration, recursion etc?
> 3) If so, are there any good mechanisms for limiting the
> destrutiveness of an infinite loop?

You don't really need an infinite loop. DoS would work fine if you
can have any loop. Even with just foreach:

foreach(array(1,2)as $x1)foreach(array(1,2)as $x2)....

A few dozen of those in a row will give you a nice short bit of code
that may as well run forever.

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


marco at harddisk

Jul 2, 2009, 7:25 PM

Post #94 of 116 (1509 views)
Permalink
Re: On templates and programming languages [In reply to]

On Fri, Jul 3, 2009 at 4:22 AM, Aryeh Gregor
<Simetrical+wikilist [at] gmail<Simetrical%2Bwikilist [at] gmail>
> wrote:

> On Thu, Jul 2, 2009 at 10:18 PM, Steve Bennett<stevagewp [at] gmail> wrote:
> > So:
> > 1) The chosen language will support iteration over finite sets
> > 2) Could it support general iteration, recursion etc?
> > 3) If so, are there any good mechanisms for limiting the
> > destrutiveness of an infinite loop?
>
> You don't really need an infinite loop. DoS would work fine if you
> can have any loop. Even with just foreach:
>
> foreach(array(1,2)as $x1)foreach(array(1,2)as $x2)....
>
> A few dozen of those in a row will give you a nice short bit of code
> that may as well run forever.
>
You can make some kind of counter, which gets incremented each
foreach/while/for loop. If it reaches 200 (or whatever), execution is
stopped.

Marco


--
VMSoft GbR
Nabburger Str. 15
81737 München
Geschäftsführer: Marco Schuster, Volker Hemmert
http://vmsoft-gbr.de
_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


rarohde at gmail

Jul 2, 2009, 7:30 PM

Post #95 of 116 (1516 views)
Permalink
Re: On templates and programming languages [In reply to]

On Thu, Jul 2, 2009 at 7:25 PM, Marco
Schuster<marco [at] harddisk> wrote:
> On Fri, Jul 3, 2009 at 4:22 AM, Aryeh Gregor
> <Simetrical+wikilist [at] gmail<Simetrical%2Bwikilist [at] gmail>
>> wrote:
>
>> On Thu, Jul 2, 2009 at 10:18 PM, Steve Bennett<stevagewp [at] gmail> wrote:
>> > So:
>> > 1) The chosen language will support iteration over finite sets
>> > 2) Could it support general iteration, recursion etc?
>> > 3) If so, are there any good mechanisms for limiting the
>> > destrutiveness of an infinite loop?
>>
>> You don't really need an infinite loop.  DoS would work fine if you
>> can have any loop.  Even with just foreach:
>>
>> foreach(array(1,2)as $x1)foreach(array(1,2)as $x2)....
>>
>> A few dozen of those in a row will give you a nice short bit of code
>> that may as well run forever.
>>
> You can make some kind of counter, which gets incremented each
> foreach/while/for loop. If it reaches 200 (or whatever), execution is
> stopped.

Really, the ideal solution is to say the user is allowed X number of
basic operations, Y amount of memory, and Z amount of execution time,
and write an interpreter that is agnostic about how those resources
are used. If all you do is add limits to loops, then someone will add
loops of loops and or even flat stacks to get around it.

-Robert Rohde

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


stevagewp at gmail

Jul 2, 2009, 7:34 PM

Post #96 of 116 (1509 views)
Permalink
Re: On templates and programming languages [In reply to]

On Fri, Jul 3, 2009 at 12:25 PM, Marco
Schuster<marco [at] harddisk> wrote:
> You can make some kind of counter, which gets incremented each
> foreach/while/for loop. If it reaches 200 (or whatever), execution is
> stopped.

Yes, but that implies:
1) We're writing an interpreter, or getting heavily involved in the
codebase of an existing one
2) Thinking ahead of every possible DoS and thwarting it.

I was wondering if there was a more general solution using a black box
interpreter. But without knowing the language or interpreter, that may
not be a very meaningful question.

Steve

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Simetrical+wikilist at gmail

Jul 2, 2009, 7:42 PM

Post #97 of 116 (1505 views)
Permalink
Re: On templates and programming languages [In reply to]

On Thu, Jul 2, 2009 at 10:25 PM, Marco
Schuster<marco [at] harddisk> wrote:
> You can make some kind of counter, which gets incremented each
> foreach/while/for loop. If it reaches 200 (or whatever), execution is
> stopped.

Sure -- if you're writing the program language interpreter yourself.
I think we were hoping to avoid that.

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


questpc at rambler

Jul 2, 2009, 11:47 PM

Post #98 of 116 (1508 views)
Permalink
Re: On templates and programming languages [In reply to]

* Brion Vibber <brion [at] wikimedia> [Thu, 02 Jul 2009 10:18:14 -0700]:
> Aryeh Gregor wrote:
> > I was assuming it would just return wikitext, and that would be
> > integrated into the page and parsed, following all limits on
wikitext
> > (including size) -- just as with current parser functions.
>
> That's one simple way to implement, but we may wish to consider
working
> with a document tree structure instead to help future-proof it against
> future syntax changes (or dropping out the wiki syntax entirely).
Things
> to consider... :)
>
SLAX http://code.google.com/p/libslax/ (provided by Gregory Maxwell)
looks like really good thing for document tree manipulation and as the
people have pointed out, XSLT is simle to limit (lock the recursion
down). It's compact and more easily readable comparing to "normal" xslt.
I remember that PHP has some standard module for XSLT transformations, I
wonder whether it's simple to convert SLAX->XSLT then use PHP XSLT
transformation.
Dmitriy

_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


tstarling at wikimedia

Jul 3, 2009, 12:13 AM

Post #99 of 116 (1497 views)
Permalink
Re: On templates and programming languages [In reply to]

Steve Sanbeg wrote:
> I'd assume we want locked down. Loops would be hard in any locked-down
> environment; I don't recall seeing any recommendation in this thread on
> how that wold be done. Recursion is much simpler, just track the depth,
> and throw an exception if it goes to deep; emacs lisp already uses this
> mechanism.

Loops are essential for readable code. There is no problem with
allowing loops in conjunction with time limits, that we don't have
already with complex templates. In fact, time limits for complex
templates would be an improvement over the system of expansion limits
we have at the moment.

Recursion can give a long running time even if the depth is limited.
By calling the function multiple times from its own body, you can have
exponential time order in the recursion depth.

-- Tim Starling


_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


oscar.vives at gmail

Jul 3, 2009, 2:49 AM

Post #100 of 116 (1501 views)
Permalink
Re: On templates and programming languages [In reply to]

On Fri, Jul 3, 2009 at 4:18 AM, Steve Bennett <stevagewp [at] gmail> wrote:

> On Fri, Jul 3, 2009 at 7:38 AM, Brion Vibber<brion [at] wikimedia> wrote:
> > Since iteration over a set is frequently desired/needed, assume it will
> > exist in a sensible programming language.
> >
> > As already noted in this thread, horrible hacks for limited-depth
> > looping are already in use.
>
> So:
> 1) The chosen language will support iteration over finite sets
> 2) Could it support general iteration, recursion etc?
> 3) If so, are there any good mechanisms for limiting the
> destrutiveness of an infinite loop?
>
> That is, is it practical to say "you can iterate all you like, but
> you're only getting 10ms to do it"? Sounds like it could be an
> interesting property of a template, where a suitably authorised person
> could allow certain templates longer execution times.



another option, is to use a compiled language to a intermediate languaje
that is interpreted. make so the interpreted for a program has a number of
instruction limit. Say.. .a budget of 90.000 opcodes. If a script break that
barrier, is stoped (the interpreter "return;") and the script is marked as
"dirty".

bad example follows:
QuakeC is compiled to QC (a fake aseembler lang) this is interpreted by
QCVM (the quake virtual machine). The interpreter include some limitations
(on stock QCVM, the deep of recursion ).

A good side effect of this, is that a Quake mod work on any OS.

Trivia: Quake3 and others have a setup like this one, but using C. It
probably is not useable for Wikipedia, since C is bad lang to work with
strings. Too bad, because is fast, crossplatform, there are lots of tools to
work with it, and existing programmers.





--
--
ℱin del ℳensaje.
_______________________________________________
Wikitech-l mailing list
Wikitech-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

First page Previous page 1 2 3 4 5 Next page Last page  View All Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.