Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:46:37+00:00 2026-05-27T20:46:37+00:00

For a language that has an easy shorthand syntax for lists, ex x =

  • 0

For a language that has an easy shorthand syntax for lists, ex

x = [1,2,3];

And the ability to overload functions with different signatures…

Are there any uses for a variable argument syntax for functions that wouldn’t be just as clearly done via lists? For example, a common use for varargs is for a printf type statement:

printf("This is %s while this is a number %d\n", "a string", 10);

However, you could just as easily and clearly do the above with:

printf("This is %s while this is a number %d\n", ["a string", 10]);

The only thing I’ve been able to come up with so far would be the implementation of control flow structures like if/elseif/else where you’d want to be able to pass in a variable number of elseif/else blocks. However, this could be avoided by breaking elseif into else with an if as the single command.

So, are there types of things cannot be done (cleanly/clearly) without specifically having a varargs syntax?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:46:38+00:00Added an answer on May 27, 2026 at 8:46 pm

    Variable args should be included even when shorthand lists can serve the same purpose since they increase intuitiveness and reduce errors.

    [This is assuming that you agree an acceptable “use” for a language feature is intuitiveness and error reduction.]

    I base this on the purely anecdotal experience of having both of these features in a proprietary game scripting language and the observed learning curve and common errors made by the users. [The users ranged from fresh out of school to industry veterans on several multi-year projects over a decade and a half in different game companies – the largest with 160 team members (20 core script users + 50 or so script real-time “command-line” users). Some were pure scripters that only knew this scripting language or a couple others and some were also expert C++ programmers – both groups seemed to have the same results on this issue.]

    [If it is relevant – the language that I am basing this on also had typed variable arguments and all types have a common base class.]

    Over the years I created a number of dual methods that were identical though one used variable length arguments and another used a list. Internally both the methods with different interfaces would boil down to the same code – they amounted to a stylistically syntactic difference only.

    In the “wild” I found the mechanism using a shorthand list with two additional characters to include meant that there are just two more characters that can be forgotten. I base this on the number of times I was called to “help out” users that were having trouble with the list based versions of methods as opposed to the variable argument methods.

    As for intuitiveness I’ve done some profiling/counting on methods and the number of instances of using the variable length methods vastly outweighed the list methods. Also when asked people seemed to aesthetically prefer the variable arg versions.

    However I still believe that there is great utility in having the list based methods especially when making more complex calls and meta-programming since it is handy to treat a bunch of arguments as a single unit and common list functions – intersections, unions, filtering, etc. can be used on the arguments as well.

    I’m a big believer of only adding the features that are necessary to reduce the amount that a given programmer needs to keep in their head at any one time though over the years I have found that a valid exception to this rule is sometimes warranted if a feature is easier to use or causes less errors. [An earlier scripting language I wrote was very streamlined – and elegant in my opinion – though I learned the hard way that people liked it more and had less problems with it once I evolved it to have a little more “redundancy” in the name of intuitiveness and error reduction.]

    Obviously different languages with different elements around these features and different users and domains could have different results – though for what it is worth I’m fairly confident based on how long I have made my observations.

    [Also]

    Another potential concrete difference between variable args and shorthand lists depends on whether the language can specify a difference between how arguments are passed into a variable arg aspect of a method/function interface and arguments/statements used as elements in a shorthand list.

    If the variable arg parameter can specify something above and beyond what can be specified for a shorthand list (or vice-versa) – i.e. arguments are passed by reference rather or by value, arguments are to use some sort of lazy evaluation or evaluated on call, etc. – then more could be done with one or the other syntax.

    This is really language dependant and there would be no difference if arguments used by a variable argument “group” or shorthand list elements could be “passed” in the same way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Jquery has a great language construct that looks like this: $(document).ready(function() { $(a).click(function() {
My father has found a Russian language keyboard mapping that he really likes here
It has been said that C# can be regarded as a functional programming language,
Maybe there are VB.net and other language that related with .Net framework. When I
Is there some default Windows scripting language that comes pre-installed on XP and Vista
This can be in any high-level language that is likely to be available on
I'm working on an experimental programming language that has global polymorphic type inference. I
Has anyone had experience generating files that have filenames containing non-ascii international language characters?
It seems that Apple has so far gone the furthest of any mobile platform
I have a small web application that has multi-language support (en, de, it, fr,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.