> We're not discussing code or the inner workings of Asterisk or even
> changing the functionality of Asterisk, just what the proper order
> of the words should be.
>
> Most of us users are people, not parsers. The developers? Well,
> that's why they're developers :)
>
> Thanks in advance,

We are discussing the inner workings of Asterisk as this is an Asterisk thread. 
 With that in mind, we are also discussing the order that a program works best 
in parsing code.

The real reason that programmers use languages (like C or perl) is that 
machines are less intelligent than humans.  If we used English to program 
computers, the computer would have to read the slight nuances that exist in 
English and just like this thread, we would be asking mathematical machines to 
make assumptions about what each say.  Who is to say what variant of the 
English language is to be used, because people may still not understand the 
syntax of language we use.

That being said, ordering in a command structure should make sense to the 
application (less intelligent entity), not to the "programmer" (hopefully more 
intelligent).  Anyone who has configured most applications would agree that 
they are more of a programming language than a conversational language.

The Asterisk core program doesn't know what verbs each module, channel, res, or 
function contains.  It must ask the code(noun), for a given verb (function) and 
then pass that function the options (adjectives).

So if I use show black dogs, with dogs being the module, show being the verb, 
and black being the option, here is what would happen:

Look for module show -> doesn't exist
Look for module black -> doesn't exist
Look for module dogs -> Found, get reference
Ask module dogs, for function show -> found, get reference
Send option black (remaining words from the parser) to function show in module 
black.

In my opinion that makes Asterisk slow and introduces bugs if some programmer 
creates a new app_black which causes a video screen to go black, then we have a 
problem.

In this example, we are left with fixing the position of the module as position 
3 in the command stack.   That also means that additional parameters (options) 
must limited to one (which doesn't work) or messes with the command structure 
by placing adjectives after the noun like:

show black dogs dachshund

That doesn't make any sense for humans again.

So then for the computer, we are left with the following syntax that works:

Module Function Option1, Option2, ....

The module is fixed, position 1.
The function is fixed, position 2.
The options are everything that follows.

In our example, that would be:

dogs show black

Is it English?  No but it isn't Spanish, Italian, and whatever language I have 
left out.  It is Asterisk and computers.  It also means profitable employment 
for people willing to learn this language.

We could fix the verbs that are used, but that means that every module would 
have to have the same core verbs and we could have no exceptions.  That means 
that ZAP, SIP, and MeetMe could have no functions that adhere outside the 
standards OR that most modules would have huge amounts of unnecessary functions 
which do nothing but take up space and cause bugs.

_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to